SOAP Web服务仅适用于PHP?

时间:2016-03-03 18:41:02

标签: java php web-services soap wsdl

我正在使用SOAP Web服务,它应该与Java,PHP和许多技术一起使用。但是,它只适用于PHP。

我使用PHP中的SOAPClient类来实现客户端。当我打印请求和响应标题时,我得到了类似的结果:

REQUEST HEADERS:
POST /ws/something.php HTTP/1.1
Host: xxx.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.30
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://example.com/ws/something.php/someMethod"
Content-Length: 417
Authorization: Basic <username:password here>


RESPONSE HEADERS:
HTTP/1.1 200 OK
Date: Thu, 03 Mar 2016 18:03:48 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
Content-Length: 512049
Vary: Accept-Encoding,User-Agent
Content-Type: text/xml; charset=utf-8
Set-Cookie: BALANCEID=balancer.<someIP>; path=/; HTTPOnly; Secure
Keep-Alive: timeout=2, max=100
Connection: Keep-Alive

然后,我在Java中使用SAAJ来编写完全相同的请求,就像PHP一样。我甚至编辑了用户代理以使其准确,但我没有运气。响应始终是SOAP服务的wsdl。出于某种原因,如果我使用Java,Web服务不会执行任何操作。

这些是Java的请求标头:

Authorization   Basic <username:password here>
SOAPAction  http://example.com/ws/something.php/someMethod
POST /ws/something.php HTTP/1.1
Host     xxx.com
Connection  Keep-Alive
User-Agent  PHP-SOAP/5.5.30
Content-Type    text/xml; charset=utf-8
Content-Length  417

这是响应标题:

Date    Thu
Date    03 Mar 2016 18:24:35 GMT
Server  Apache
Strict-Transport-Security   max-age=63072000; includeSubdomains; preload
Accept-Ranges   none
Vary     Accept-Encoding
Vary     User-Agent
Content-Type     text/xml; charset=UTF-8
Set-Cookie  BALANCEID=balancer.<some IP>; path=/; HTTPOnly; Secure
Keep-Alive  timeout=2
Keep-Alive  max=100
Connection  Keep-Alive
Transfer-Encoding   chunked
Content-Length  8444
SOAPAction  ""

请注意响应标头是如何完全不同的。

我不知道为什么Web服务不会从Java执行完全相同的请求。它只返回wsdl。这是否意味着我的请求出了问题,或者网络服务是否只能用PHP soapClient神奇地工作?

0 个答案:

没有答案