Thanks,
 
but how can I do that ? A litte example which shows what extra steps are necessary would be helpful.
 
Regards
 
Sven
 
 
 
-----Urspr�ngliche Nachricht-----
Von: Oliver Adler [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 10. Februar 2003 12:29
An: [EMAIL PROTECTED]
Betreff: AW: sessions and client config

Hi,

the simple session handler adds the session  id  only if there exists the right property in MessageContext. If this property doesn't exists the session header will not be craeted.

 

 

Hi,

I fiddled around with session management in Axis for a few days now and I
encountered some problems, mainly related to the client configuration.
The following explanation is quite long but I think necessary to get the
whole background.

OK

First I tested the example test.session.TestSimpleSession and it worked
fine.

Then I tried to make my service session enabled, adding a method that works
more or less similar to the one in the example (just for testing purposes).
The server part is generated with the Java2WSDL and WSDL2Java tools and I
added the SimpleSessionHandler to the server .wsdd like that

...
<handler name="SimpleSessionHandler"
type="java:org.apache.axis.handlers.SimpleSessionHandler"></handler>
        <!-- Services from FMConnectorService WSDL service -->
        <service name="FMConnector" provider="java:RPC">
                <requestFlow>
                <handler type="SimpleSessionHandler"/>
                        <handler type="soapmonitor"/>
        </requestFlow>
        <responseFlow>
                <handler type="SimpleSessionHandler"/>
                        <handler type="soapmonitor"/>
        </responseFlow> 
...

Session management on the server seems to work because I see (in the
SOAPMonitor) a response with session ID

        <?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="http://xml.apache.org/axis/session">6254954670844961902</ns1:sess
ionID>
         </soapenv:Header>
         <soapenv:Body>
          <ns2:commitReceiptResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="FMConnector">
           <commitReceiptReturn
xsi:type="xsd:string">org.apache.axis.session.SimpleSession@87e704
1</commitReceiptReturn>
          </ns2:commitReceiptResponse>
         </soapenv:Body>
        </soapenv:Envelope>

My client app is simple and again a modification of the
SimpleSessionHandler.

        import org.apache.axis.client.Service;
        import org.apache.axis.client.Call;
        import org.apache.axis.configuration.XMLStringProvider;


        public class TestClient {
           
             static final String clientWSDD =
                    "<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\"
" +
       
"xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">\n" +
                    " <handler
type=\"java:org.apache.axis.handlers.SimpleSessionHandler\" " +
                              "name=\"SimpleSessionHandler\"/>\n" +
                    "<globalConfiguration>\n" +          
                    "  <requestFlow><handler
type=\"SimpleSessionHandler\"/></requestFlow>\n" +
                    "  <responseFlow><handler
type=\"SimpleSessionHandler\"/></responseFlow>\n" +
                    "</globalConfiguration>\n" +
                        " <transport name=\"http\" " +
       
"pivot=\"java:org.apache.axis.transport.http.HTTPSender\"/>\n" +
                    "</deployment>";
            
             
            static XMLStringProvider clientProvider = new
XMLStringProvider(clientWSDD);
           
            public static void main(String[] args) {
               
                try {
                    String FMConnector_address =
"http://localhost:8080/axis/services/FMConnector";   
                    Service svc = new Service(clientProvider);
                    svc.setMaintainSession(true);

                    Call call = (Call)svc.createCall();
                    call.setTargetEndpointAddress(new
java.net.URL(FMConnector_address));
                   
                    System.out.println(call.invoke("FMConnector",
"commitReceipt", null));
                    System.out.println(call.invoke("FMConnector",
"commitReceipt", null));

                    System.out.println(call.invoke("FMConnector",
"commitReceipt", null));
                    System.out.println(call.invoke("FMConnector",
"commitReceipt", null));
                } catch (Exception e) {
                    e.printStackTrace();
                }
               
            }
        }

I'm just calling the service method four times. That works but there is no
session ID in the request (!?)

        <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
         <SOAP-ENV:Body>
          <ns1:commitReceipt xmlns:ns1="FMConnector"/>
         </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>

So what's wrong ?

A few words to the wsdd in the client app. I used that bit in the originally
example and it works fine.
I tried also variations with <requestFlow> and <responseFlow> inside the
<transport> tag.


Another question:
How can I set e.g. the timeout for the SessionHandler ? Is there a way to
put it in server wsdd ?
As I mentioned before, the server bits are generated. In which part can I
put handler related stuff like changing the timeout programmatically (in the
skeleton ?).

Thanks


Sven

-----Urspr�ngliche Nachricht-----
Von: Sven Dilsen [mailto:[EMAIL PROTECTED]]
Gesendet: Mo 10.02.2003 11.51 Uhr
An: '[EMAIL PROTECTED]'
Cc:
Betreff: sessions and client config

 

Reply via email to