How to avoid "505: HTTP Version not supported" error?

15,785

Solution 1

In the meantime I got my answer in the Bing developer forum. It seems as if Microsoft is sort of using different semantics for HTTP response codes than most and a 505 can also mean "Something is wrong with your SOAP request". Turns out I did not use the correct namespaces. After fixing them, the request went through just fine.

Here is the link to the thread in the Bing forum.

Solution 2

Have you tried adding the following to app.config or web.config?

<configuration>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
</configuration>

Obviously sending the Expect: 100-continue in request header causes the “505: HTTP Version not supported” error to be thrown.

Expect 100-continue

Share:
15,785
moxn
Author by

moxn

Move along, nothing to see here.

Updated on June 06, 2022

Comments

  • moxn
    moxn about 2 years

    I am trying to use the Bing SOAP API for a simple search request. But now that I finally figured out how to send the request using JAX-WS, I am stuck again. I get the reply com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 505: HTTP Version not supported when I send the request. Can anyone help me out?

    I am using dynamic invocation with JAX-WS 2.0, if that makes any difference.

    Dispatch<SOAPMessage> dispatch = service.createDispatch(
        portName, SOAPMessage.class, Service.Mode.MESSAGE);
    MessageFactory messageFactory = ((SOAPBinding) dispatch.getBinding())
        .getMessageFactory();
    SOAPMessage request = messageFactory.createMessage();
    // Add content to the request
    SOAPMessage response = dispatch.invoke(request);
    

    Wireshark tells me, that the request header contains POST /soap.asmx HTTP/1.1 and the reply comes back also with an HTTP/1.1 versioning. Doesn't this mean, it's alright?

    Thanks, moxn

    UPDATE: It's not a JAX-WS specific error. I implemented the communication via Commons HTTPClient and still get the same 505.

    Following the headers from the HTTPClient request:

    Content-Length: 435
    Content-Type: text/xml
    Host: api.bing.net:80
    Connection: Keep-Alive
    User-Agent: Apache-HttpClient/4.0.1 (java 1.5)
    Expect: 100-Continue
    

    UPDATE: It also doesn't work with HTTP/1.0 btw...