cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ripcord <robbie.kenn...@yahoo.ie>
Subject Invalid SOAP action when using java ws WebService
Date Thu, 11 Sep 2008 10:23:24 GMT

Hi all,

this is a slightly more detailed error for a problem i posted recently. I am
connecting to a web service that was generated from WSDL. It has two methods
"HelloWorld" and "HelloSayFirstName". As defined in the WSDL, the methods
use the SOAP action document style. I want to add a cookie to the http
header, so after the port is created, I use the following to add the header
to the requestContext:

BindingProvider bindingProvider = (BindingProvider) servicePort;
Map<String, Object> requestContext = bindingProvider.getRequestContext();
List<String> cookies = new ArrayList<String>();
cookies.add("mycookie=mytoken");
HashMap<String, List<String>> httpHeaders = new HashMap<String,
List<String>>();
httpHeaders.put(HTTPConstants.HEADER_COOKIE, cookies);
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);

This works when I call the first method (HelloWorld) - the first activity
message sent to the server contains the following:

<HttpRequest>
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<Cache-Control>no-cache</Cache-Control>
<Connection>keep-alive</Connection>
<Pragma>no-cache</Pragma>
<Transfer-Encoding>chunked</Transfer-Encoding>
<Content-Type>text/xml; charset=UTF-8</Content-Type>
<Accept>*</Accept>
<Cookie>mycookie=mytoken</Cookie>
<Host>exampleHost</Host>
<User-Agent>Java/1.5.0_14</User-Agent>
<SOAPAction>"http://tempuri.org/IMyService/HelloWorld"</SOAPAction>
</WebHeaders>
</HttpRequest>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<To s:mustUnderstand="1"
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://exampleHost/WebServices/WCFService/Service.svc</To>
<Action s:mustUnderstand="1"
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IMyService/HelloWorld</Action>
</s:Header>
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/"
xmlns:ns2="http://schemas.datacontract.org/2004/07/"
xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
<myValue1>world</myValue1>
</HelloWorld>
</soap:Body>
</soap:Envelope>

However, after this method, the httpHeaders in the requestContext object
have been updated to include the "Accept" header and the "SOAPAction" header
- which is the incorrect action! Now, when I call the method
"HelloSayFirstName" I get the following:

<HttpRequest>
<Method>POST</Method>
<QueryString></QueryString>
<WebHeaders>
<Cache-Control>no-cache</Cache-Control>
<Connection>keep-alive</Connection>
<Pragma>no-cache</Pragma>
<Transfer-Encoding>chunked</Transfer-Encoding>
<Content-Type>text/xml; charset=UTF-8</Content-Type>
<Accept>*</Accept>
<Cookie>mycookie=mytoken</Cookie>
<Host>exampleHost</Host>
<User-Agent>Java/1.5.0_14</User-Agent>
<SOAPAction>"http://tempuri.org/IMyService/HelloWorld"</SOAPAction>
</WebHeaders>
</HttpRequest>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<To s:mustUnderstand="1"
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://exampleHost/WebServices/WCFService/Service.svc</To>
<Action s:mustUnderstand="1"
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IMyService/HelloWorld</Action>
</s:Header>
<soap:Body>
<HelloSayFirstName xmlns="http://tempuri.org/"
xmlns:ns2="http://schemas.datacontract.org/2004/07/"
xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
<dataContractValue></dataContractValue>
</HelloSayFirstName>
</soap:Body>
</soap:Envelope>

It seems that the SOAPAction in the http header and the soap header is
incorrect. Is there any reason why the requestContext would keep hold of the
action that was previously called, and not use the new action? I'm stumped
here - any help would be greatly appreciated.
Cheers. 
-- 
View this message in context: http://www.nabble.com/Invalid-SOAP-action-when-using-java-ws-WebService-tp19431785p19431785.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message