有没有一种方法可以使SOAP 1.1 Java实现中的SOAP操作成为可选操作?

时间:2018-11-05 21:24:43

标签: java web-services soap

我们目前拥有一整套SOAP 1.1服务实现,它们不关心是否提供SOAP操作。他们将很乐意执行一个空的SOAP操作,并且仍然可以正常工作,以某种方式将调用链接到正确的方法。

我们还有一个新的SOAP 1.1服务实现,如果没有SOAP操作,它将绝对无法运行。

问题是,大多数客户端都是懒惰的,并且不提供SOAP操作,尽管我想请他们这样做,但目前尚不可行。

我一生无法确定哪个配置项允许现有服务允许空SOAP动作。有谁知道如何在SOAP 1.1服务上禁用SOAP操作验证?

我们的容器实现是WAS 8.5.5.13,并且在重要的情况下我们正在运行Java 1.8。

谢谢, 彼得

1 个答案:

答案 0 :(得分:0)

You can use this Java library that enables handling SOAP on a purely XML level.

Supports the following:

  1. Supports WSDL 1.1
  2. Supports SOAP 1.1 and 1.2
  3. Supports all four WS flavors: rpc-encoded, rpc-literal, document-literal and document-encoded
  4. Supports SSL and basic-authentication
  5. Supports SOCKS, HTTP and HTTPS proxies
  6. Supports SpringFramework
  7. Supports JUnit, Spock and Arquillian

Then, you can send a SOAP envelope (as a String) invoking the post() method:

 client.post(soapAction, envelope);

You can also skip the SOAPAction header and send the envelope only:

 client.post(envelope);

Otherwise, the default implementation forces SOAPAction field.

From SOAP 1.1 documentation:

The SOAPAction HTTP request header field can be used to indicate the intent of the SOAP HTTP request. The value is a URI identifying the intent. SOAP places no restrictions on the format or specificity of the URI or that it is resolvable. An HTTP client MUST use this header field when issuing a SOAP HTTP Request.

soapaction = "SOAPAction" ":" [ <"> URI-reference <"> ] URI-reference =

The presence and content of the SOAPAction header field can be used by servers such as firewalls to appropriately filter SOAP request messages in HTTP. The header field value of empty string ("") means that the intent of the SOAP message is provided by the HTTP Request-URI. No value means that there is no indication of the intent of the message.

Examples:

SOAPAction: "http://electrocommerce.org/abc#MyMessage"
SOAPAction: "myapp.sdl"
SOAPAction: ""
SOAPAction: