You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Greg Day <Gr...@tec.govt.nz> on 2005/03/08 23:56:00 UTC
SimpleSessionHandler FINAL WORD?
Hi,
I had lots of issues with setting up sessions using the SimpleSessionHandler.
Finally, with lots of help from this list, I managed to get it going. I am using Axis1.2 RC3
The big problem seemed to be:
the org.apache.axis.utils.Admin client deploy.wsdd
produced a client-config.wsdd file like:
<?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 (abbreviated).../>
</globalConfiguration>
<handler name="session" type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
<service name="DocumentProcessorMessageInterface" provider="java:MSG" style="message" use="literal">
<requestFlow>
<handler type="session"/>
</requestFlow>
<responseFlow>
<handler type="session"/>
</responseFlow>
<parameter name="allowedMethods" value="processDocument"/>
<parameter name="className" value="...DocumentProcessorMessageInterfaceImpl"/>
</service>
<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>
which looks fine. However, nothing I did seemed to work. The client would not pick up the session id supplied from the server.
so, after lots of frustration, and reading a million posts, I changed the client-config.wsdd to be:
<?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="disablePrettyXML" value="true"/>
<parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
<parameter name="sendXsiTypes" value="true"/>
<parameter name="sendMultiRefs" value="true"/>
<parameter name="sendXMLDeclaration" value="true"/>
</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">
<requestFlow>
<handler type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
</requestFlow>
<responseFlow>
<handler type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
</responseFlow>
</transport>
<transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/>
</deployment>
And it worked! The client first sent a message without a session, the server created a session ID and sent it back in the header.
Interestingly, the client sent the session ID in the body, I'm not sure why.
<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>
<!-- my message stuff went here -->
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">6179074524436491775</multiRef>
</soapenv:Body>
</soapenv:Envelope>
On the client, the session appears to be associated with the Service object. So if you create a new Service object, you will get a new session.
In terms of location for the client-config.wsdd file, the docs and the list correctly state that it needs to be in the classpath for the client class. If running from a java test client, the switch
-Daxis.ClientConfigFile=c:\java_projects\axiswebservice\src\client-config.wsdd works.
Let me know if anyone needs more help, or a working example.
Cheers
Greg