I made a wsdl using sun-jaxws. I created a web service client in Netbeans, and successfully called the wsdl web service. Then I configured my nginx server to access the web service by https. When I call the service over https I get the following error: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK
My wsdl is available by address https://somesite.com/mywsdl/?wsdl. Inside the wsdl I see such service location:
<service name="GenericService">
<port name="GenericServicePort" binding="tns:GenericServicePortBinding">
<soap:address location="https://somesite.com:443/mywsdl"/>
</port>
</service>
I don't know whether the problem is in my nginx configuration, or in my jaxws.
-
You kinda wish the error msg would be more meaningful. Thanks for contributing your solutionDavid Brossard– David Brossard2017年01月10日 22:19:18 +00:00Commented Jan 10, 2017 at 22:19
-
@DavidBrossard i have added some more background information on this error and the possible debugging options that are availableslindenau– slindenau2022年08月09日 11:04:11 +00:00Commented Aug 9, 2022 at 11:04
2 Answers 2
The problem was in the extra slash in my url. I changed url from https://somesite.com/mywsdl/?wsdl to https://somesite.com/mywsdl?wsdl and the problem disappeared.
Comments
You usually get the ClientTransportException: The server sent HTTP status code 200: OK when the SOAP server, that your client connects to, sends a response with content-type text/html.
We can see that in the following code: com.sun.xml.ws.transport.http.client.HttpTransportPipe (from jaxws-rt, or the same class from the internal JRE package com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe)
if (contentType != null && contentType.contains("text/html") && binding instanceof SOAPBinding) {
throw new ClientTransportException(ClientMessages.localizableHTTP_STATUS_CODE(con.statusCode, con.statusMessage));
}
Normally when you receive an answer from a SOAP server, you should get the following content types as a response:
- SOAP v1.1 uses content-type
text/xml - SOAP v1.2 uses content-type
application/soap+xml
When the response is marked as HTML, it's either one of the following issues:
- your request is made to the wrong endpoint, and you are presented with some HTML status page (for example SOAPUI also does this on unknown mock endpoints)
- your request is invalid for the given endpoint, and the server doesn't send a proper
SOAPFault - your request is valid, but the server is having issues processing it (for example HTTP4xx or HTTP5xx not found/error pages as HTML. But these usually don't have code 200 OK), and doesn't or can't send a proper
SOAPFault
In any case if you're trying to debug this, your first step should be to enable the following vmoptions on your SOAP client:
-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=TRUE
-Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=TRUE
-Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=TRUE
-Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dump=TRUE
-Dcom.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold=999999
These will dump/log the entire HTTP request + response (headers and body). With this you can analyze where the error exactly is, based on the endpoint and the (possible) HTML page body. Possibly HTML, because it can also very well be a normal SOAPFault XML with just the wrong content-type header (if the server is not implemented correctly).
For more information on SOAP issues like this you can also read the following questions:
Comments
Explore related questions
See similar questions with these tags.