axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa_abeysin...@yahoo.com>
Subject Re: Sessions with SOAP headers
Date Wed, 10 Nov 2004 11:21:22 GMT
>As you can see Axis Java is using multiref in using the session ID. Since Axis C++ >doesn't
support multiref and therefore  I don't think axis java can be used as one side in >testing.
 
You can use Axis Java with href/multiref diabled for testing with Axis C++ (I do use it and
it works).
See samples/client/session/cookies/readme.txt for details.
 
Re: 1. If I am to implement sessions with SOAP headers how do we get non Axis c SOAP engines
to work with Axis c client and server? In the above messages mustUnderstand is 0 and is it
possible to make it 1 when operating with other engines i.e. how will other implementations
understand the SOAP headers?
 
I think Axis Java must have faced the same problem. If we can do it similar to Axis Java,
I think it would be fine (Fisrt we have to make sure that we can interop with Axis Java. Then
we can see if Axis Java is capable of interoperating with .NET)

Re: 3. Should I try to implement sessions with soap headers for both the client and serverside
at this point?

I would suggest implementing it for client first, using Axis Java for server side.
Then we can think of C++ server side. (However, I think, as this is implemented as a Handler,
we could be able to use the same handler both on server side and on client side)

 

Thanks,

Samisa...



sanjaya singharage <sanjayas@opensource.lk> wrote:

(This is quite a large mail. My questions are raised at the end of the mail.)
 
I have been looking to support sessions with SOAP headers for Axis c 1.4.
 
I have run a sample on Axis Java to confirm whether it was the same impression of Web Service
Sessions that I have. 
It seems so. The Axis Java sample I used is described below. 
 
- The service was a sort of a counter, where the web service class had a member variable (initialized
to 10 ) of type integer named "counter".
The service method named "inc" would take an integer parameter and add that to the counter
variable and return the value of 
the counter. 
 
- for the service the following entry was needed in the server-config.wsdd.
 
<parameter name="scope" value="session"/>
 
- in the client the setMaintainSession(); should be invoked with parameter "true" on the Call
object that invokes the web service method as..

call.setMaintainSession(true);

- Then I run the client to invoke the inc metod three times with a parameters or 1, 2, 3 respectively.
The result received to thel client are 11, 13, 16 respectively.
Conclusion : The service is running with session scope and the same object is being used for
all invokations.

-(When the scope configuration is removed from server-config.wsdd for this service the result
recieved to the client is 11, 12, 13 respectively)
Conclusion: The service is runnig with request scope (I guess it is the default when no scope
is specified) and a new object is created for each SOAP request.

This way Axis Java uses cookies to support the sessions.

The same sample can be run using SOAP Headers in the following way.

- Use the following client-config.wsdd to configure the Handler Class org.apache.axis.handlers.SimpleSessionHandler
in the client side

==================================

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" 
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
      <globalConfiguration>

            <parameter name="adminPassword" 
               value="admin"/>
            <parameter name="attachments.implementation" 
               value=
                  "org.apache.axis.attachments.AttachmentsImpl"/>
            <parameter name=
               "sendMultiRefs" value="true"/>
            <parameter name="sendXsiTypes" value=
               "true"/>
            <parameter name=
               "sendXMLDeclaration" value="true"/>
            <parameter name="axis.sendMinimizedElements" 
               value="true"/>
            <requestFlow>
                  <handler type=
                  "java:org.apache.axis.handlers.SimpleSessionHandler"/>
            </requestFlow>
            <responseFlow>
                  <handler type=
                     "java:org.apache.axis.handlers.SimpleSessionHandler"/>
            </responseFlow>

      </globalConfiguration>

      <handler name="session" type=
         "java:org.apache.axis.handlers.SimpleSessionHandler"/>

      <transport name="java" pivot=
         "java:org.apache.axis.transport.java.JavaSender"/>
      <transport name="http" pivot=
         "java:org.apache.axis.transport.http.HTTPSender"/>
      <transport name="local" pivot=
         "java:org.apache.axis.transport.local.LocalSender"/>

