5

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.

slindenau
1,2772 gold badges14 silver badges20 bronze badges
asked Dec 11, 2015 at 12:06
2
  • You kinda wish the error msg would be more meaningful. Thanks for contributing your solution Commented Jan 10, 2017 at 22:19
  • @DavidBrossard i have added some more background information on this error and the possible debugging options that are available Commented Aug 9, 2022 at 11:04

2 Answers 2

6

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.

answered Dec 13, 2015 at 9:07
Sign up to request clarification or add additional context in comments.

Comments

5

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:

answered Aug 9, 2022 at 10:51

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.