soap header authentication in webservice
Moderators: chulett, rschirm, roy
soap header authentication in webservice
Hi, I am using webservice client stage to read data from webservice and also post data to webservice. i have been recently asked to add soap header authentication, i tried with input arguments for webservice read and also have column with soap header xml message passing to webservice post, both of them are not working, i am looking good sample to follow if any one has please share with me.
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop ... env:Header>
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop ... env:Header>
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
WebService Client stage is one-way interaction. You need WebService Transfomer stage if you need request-response interaction.
As a general rule the default header that gets built is inadequate, particularly if it needs to include security information, so that you're better off building your own in a (regular) Transformer stage.
As a general rule the default header that gets built is inadequate, particularly if it needs to include security information, so that you're better off building your own in a (regular) Transformer stage.
Last edited by ray.wurlod on Tue Feb 26, 2013 3:07 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Step 1 is to make sure you can successfully call the web service using a tool like SOAPui. Be certain that you know exactly what the SOAP header looks like and what should be in it.
I agree with Ray....it's nice to use a transformer to build your SOAP header....then it can be dynamic. As I recall, the WS/Client has a property for the SOAP header, but I almost never bother to use it (the WSClient Stage) unless I have a service whose input is VOID.
Your testing and development flexibility and creativity increases if you use the WSTransformer instead.
Even so ---- get it working with something like SOAPui, then cut/paste the header that works there, directly into a column for the transformer called something like "myHeader"......and THEN move on to ways to make it more dynamic (if needed).
Ernie
I agree with Ray....it's nice to use a transformer to build your SOAP header....then it can be dynamic. As I recall, the WS/Client has a property for the SOAP header, but I almost never bother to use it (the WSClient Stage) unless I have a service whose input is VOID.
Your testing and development flexibility and creativity increases if you use the WSTransformer instead.
Even so ---- get it working with something like SOAPui, then cut/paste the header that works there, directly into a column for the transformer called something like "myHeader"......and THEN move on to ways to make it more dynamic (if needed).
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
I followed u r suggestion, able to make it successfull with soap ui with soap header authentication, i used same soap header just need to add name space following name space part of header in DS because it is auto generated in soapui. xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/". In DS, soap header looks like below which I am creating it as part of transformer between xml output stage and WS client stage and passing it to Input Header via user defined header.
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://tempuri.org/"><scurityContextPar ... env:Header>'
I am getting fatal error
ws_Call_InsertissTouches,0: Failure during execution of operator logic.
then
APT_CombinedOperatorController,0: Fatal Error: Fatal: 0026`:`com.ascentialsoftware.wsclient.ServiceInvocationException: Service invocation exception:
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1602)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1544)
at com.ascentialsoftware.wspack.Transformer.process(Transformer.java:104)
at com.ascentialsoftware.jds.StageFactory.runStage(StageFactory.java:544)
at com.ascentialsoftware.jds.StageFactory.runTarget(StageFactory.java:348)
Caused by: java.lang.NullPointerException
at com.ascentialsoftware.wsclient.xml.DerivationExpression._getToken(DerivationExpression.java:180)
at com.ascentialsoftware.wsclient.xml.DerivationExpression._setLastSegment(DerivationExpression.java:199)
at com.ascentialsoftware.wsclient.xml.DerivationExpression.hasMoreTokens(DerivationExpression.java:130)
at com.ascentialsoftware.wsclient.xml.DerivationParser.expr(DerivationParser.java:170)
at com.ascentialsoftware.wsclient.xml.DerivationParser.parse(DerivationParser.java:138)
at com.ascentialsoftware.wsclient.xml.TreeBuilder.compileRules(TreeBuilder.java:84)
at com.ascentialsoftware.wsclient.MappingHandler.fromArray(MappingHandler.java:304)
at com.ascentialsoftware.wsclient.InputRequest.buildRequestBodyDocument(InputRequest.java:908)
at com.ascentialsoftware.wsclient.WebService.callServiceInternal(WebService.java:1625)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1591)
... 4 more
xml file looks below in the peek
Peek_80,0: InsertissTouches_XML:<?xml version="1.0" encoding="UTF-8"?>
<!--
- Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Tue Feb 26 23:39:01 2013
-->
<ns1:InsertISSTouches xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://schemas.datacontract.org/2004/07/WinwatcherBL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:Touches>
<ns2:Import_TouchLog>
<ns2:RCNum>
711952
</ns2:RCNum>
<ns2:DispositionID>
U
</ns2:DispositionID>
<ns2:DivisionID>
15
</ns2:DivisionID>
<ns2:Imported>
0
</ns2:Imported>
<ns2:ImportedDateTime>
2013-02-26T23:38:56
</ns2:ImportedDateTime>
<ns2:MarketID>
0
</ns2:MarketID>
<ns2:Notes>
vm
</ns2:Notes>
<ns2:OpportunityID>
0
</ns2:OpportunityID>
<ns2:TouchCode>
0
</ns2:TouchCode>
<ns2:TouchDate>
2012-10-16T12:15:51.117
</ns2:TouchDate>
<ns2:TouchID>
3132512
</ns2:TouchID>
<ns2:TouchLogDate>
2012-10-16T12:14:40.310
</ns2:TouchLogDate>
<ns2:TouchMethod>
0
</ns2:TouchMethod>
<ns2:TouchTypeID>
004
</ns2:TouchTypeID>
<ns2:UserID>
RCS
</ns2:UserID>
</ns2:Import_TouchLog>
</ns1:Touches>
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://tempuri.org/"><scurityContextPar ... env:Header>'
I am getting fatal error
ws_Call_InsertissTouches,0: Failure during execution of operator logic.
then
APT_CombinedOperatorController,0: Fatal Error: Fatal: 0026`:`com.ascentialsoftware.wsclient.ServiceInvocationException: Service invocation exception:
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1602)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1544)
at com.ascentialsoftware.wspack.Transformer.process(Transformer.java:104)
at com.ascentialsoftware.jds.StageFactory.runStage(StageFactory.java:544)
at com.ascentialsoftware.jds.StageFactory.runTarget(StageFactory.java:348)
Caused by: java.lang.NullPointerException
at com.ascentialsoftware.wsclient.xml.DerivationExpression._getToken(DerivationExpression.java:180)
at com.ascentialsoftware.wsclient.xml.DerivationExpression._setLastSegment(DerivationExpression.java:199)
at com.ascentialsoftware.wsclient.xml.DerivationExpression.hasMoreTokens(DerivationExpression.java:130)
at com.ascentialsoftware.wsclient.xml.DerivationParser.expr(DerivationParser.java:170)
at com.ascentialsoftware.wsclient.xml.DerivationParser.parse(DerivationParser.java:138)
at com.ascentialsoftware.wsclient.xml.TreeBuilder.compileRules(TreeBuilder.java:84)
at com.ascentialsoftware.wsclient.MappingHandler.fromArray(MappingHandler.java:304)
at com.ascentialsoftware.wsclient.InputRequest.buildRequestBodyDocument(InputRequest.java:908)
at com.ascentialsoftware.wsclient.WebService.callServiceInternal(WebService.java:1625)
at com.ascentialsoftware.wsclient.WebService.callService(WebService.java:1591)
... 4 more
xml file looks below in the peek
Peek_80,0: InsertissTouches_XML:<?xml version="1.0" encoding="UTF-8"?>
<!--
- Generated by Ascential Software Corporation, DataStage - XMLOutput stage -
- Tue Feb 26 23:39:01 2013
-->
<ns1:InsertISSTouches xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://schemas.datacontract.org/2004/07/WinwatcherBL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:Touches>
<ns2:Import_TouchLog>
<ns2:RCNum>
711952
</ns2:RCNum>
<ns2:DispositionID>
U
</ns2:DispositionID>
<ns2:DivisionID>
15
</ns2:DivisionID>
<ns2:Imported>
0
</ns2:Imported>
<ns2:ImportedDateTime>
2013-02-26T23:38:56
</ns2:ImportedDateTime>
<ns2:MarketID>
0
</ns2:MarketID>
<ns2:Notes>
vm
</ns2:Notes>
<ns2:OpportunityID>
0
</ns2:OpportunityID>
<ns2:TouchCode>
0
</ns2:TouchCode>
<ns2:TouchDate>
2012-10-16T12:15:51.117
</ns2:TouchDate>
<ns2:TouchID>
3132512
</ns2:TouchID>
<ns2:TouchLogDate>
2012-10-16T12:14:40.310
</ns2:TouchLogDate>
<ns2:TouchMethod>
0
</ns2:TouchMethod>
<ns2:TouchTypeID>
004
</ns2:TouchTypeID>
<ns2:UserID>
RCS
</ns2:UserID>
</ns2:Import_TouchLog>
</ns1:Touches>
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Try it without using the namespace references but, instead, using the explicit URLs that belong to each namespace. I have found this to work in the past. Sometimes, it seems, the WebServices Transformer stage simply does not work properly with namespace references when the header is customised.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
The name space declaration within soap header, for soapenv and ns3, without that it is was giving bound error message, i believe u r suggesting to remove name space declaration and also name space refrrence in tags within soapheader. I am newbie to xml and webservice, let me try.
The below name space within xml are generated by datastage as part of SOAP Body or message <ns1:InsertISSTouches xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/........
The below name space within xml are generated by datastage as part of SOAP Body or message <ns1:InsertISSTouches xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/........
Make sure also that the whole payload "as is" from SOAPui can be called effectively. ...just in case the error has nothing to do with your particular payload and is something in the installation or configuration.
Do this by having one single column coming into the WSTransformer directly from a regular Transformer (longvarchar, length of something like 99999).
In the WSTransformer at the Input link "message" tab, find the pull down that says something like "user defined message". Pull that down and find your single column. select it.
In the Derivation of the upstream transformer, paste the ENTIRE successful SOAP input payload from SOAPui. Surround it with SINGLE quotes as a simple string.
Compile and run. See what you get. If it works, you can opt to try and create that payload yourself, which is critical anyway if the xml is complex and has multiple repeating nodes. ....but it also validates that things are working under the covers and it's just the namespace entanglement that you have to get right.
Ernie
Do this by having one single column coming into the WSTransformer directly from a regular Transformer (longvarchar, length of something like 99999).
In the WSTransformer at the Input link "message" tab, find the pull down that says something like "user defined message". Pull that down and find your single column. select it.
In the Derivation of the upstream transformer, paste the ENTIRE successful SOAP input payload from SOAPui. Surround it with SINGLE quotes as a simple string.
Compile and run. See what you get. If it works, you can opt to try and create that payload yourself, which is critical anyway if the xml is complex and has multiple repeating nodes. ....but it also validates that things are working under the covers and it's just the namespace entanglement that you have to get right.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
...and you've tried sending up the EXACT payload from SOAPui, inside of DS? (meaning...just copy and paste it into a transformer...whole payload). Send that into the WSTransformer with "user defined column" selected.
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
