単純な検索要求に Bing SOAP API を使用しようとしています。しかし、ようやく JAX-WS を使用してリクエストを送信する方法を理解したので、また行き詰まりました。com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 505: HTTP Version not supported
リクエストを送ると返信
が来ます。誰でも私を助けることができますか?
違いがある場合は、JAX-WS 2.0 で動的呼び出しを使用しています。
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 は、リクエスト ヘッダーに含まれてPOST /soap.asmx HTTP/1.1
おり、応答も HTTP/1.1 バージョン管理で返されることを教えてくれます。これは大丈夫だということではないですか?
ありがとう、moxn
UPDATE : JAX-WS 固有のエラーではありません。Commons HTTPClient を介して通信を実装しましたが、同じ 505 が返されます。
HTTPClient リクエストのヘッダーに従います。
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
更新: HTTP/1.0 では動作しません...