axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ripcord <robbie.kenn...@yahoo.ie>
Subject Set http cookie for generated web service
Date Tue, 19 Aug 2008 15:44:54 GMT

Hi all,

I have a question about AXIS and security handling. I need to set a cookie
in the request header, and I'm not sure how to do this. I have created a Web
Service, and automatically generated the WSDL file from this. The WSDL file
uses SOAP binding with the 'document' style. I then use an ANT all of the
WSDLtoJava class to generate the required java files. 

All examples I've seen on the web generate a Service and ServiceLocator. The
Service actually extends javax.xml.rpc.Stub, and the examples show that the
header can be set using the following code:
MyServiceLocator locator = new MyServiceLocator();
MyService serivce = locator.getMyService();
((javax.xml.rpc.Stub)service)._setProperty(
    "javax.xml.rpc.session.maintain"),
    Boolean.TRUE);
((javax.xml.rpc.Stub)service)._setProperty(
    HTTPConstants.HEADER_COOKIE,
    "JSESSIONID=" + sessionID);

However, I do not get a ServiceLocator generated, and the Service class I
get extends from 'javax.xml.ws.Stub' - therefore the cast above won't work.
The class 'javax.xml.ws.Stub' does not seem to support setting a request
header.

The code i'm trying is using the request context as follows:

        ss = new MyService(wsdlURL, new QName(nameSpaceURI, localPart));
        servicePort = ss.getMyServicePort();

        java.util.Map<String, Object> requestContext =
((javax.xml.ws.BindingProvider)servicePort)
            .getRequestContext();
        requestContext.put(
            org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE,
            "cookie_name=my_cookie");

But this is not setting the cookie.
Would anyone have any idea on how to set a cookie in the header using this
service? Or do I definitley have to use the SOAP rpc binding?

Thanks
-- 
View this message in context: http://www.nabble.com/Set-http-cookie-for-generated-web-service-tp19053107p19053107.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
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