java - How do I get the RAW message with a jax-ws client? -
i trying raw xml response web service instead of parsed soap version.
i using jax-ws client has been generated org.apache.cxf.tools.wsdlto.wsdltojava. issue webservice returns html error , soap parsing fails , following in logs:
response of unexpected text/html contenttype. incoming portion of html stream: system.argumentexception: chunked encoding must set via sen dchunked property. parameter name: value @ system.net.httpwebrequest.set_transferencoding(string value) @ multiversionrouter.routers.baserequestrouter.routerequest(httpcontext app, asynccallback callback, webresponse& errorresponse) @ multiversionrouter.routeproviderhandler.beginrequest(object sender, eventargs e, asynccallback callback, object state) 2015-07-02 08:58:51,054 [thread-63063 ] javax.xml.ws.soap.soapfaultexception: response of unexpected text/html contenttype. incoming portion of html stream: system.argumentexception: chunked encoding must set via sendchunked property. parameter name: value @ system.net.httpwebrequest.set_transferencoding(string value) @ multiversionrouter.routers.baserequestrouter.routerequest(httpcontext app, asynccallback callback, webresponse& errorresponse) @ multiversionrouter.routeproviderhandler.beginrequest(object sender, eventargs e, asynccallback callback, object state) @ org.apache.cxf.jaxws.jaxwsclientproxy.invoke(jaxwsclientproxy.java:157) @ com.sun.proxy.$proxy85.updateserviceticketviamanagedid(unknown source) @ com.nable.libpsa.connectwiseproxy.updateticket(connectwiseproxy.java:538) @ com.nable.libpsa.connectwiseproxy.run(connectwiseproxy.java:1591) @ java.lang.thread.run(thread.java:745) caused by: org.apache.cxf.interceptor.fault: response of unexpected text/html contenttype. incoming portion of html stream: system.argumentexception: chunked encoding must set via sendchunked property. parameter name: value @ system.net.httpwebrequest.set_transferencoding(string value) @ multiversionrouter.routers.baserequestrouter.routerequest(httpcontext app, asynccallback callback, webresponse& errorresponse) @ multiversionrouter.routeproviderhandler.beginrequest(object sender, eventargs e, asynccallback callback, object state) @ org.apache.cxf.interceptor.staxininterceptor.handlemessage(staxininterceptor.java:84) @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:272) @ org.apache.cxf.endpoint.clientimpl.onmessage(clientimpl.java:835) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponseinternal(httpconduit.java:1614) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponse(httpconduit.java:1504) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.close(httpconduit.java:1310) @ org.apache.cxf.transport.abstractconduit.close(abstractconduit.java:56) @ org.apache.cxf.transport.http.httpconduit.close(httpconduit.java:628) @ org.apache.cxf.interceptor.messagesenderinterceptor$messagesenderendinginterceptor.handlemessage(messagesenderinterceptor.java:62) @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:272) @ org.apache.cxf.endpoint.clientimpl.doinvoke(clientimpl.java:565) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:474) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:377) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:330) @ org.apache.cxf.frontend.clientproxy.invokesync(clientproxy.java:96) @ org.apache.cxf.jaxws.jaxwsclientproxy.invoke(jaxwsclientproxy.java:135) ... 4 more
i have tried using javax.xml.ws.handler.soap.soaphandler never gets point when error, works fine on successful calls.
please use:
javax.xml.ws.handler.soap.soaphandler
you can message using soapmessagecontext, method getmessage() , convert message string.
sample code:
public static string getxmlmessage(soapmessage message) throws exception { bytearrayoutputstream os = new bytearrayoutputstream(); message.writeto(os); final string encoding = (string) message.getproperty(soapmessage.character_set_encoding); if (encoding == null) { return new string(os.tobytearray()); } else { return new string(os.tobytearray(), encoding); } }
Comments
Post a Comment