</deployment>

=================================

- For the service, in the server-config.wsdd the follwing line should be added to configure
the Handler Class org.apache.axis.handlers.SimpleSessionHandler 
 <handler name="session" type="java:org.apache.axis.handlers.SimpleSessionHandler"/>


- the following lines should be added under the relevant service element.

<parameter name="scope" value="session"/>

<requestFlow> 
<handler type="session"/> 
</requestFlow> 
<responseFlow> 
<handler type="session"/> 
</responseFlow> 

- There is no need to invoke call.setMaintainSession(true); in the client.

- The first request / response looks like the following 

REQUEST

POST /axis/services/CalculatorService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta
Host: 127.0.0.1:80
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 782

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <add soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <op1 href="#id0"/>
   <op2 href="#id1"/>
  </add>
  <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:int" xmlns:soapenc="1http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
  <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:int" xmlns:soapenc="1http://schemas.xmlsoap.org/soap/encoding/">1</multiRef>
 </soapenv:Body>
</soapenv:Envelope>

RESPONSE

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Date: Tue, 09 Nov 2004 11:27:13 GMT
Server: Apache Coyote/1.0
Connection: close


<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:sessionID soapenv:actor="" soapenv:mustUnderstand="0" xsi:type="xsd:long" xmlns:ns1="3266492570349524909http://xml.apache.org/axis/session">3266492570349524909</ns1:sessionID>
 </soapenv:Header>
 <soapenv:Body>
  <addResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <addReturn xsi:type="xsd:int">102</addReturn>
  </addResponse>
 </soapenv:Body>
</soapenv:Envelope>

Subsequent request/responses look like the following

REQUEST 2

POST /axis/services/CalculatorService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta
Host: 127.0.0.1:80
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1200

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:sessionID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0"
href="#id0" xmlns:ns1="http://xml.apache.org/axis/session"/>
 </soapenv:Header>
 <soapenv:Body>
  <add soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <op1 href="#id1"/>
   <op2 href="#id2"/>
  </add>
  <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:int" xmlns:soapenc="5http://schemas.xmlsoap.org/soap/encoding/">5</multiRef>
  <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="xsd:int" xmlns:soapenc="5http://schemas.xmlsoap.org/soap/encoding/">5</multiRef>
  <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="soapenc:long" xmlns:soapenc="3266492570349524909http://schemas.xmlsoap.org/soap/encoding/">3266492570349524909</multiRef>
 </soapenv:Body>
</soapenv:Envelope>

RESPONSE 2

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Date: Tue, 09 Nov 2004 11:27:13 GMT
Server: Apache Coyote/1.0
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:sessionID soapenv:actor="" soapenv:mustUnderstand="0" xsi:type="xsd:long" xmlns:ns1="3266492570349524909http://xml.apache.org/axis/session">3266492570349524909</ns1:sessionID>
 </soapenv:Header>
 <soapenv:Body>
  <addResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <addReturn xsi:type="xsd:int">112</addReturn>
  </addResponse>
 </soapenv:Body>
</soapenv:Envelope>

I thought these messages will help understand how Axis Java uses SOAP headers for sessions.

As you can see Axis Java is using multiref in using the session ID. Since Axis C++ doesn't
support multiref and therefore  I don't think axis java can be used as one side in testing.


Now for the questions...

1. If I am to implement sessions with SOAP headers how do we get non Axis c SOAP engines to
work with Axis c client and server? In the above messages mustUnderstand is 0 and is it possible
to make it 1 when operating with other engines i.e. how will other implementations understand
the SOAP headers?

2. Is there some sort of standard in implementing seesions with SOAP headers? Should a WSDL
specify SOAP headers for a session ID for a session scope service? 

3. Should I try to implement sessions with soap headers for both the client and serverside
at this point?

I am pretty confused about these problems. Any input is appreciated.

sanjaya.


			
---------------------------------
Do you Yahoo!?
 Check out the new Yahoo! Front Page. www.yahoo.com
Mime
View raw message