Change SOAP Header before call WS

vagueante

Active member
Joined
Feb 20, 2009
Messages
28
Location
Portugal
Programming Experience
10+
Hi,

I need to change the soap header when i invoke a webservice, that does not have this properties in the wsdl, but i have a sample of the soap message of what the WS, not .net, is waiting to validate.

I need to put the headersoap as shown bellow
VB.NET:
<soapenv:Header>                                                                                                                                                                                                                           
      <credentials xmlns:teu-sec-crd="http://eu.site.com/security/credentials/1.0">
         <username>user</username>
         <password>123</password>
      </credentials>                                                                                                                                                                                                                         
 </soapenv:Header>

I've found several code samples, but all that samples didn't work and i think that it has something to do with the attribute of the credentials tag.
But how i can't see the soap, i don't know at the moment what changes i'm making in the soap envelope.

Need help.

Ths
 
Credentials are usually passed to the proxy through the Credentials property if you're using 'web reference' or ClientCredentials property for 'service reference'. If the credentials is instead passed in soap headers a proxy class is generated for this, you then have to create an instance of this class and assign to the the client proxy instance.
But how i can't see the soap, i don't know at the moment what changes i'm making in the soap envelope.
When using the proxy classes the correct soap messages are generated and sent, you just have to worry about using the service according to the protocol, ie call the correct methods and supply the correct bits of information. The service model should be documented.
 
... If the credentials is instead passed in soap headers a proxy class is generated for this, you then have to create an instance of this class and assign to the the client proxy instance.


I think iv'e already created my proxy class , and i now i have to change it to include in the soap header the credentials. That's where i'm stoped at the moment.

In many samples i've seen, nothimg seems similar to what i want.
 
Credentials are usually passed to the proxy through the Credentials property if you're using 'web reference' or ClientCredentials property for 'service reference'. If the credentials is instead passed in soap headers a proxy class is generated for this, you then have to create an instance of this class and assign to the the client proxy instance.

When using the proxy classes the correct soap messages are generated and sent, you just have to worry about using the service according to the protocol, ie call the correct methods and supply the correct bits of information. The service model should be documented.

The WSDL (Jave WS), doesn't have defined the soap headers properties. I need to add the soap headers before i invoke the WS.

Is there a way of doing this?

Thanks
 
I can't verify this without the wsdl. (ref: http://www.vbdotnetforums.com/web-s...information-ws-only-wsdl-xsd-start-point.html)
Are you sure the credentials header is not passed when you set the Credentials/ClientCredentials property ?

The wsdl creates a reference.vb, that does not have any method/function so i can pass the user and password required.
I have a wsdl, 2 xsd, and the sample soap file.

Is there a way to send it to you? Since is coorporate Ws (even if is in the test period), i wouldn't like it to be public.

I've attached all the files with txt ext, and without the main site reference name.

Thanks
 

Attachments

  • Files.zip
    17.5 KB · Views: 45
I had a look at the proxy types and can confirm there is no client property for any credentials service type.
I also researched some more about the Credentials/ClientCredentials and it appears these are for transport level authentication, not message level (soap).
It seems to me the missing wsdl definitions is a flaw with the service. While it may be possible to modify the generated soap messages when using the service proxy I'm not aware of how.
 
Back
Top