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 Flo Hum <fl...@gmail.com> on 2007/11/08 15:19:41 UTC
session management - soap header error
Sorry if this ends up actually being a cross-post, I initially sent to
axis-dev but realized that's the wrong forum - and I don't think it
went through anyway.
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());
}
My goal was just to be able to have my service allow the user to login
once, validate them, store their user_id, and then they could make
subsequent calls to the service, with the service already aware of
that user_id an that they are valid.
If I'm totally off track please let me know.
thanks so much
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org