My hunch is that there is some authentication problem with your SOAP client
at the app server level, which causes the app server to return a text or
html error response.  What you can do is run Wireshark[1] while making the
SOAP call to find out precisely what the error message is--providing the
returned error message is not encrypted, which I don't think it would be. 
Fixing the underlying problem will fix this issue.

The reason why it would possibly work with SOAP UI but not your SOAP client
is that you configure security differently between the two, and your web
service provider doesn't have a problem with the former's configuration.

Only problem is unfortunately that the incoming stream shown below has an
empty error message--so you might also get that with Wireshark (hopefully
not).

Glen

[1] http://www.jroller.com/gmazza/entry/wireshark_usage_for_cxf


antoine_ wrote:
> 
> Hi,
> I have a SOAP web service and both the server and the client are created 
> with CXF.
> We managed to have the client and the server, but very often, we have an 
> error in which the client complains that the content type of the 
> response if of type text/html:
> 
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: 
> Response was of unexpected text/html ContentType.  Incoming portion of 
> HTML stream: (none)
> 
> I used soapUI to send a request manually, and using it, the return type 
> is of type text/xml:
> 
> HTTP/1.1 500 Internal Server Error
> Date: Thu, 04 Mar 2010 08:54:22 GMT
> Content-Type: text/xml; charset=utf-8
> Content-Length: 383
> Server: Jetty(6.1.14)
>  
> <soap:Envelope 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Forwarding
>  
> was not done</faultstring><detail><fault 
> xmlns:ns2="http://nvconnect.netvitesse.com/2010/02/25/DeviceControl/"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:nil="true" 
> /></detail></soap:Fault></soap:Body></soap:Envelope>
> 
> It is a SOAP fault, but this is expected.
> 
> Do you have any idea why this may happen?
> 
> As we use HTTPS, here is how we set up the client (my service is named 
> DeviceControl):
> 
>             JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>             factory.setServiceClass(DeviceControl.class);
>             factory.setAddress(wsdlURL.toString());
>             port = (DeviceControl) factory.create();
>             Client client = (Client) ClientProxy.getClient(port);
>             HTTPConduit httpConduit = (HTTPConduit) 
> ((org.apache.cxf.endpoint.Client) client).getConduit();
>             TLSClientParameters tlsParams = new TLSClientParameters();
>             tlsParams.setSecureSocketProtocol("SSL");
>             tlsParams.setDisableCNCheck(true);
>             tlsParams.setKeyManagers(null);
>             tlsParams.setSecureRandom(null);
>             tlsParams.setTrustManagers(getAllTrustingTrustManager());
>             httpConduit.setTlsClientParameters(tlsParams);
> 
> The service is exposed using CXFServlet 
> (org.apache.cxf.transport.servlet.CXFServlet).
> And here is the full stack trace on client side:
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: 
> Response was of unexpected text/html ContentType.  Incoming portion of 
> HTML stream: (none)
>      [java]     at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
>      [java]     at $Proxy56.setForwarding(Unknown Source)
>      [java]     at 
> com.netvitesse.nvconnect._2010._02._25.devicecontrol.DeviceControl_DeviceControlSOAP_Client.main(Unknown
>  
> Source)
>      [java] Caused by: org.apache.cxf.interceptor.Fault: Response was of 
> unexpected text/html ContentType.  Incoming portion of HTML stream: (none)
>      [java]     at 
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:77)
>      [java]     at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>      [java]     at 
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:671)
>      [java]     at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2177)
>      [java]     at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2057)
>      [java]     at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1982)
>      [java]     at 
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>      [java]     at 
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:637)
>      [java]     at 
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>      [java]     at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>      [java]     at 
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
>      [java]     at 
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
>      [java]     at 
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
>      [java]     at 
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>      [java]     at 
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
>      [java]     ... 2 more
> 
> 
> 
> I am stucked on this issue, I do not know how I could dig it further. Do 
> you have any idea ?
> 
> Thanks !
> 
> 
> Antoine
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Client-complanings-about-return-type-being-text-html-tp27778336p27779913.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to