Title: Message
Take a look at the enclosed java file. It is a modified version of the SimpleSessionHandler class (it was a prototype version I wrote some times ago. It might not compile anymore, but if you compare it with the current SimpleSessionHandler class it should give you some hints on how to modify it). I wanted to propose a patch to Axis to have a complex type for SimpleSessionHandler, but I did not get the time to do it yet.
 
For the WSDL file, you need to have a custom WSDL (either fixed file referenced in the wsdd or your custom WSDL generator through Axis handler. Check Axis documentation and mailing list archive for more information). Here is the difference pieces that we added to our WSDL (it is probably not an exact match with what I modified in the attached SessionHandler but it should be close enough):
 
The session ID type:
<complexType name="SessionID">
    <sequence>
        <element name="ID" minOccurs="1" maxOccurs="1" type="xsd:string" />
  </sequence>
</complexType>
 
The session message:
<wsdl:message name="sessionHeader">
    <wsdl:part name="SessionID" type="intf:SessionID" />
</wsdl:message>
 
The soap header in the operation. In this example, only on the request, but can be on both or only the response depending of the operation. Typically the "login" operation will have the header on the output message (response) and all the other operations will have the header on the input message (request): 
<wsdl:operation name="RunJob">
    <wsdlsoap:operation soapAction="" />
        <wsdl:input name="RunJobRequest">
            <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                      namespace=http://jobcontrol.dmi.ascentialsoftware.com/ />
            <wsdlsoap:header use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                        namespace=http://jobcontrol.dmi.ascentialsoftware.com/ message="intf:sessionHeader" part="SessionID" />
  </wsdl:input>
   <wsdl:output name="RunJobResponse">
       <wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                                                          namespace=http://jobcontrol.dmi.ascentialsoftware.com/ />
  </wsdl:output>
</wsdl:operation>
 
Thomas
-----Original Message-----
From: Niklas Magnusson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 9:04 AM
To: [EMAIL PROTECTED]
Subject: RE: SOAP header-based sessions and .NET

Sorry, have one more question...
How can I get the SOAP header information to be in the WSDL I thought I had it there but that was not the case. It's not even in the right place, it's not there at all so I have two problems.
1. Get the SOAP header in the WSDL and in the right place.
2. Turn the header into a complex type so .NET can handle it.
 
Any one who have an answer or some help?
 
Thanks!
/Niklas
-----Original Message-----
From: Niklas Magnusson [mailto:[EMAIL PROTECTED]]
Sent: den 8 januari 2003 14:14
To: [EMAIL PROTECTED]
Subject: RE: SOAP header-based sessions and .NET

Ok, as you probably already have figured out I'm trying to use the SimpleSessionHandler class which I have added in the request and response flow of the service. So .NET must have a complex type get it work. Do you have a tip on how I fix this? Right now I don't have a clue....
 
Thanks!
/Niklas
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: den 7 januari 2003 16:50
To: [EMAIL PROTECTED]
Subject: RE: SOAP header-based sessions and .NET

If you WSDL contains the corresponding SOAP header information at the right place, then .NET will pick it up automatically and the generated code when adding the web reference will take care of it automatically (check WSDL spec to see how SOAP headers are declared in the WSDL).
One thing to be aware of: .NET cannot handle the header automatically if it is not a complex type (if it is just one element of type xsd:string like it is in the soap header session handler sample delivered with axis, it will not work, you need to have a specific complex type, even if this type has only one field which is a string).
 
Thomas 
-----Original Message-----
From: Niklas Magnusson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: SOAP header-based sessions and .NET

Hi!
 
I've a service in Axis that uses SOAP header-based sessions it works fine but if I wan't to use this service from a C# program how do I add the sessionID to the SOAP header in the request?
 
Regards!
/Niklas

Attachment: SessionHandler.java
Description: Binary data

Reply via email to