Hi,
    Unfortunately we are having problems getting it to work. After we add the header, C# hasnt been able to recognize SessionID as an element. service.sessionID doesnt come up.
   
    Could you please share ur experience in a lil more detail? Or could you post the changed wsdl ??
srini

Stefano Sambi wrote:
Thanks for your responses, it seems that it works.
Thank you
Stefano



----- Original Message -----
From: "Abhinav Maheshwari" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 11, 2004 2:27 PM
Subject: RE: C# Cllient , Axis Server, Session Management


  
Hi Stefan,
I am pasting a wsdl for your reference. Please see the embedded comments.

On the client side, C# needs to see the SessionID element in WSDL so that
    
it
  
can create member variable SessionID for the service. But Axis does not
generate such a WSDL. Hence you need to modify the WSDL produced by Axis
    
and
  
manually add the SessionID element. Then you should use the modified WSDL
    
in
  
Visual Studio. Following is an example of the modified WSDL with the
comments preceding the modifications.

After you show this WSDL to Visual Studio, it will generate the proxy and
you can retreive the Session ID by using authenticationService.SessionID.
Hope this helps.

Warm Regards,
Abhinav Maheshwari



<wsdl:definitions

    
targetNamespace="http://tornado/portfolioip/services/AuthenticationService"
  
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns2="http://pair.biz.portfolioip.its.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns1="http://exception.services.portfolioip.its.com"
xmlns:impl="http://tornado/portfolioip/services/AuthenticationService"
xmlns:intf="http://tornado/portfolioip/services/AuthenticationService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:fip="http://foundationip.com/services"
xmlns="http://schemas.xmlsoap.org/wsdl/"><wsdl:types><schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://exception.services.portfolioip.its.com"><import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType
name="InvalidUsernameException"><sequence><element name="message"
nillable="true" type="xsd:string"/></sequence></complexType><complexType
name="InvalidPasswordException"><sequence><element name="message"
nillable="true"
    
type="xsd:string"/></sequence></complexType></schema><schema
  
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://pair.biz.portfolioip.its.com"><import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType
name="AuthenticationFacadeException"><sequence><element name="message"
nillable="true" type="xsd:string"/></sequence></complexType></schema>

<!-- added session ID element. The namespace must match the namespace in
SessionHandler -->
     <schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://foundationip.com/services">
       <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
         <complexType name="SessionID">
           <sequence>
             <element name="ID" minOccurs="1" maxOccurs="1"
type="xsd:string" />
           </sequence>
         </complexType>
     </schema>
<!-- end of session ID element -->

</wsdl:types>

  <!-- added a header for session -->
  <wsdl:message name="sessionHeader">
    <wsdl:part name="SessionID" type="fip:SessionID" />
  </wsdl:message>
  <!-- end of session header -->

  <wsdl:message name="authenticateResponse">
  </wsdl:message>
  <wsdl:message name="authenticateRequest">
    <wsdl:part name="userName" type="xsd:string"/>
    <wsdl:part name="password" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="InvalidUsernameException">
    <wsdl:part name="fault" type="tns1:InvalidUsernameException"/>
  </wsdl:message>
  <wsdl:message name="AuthenticationFacadeException">
    <wsdl:part name="fault" type="tns2:AuthenticationFacadeException"/>
  </wsdl:message>
  <wsdl:message name="InvalidPasswordException">
    <wsdl:part name="fault" type="tns1:InvalidPasswordException"/>
  </wsdl:message>
  <wsdl:portType name="AuthenticationService">
    <wsdl:operation name="authenticate" parameterOrder="userName
    
password">
  
      <wsdl:input name="authenticateRequest"
message="impl:authenticateRequest"/>
      <wsdl:output name="authenticateResponse"
message="impl:authenticateResponse"/>
      <wsdl:fault name="AuthenticationFacadeException"
message="impl:AuthenticationFacadeException"/>
      <wsdl:fault name="InvalidPasswordException"
message="impl:InvalidPasswordException"/>
      <wsdl:fault name="InvalidUsernameException"
message="impl:InvalidUsernameException"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="AuthenticationServiceSoapBinding"
type="impl:AuthenticationService">
    <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="authenticate">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="authenticateRequest">
        <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost/portfolioip/services/AuthenticationService"/>
      </wsdl:input>
      <wsdl:output name="authenticateResponse">

        <!-- Authentication service returns a Session ID. If a service
    
needs
  
a session ID during request, this element should also be present in
    
request
  
definition -->

        <wsdlsoap:header use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
