axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Flo Hum" <flo...@gmail.com>
Subject session management - soap header error
Date Tue, 06 Nov 2007 20:57:58 GMT
First I'm a total noob to all of this architecture, so I apologize for
my ignorance up front. Apache2, Tomcat 5.0, Axis2 v1.3, SOAP, web
communication protocols in general (even the Jbuilder IDE I have to
use) is new for me, so it's been a struggle every step of the way.
I've been able to create a web service and test with client code okay.
But when I tried to introduce the session management options, my test
client code fails. I was following an article I found
http://www.developer.com/java/web/print.php/3620661 as my guide.
Hopefully you can help, I must be missing something.

Here are the steps I've done to try to add the session management:

**  Made change in services.xml to include soapsession. (tried
transportsession as well - but with the same resulting error)
<service name="foo" scope="soapsession"> </service>

**  included method init(), destroy() and a method for getting
ServiceContext in service class.

**  in the test Client code I added
options.setManageSession(true);
serviceClient.engageModule("addressing");
for the org.apache.axis2.client.Options  and
for the org.apache.axis2.rpc.client.RPCServiceClient

**  when i run the test client I get
org.apache.axis2.AxisFault: The server failed to process the
WS-Addressing header: wsa:Action [Reason]: A header representing a
Message Addressing Property is not valid and the message cannot be
processed

**  so it seems as though the client code is not generating a proper
message.  I really don't know much about how the header should look
though, and how to alter it anyway since it is being generated for me.


**  here is the soap header I can view using TCP/IP monitor

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <soapenv:Header>
        <wsa:To>http://localhost:9081/axis2/services/MyService</wsa:To>
        <wsa:MessageID>urn:uuid:D692F6BBD04218BBF81192458486207</wsa:MessageID>
        <wsa:Action>urn:anonOutInOpResponse</wsa:Action>
    </soapenv:Header>
    <soapenv:Body>
        <doLogin xmlns="http://polygon.dfo.gc.ca"> <arg0
xmlns="">testUsername</arg0>
        <arg1 xmlns="">testPassword</arg1>
        </doLogin>
    </soapenv:Body>
</soapenv:Envelope>


**  here is the client code used:

    serviceClient = new RPCServiceClient();
    serviceClient.engageModule("addressing");
    Options options = serviceClient.getOptions();
    options.setManageSession(true);//for session management
    EndpointReference targetEPR = new
EndpointReference("http://localhost:9081/axis2/services/MyService");
    options.setTo(targetEPR);
    QName opLogin = new QName("http://polygon.dfo.gc.ca", "doLogin");
    String strUsername = "testUsername";
    String strPswd = "testPassword";
    Object[] opLoginArgs = new Object[] { strUsername, strPswd };
    Class[] returnTypes = new Class[] { String.class };
    Object[] response =
serviceClient.invokeBlocking(opLogin,opLoginArgs, returnTypes);
    Object result = (Object)response[0];
    String str = result.toString();
    System.out.println("runTestUpdate Login: " + str);
    // just for some info
    MessageContext msgCtx = MessageContext.getCurrentMessageContext();
    if(msgCtx != null){
    System.out.println("msgCtx.getServiceGroupContextId() :  " +
        msgCtx.getServiceGroupContextId());
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message