calling axis webserivce with credentials in header


K

Kjartan Furnes

Hi,

I'm trying to access a webservice on an axis server from my .net client
(c#). First I have to call a login service that returns a session ID. This
session id should then be added to the header of the actual webserivce call
together with a userid and version number. The header should look like this:

<soapenv:Header>
<ns1:UserID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:ns1="AuthHeader"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">user1</ns1:UserID>
<ns2:SessionID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:ns2="AuthHeader"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">5656640673802095969</ns2:SessionID>
<ns3:Version soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:ns3="AuthHeader"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">9.1</ns3:Version>
</soapenv:Header>

The problem is that the wsdl doesn't have any information about the header.
So the proxy generated by the wsdl tool has no way of including these
elements in the header. I've tried to create a class that overrides soap
header and added these values. The result looks like this:

<soap:Header><types:AuthHeader id="h_id1"><UserId
xsi:type="xsd:string">user1</UserId><SessionId
xsi:type="xsd:long">5656640673802095969</SessionId><Version
xsi:type="xsd:string">9.1</Version></types:AuthHeader ></soap:Header>



I have googled a bit and can see that there are some interop. issues with
..net and axis but haven't found a solution to this yet. I've also tried to
modify the wsdl to include the header but with litle success. Does anyone
know how to solve this ? I realy don't want to create the soap message with
a string builder...
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top