How to add SOAP header

  

A web services used in my app requires authentication, how do I add the SOAP headers in the request?

Stanley

Hi Stanley

The solution for the problem is what João Neves posted, but we are studying authentication scenarios in SOAP. Can you tell me what kind of authentication your service is using?

I am not familiar with the SOAP standards, here is the authentication header:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <soapenv:Header>
  <wsse:Security>
         <wsse:UsernameToken>
           <wsse:Username>XXXXX</wsse:Username>
           <wsse:Password>XXXXX</wsse:Password>
         </wsse:UsernameToken>
  </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
   </soapenv:Body>
</soapenv:Envelope>

Is there an example how to apply it?


Thanks,

Stanley


Hi Stanley.

Thank you for your feedback, this will be very helpful for us to improve the platform.

João

Edit: Sorry, I missed the part of the post where you ask for an example. Are you talking about an example of how to use EnhancedWebReferences?

João,

I want to know how to use the SetWebReferenceSoapHeaders, how to map the user and password to the structure used in the function.

Thanks,

Stanley

Hi Stanley

See if the attached image can help you.

I got "wsse is an unknown prefix" error. If it is removed then it cannot connect to the server.

Solution

Hi Stanley

Can you try it like this? 

Solution

It works. Thanks João.

The web services use separate services for authentication and the actual service. The authentication works and returns a token to be used in the service calls. However, the service call failed because it is trying to call the localhost. Yet both web services are imported from the same server. How to fix this?



I believe the import is not complete because I got the following error during importing:


Hi João.

I used "SetWebReferenceSoapHeaders" at a .NET stack and it worked perfectly. But I tried the same implementation at a Java stack, with the same WS, and it did not worked.

Do you know if there are any problem with this in the Java stack?

My case is similar to that described by Stanley.

Best regards.
Juliano

Juliano Custódio Parreira wrote:

Hi João.

I used "SetWebReferenceSoapHeaders" at a .NET stack and it worked perfectly. But I tried the same implementation at a Java stack, with the same WS, and it did not worked.

Do you know if there are any problem with this in the Java stack?

My case is similar to that described by Stanley.

Best regards.
Juliano


This thread is long, and Stanley reported a number of issues. What exact issue are you having?

J.Ja