Reputation: 470
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.
Upvotes: 5
Views: 15046
Reputation: 1267
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:
text/xml
application/soap+xml
When the response is marked as HTML, it's either one of the following issues:
SOAPFault
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:
Upvotes: 5
Reputation: 470
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.
Upvotes: 6