Problem with tSOAP with UsernameToken in Header

Highlighted
Four Stars

Problem with tSOAP with UsernameToken in Header

Hi Community,

 

i tried to figure out the problem by myself searching the web, but i did not find the right answer. Maybe you can help me.

 

I am trying to request information from a SOAP interface by  using a simple tSOAP component. The tSOAP component is set-up as follows:

 

ENDPOINT: "http://advertiser-webservices.affili.net/V5/WSDLFactory/OrderManagement.wsdl"

SOAP Action: "http://affilinet.framework.esbfa/advertiserservices/ordermanagement/OrderManagementContract/GetOrder..."

SOAP Message:

 

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"http://affilinet.framework.esbfa/advertiserservices/ordermanagement/messages\" xmlns:ns2=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:ns3=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">
        <SOAP-ENV:Header>
                <ns2:Security SOAP-ENV:mustUnderstand=\"1\">
                        <ns2:UsernameToken>
                                <ns2:Username>xxx</ns2:Username>
                                <ns2:Password>xxx</ns2:Password>
                                <ns3:Created>2018-06-12T11-52-52Z</ns3:Created>
                        </ns2:UsernameToken>
                </ns2:Security>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
                <ns1:GetOrdersRequest>
                        <ns1:EndDate>2018-06-07T23:59:59</ns1:EndDate>
                        <ns1:Page>1</ns1:Page>
                        <ns1:PageSize>1000</ns1:PageSize>
                        <ns1:ProgramId>xxx</ns1:ProgramId>
                        <ns1:PublisherIds/>
                        <ns1:StartDate>2018-06-07T00:00:00</ns1:StartDate>
                        <ns1:TransactionStatus>All</ns1:TransactionStatus>
                        <ns1:ValuationType>RegistrationDate</ns1:ValuationType>
                </ns1:GetOrdersRequest>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
"

The endpoint, the action and the message as well work, as they are tested with a CURL script. The CreatedDate of the UsernameToken is set to the current datetime manually by me, to start of simple. I also tried setting it by currentDate, but this did not change anything.

 

All i want to do, is run a tested set-up by a Talend component and i receive the following error:

 

Jun 12, 2018 11:53:08 AM com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
SCHWERWIEGEND: SAAJ0008: Bad Response; Method Not Allowed
Exception in component tSOAP_1 (dc_affilinet)
com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:191)
	at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:147)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.tFixedFlowInput_1Process(dc_affilinet.java:1129)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.runJobInTOS(dc_affilinet.java:1543)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.main(dc_affilinet.java:1392)
Caused by: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:185)
	... 4 more
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:368)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:214)
	... 6 more

CAUSE:

java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:185)
	at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:147)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.tFixedFlowInput_1Process(dc_affilinet.java:1129)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.runJobInTOS(dc_affilinet.java:1543)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.main(dc_affilinet.java:1392)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:368)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:214)
	... 6 more

CAUSE:

java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:185)
	at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:147)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.tFixedFlowInput_1Process(dc_affilinet.java:1129)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.runJobInTOS(dc_affilinet.java:1543)
	at udgsmartreport.dc_affilinet_0_1.dc_affilinet.main(dc_affilinet.java:1392)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (405Method Not Allowed
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:368)
	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:214)
	... 6 more
[statistics] disconnected

Does anyone now how to address this error?

 

Kind regards,

 

Maurus

Highlighted
Moderator

Re: Problem with tSOAP with UsernameToken in Header

Hello,

Are you able to successfully request information from a SOAP interface through Soap UI?

Screenshots of your component setting will be helpful for us to spot your problem.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Six Stars
Six Stars

Re: Problem with tSOAP with UsernameToken in Header

Hello MaurusBeck,

 

did you solve that problem anyhow? I'm facing the same issue right now.

I'm trying it with this as a header (still in SOAPUI)

 

 

 

 

 

<soapenv:Header> 
<wsse:Security soapenv:mustUnderstand="1">
<wsse:UsernameToken>
<wsse:Username>xxxx-xxxxxx</wsse:Username>
<wsse:Password>xxxxxxxpasswordplaintextxxxxxx</wsse:Password>
<wsu:Created>2018-10-11T18-50-00Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>

 

and this is my response:

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</faultcode>
<faultstring xml:lang="en-US">An error occurred when verifying security for the message.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>

Whats wrong with my Header?

 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog