axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ripcord <robbie.kenn...@yahoo.ie>
Subject SOAPFaultException when using webservice with extra header cookie
Date Wed, 10 Sep 2008 14:59:01 GMT

Hi All,

I'm using an axis web service - with client java stubs that were generated
from a WSDL file. It has two methods - "HelloWorld" and "HelloSayFirstName".
I'm setting up the service and port as follows:

QName serviceName = new QName("http://tempuri.org/", "MyService");
QName portName = new QName("http://tempuri.org/",
"BasicHttpBinding_IMyService");
String endpointAddress =
"http://example/WebServices/WCFService/Service.svc";

Service service = Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
IMyService servicePort = (IMyService)service.getPort(portName,
IMyService.class);

This works fine, and I am able to call the two methods:
servicePort.helloSayFirstName()
servicePort.helloWorld()

However, I need to send a http header cookie - so I use the following:
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);
java.util.Map<String, Object> requestContext =
((javax.xml.ws.BindingProvider) servicePort).getRequestContext();
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);

This works when the first method is called, but when the second method is
called I get the following SOAPFaultException.
Would anyone have any ideas on this? Thanks

Caused by: org.apache.cxf.binding.soap.SoapFault: OperationFormatter
encountered an invalid Message body. Expected to find node type 'Element'
with name 'HelloSayFirstName' and namespace 'http://tempuri.org/'. Found
node type 'Element' with name 'HelloWorld' and namespace
'http://tempuri.org/'
	at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:70)
	at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:1)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:90)
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:179)
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:1)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:402)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1948)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
	at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)



-- 
View this message in context: http://www.nabble.com/SOAPFaultException-when-using-webservice-with-extra-header-cookie-tp19414796p19414796.html
Sent from the Axis - User mailing list archive at Nabble.com.


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


Mime
View raw message