message="impl:sessionHeader" part="SessionID"  />
        <wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://tornado/portfolioip/services/AuthenticationService"/>
      </wsdl:output>
      <wsdl:fault name="AuthenticationFacadeException">
        <wsdlsoap:fault use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://tornado/portfolioip/services/AuthenticationService"/>
      </wsdl:fault>
      <wsdl:fault name="InvalidPasswordException">
        <wsdlsoap:fault use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://tornado/portfolioip/services/AuthenticationService"/>
      </wsdl:fault>
      <wsdl:fault name="InvalidUsernameException">
        <wsdlsoap:fault use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://tornado/portfolioip/services/AuthenticationService"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="AuthenticationServiceService">
    <wsdl:port name="AuthenticationService"
binding="impl:AuthenticationServiceSoapBinding">
      <wsdlsoap:address
location="http://tornado/portfolioip/services/AuthenticationService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


-----Original Message-----
From: Srinivas Vemula [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 11, 2004 3:29 PM
To: [EMAIL PROTECTED]
Subject: Re: C# Cllient , Axis Server, Session Management


Hi Stefan,


         <complexType name="SessionID">
           <sequence>
             <element name="ID" minOccurs="1" maxOccurs="1"
type="xsd:string" />
           </sequence>
         </complexType>
     </schema>
<!-- end of session ID element -->

</wsdl:types>
See if this works..
srini
Stefano Sambi wrote:

I'm trying to use your SessionHandler to manage session between C# client
and Axis web service but I do not succeed to set the SOAP header in my
    
wsdl.
  
Can you send me an example of your wsdl? And also how do you manage
    
sessions
  
in your C# client?

Here it's my changes to wsdl that don't work:
I added the definition of sessionID element in 'Types' section:
<wsdl:types>
  <xsd:schema targetNamespace=http://localhost/axis/services/MyService>
    <xsd:complexType name="Session">
      <xsd:sequence>
        <xsd:element name="sessionID">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="ID" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:schema>
</wsdl:types>

I added the definition of soap header message in 'Messages' section:
<wsdl:message name="soapHeader">
    <wsdl:part name="SessionID" type="impl:Session"
xmlns:impl=http://localhost/axis/services/MyService/>
</wsdl:message>

and I added the soap header binding to my operation in 'Binding' section:
<wsdlsoap:header message="impl:soapHeader" part="SessionID" use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />



Thanks
Stefano

----- Original Message -----
From: "Abhinav Maheshwari" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 16, 2004 3:15 PM
Subject: RE: C# Cllient , Axis Server, Session Management



Hi Srinivas,
You need to use the SessionHandler to maintain session information but

there

are problems with using the one supplied with Axis. This is a modified
version of the SessionHandler supplied with Axis which can be used.

Also, you need to manually put the SOAP Header in the WSDL generated by

Axis

so that Visual Studio can generate the code for session variables.

Regards,
Abhinav

-----Original Message-----
From: Srinivas Vemula [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 16, 2004 6:30 PM
To: [EMAIL PROTECTED]
Subject: C# Cllient , Axis Server, Session Management


Hi All,
      I am new to using axis. We are trying to communciate from a .NET
C# client. Can any one let me know, how to track sessions in this
scenario? Basically, we would like to put some authorization info in  a
session object as the first call from the client will be for

authentication.

    After that client will call  other Axis (web) services for executing
some more tasks. We would like to check for the authorization
information for subsequent calls from the same client and deny services
if we dont find the relevant information in the session object .
    Any help or pointers to solve this? Thank you all for your help and
time.
srini

--
Srinivas Vemula                          +91 40 23547826- Ext 201
Associate Consultant                     +91 40 23541447 (Fax)
Mensamind                                +91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for
the named recipient(s) only. If you are not an intended recipient of this
email you must not copy, distribute or take any further action in reliance
on it. You should delete it and notify the sender immediately.






--
Srinivas Vemula                          +91 40 23547826- Ext 201
Associate Consultant                     +91 40 23541447 (Fax)
Mensamind                                +91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for
the named recipient(s) only. If you are not an intended recipient of this
email you must not copy, distribute or take any further action in reliance
on it. You should delete it and notify the sender immediately.


    

  

-- 
Srinivas Vemula                          +91 40 23547826- Ext 201
Associate Consultant                     +91 40 23541447 (Fax)
Mensamind                                +91 98497-42720 (Mobile)        
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for the named recipient(s) only. If you are not an intended recipient of this email you must not copy, distribute or take any further action in reliance on it. You should delete it and notify the sender immediately.

Reply via email to