/encoded and /literal support in JAX-WS/CXF

2019-06-07 17:08发布

问题:

I've never used RPC calls in java, so I'm a bit confused about some legacy code I will need to look into.

I hope you will help me clarify on how to use CXF with RPC, if at all possible.

1) CXF doesn't support rpc/encoded calls("Rpc/encoded wsdls are not supported in JAXWS 2.0" problem). Is rpc/literal fully supported by CXF, and specified in JAX-WS for that matter? It is mentioned here but unfortunately(why???) there's no explicit message that a combination of RPC + Encoded is not supported? Should I look deeper(into JSR 224)?

2) What about document/encoded? Is it fully supported by/specified in JAX-WS and its reference implementations(CXF at least)?

回答1:

In modern soap frameworks such as CXF or JAX-WS you can only use document/literal or rpc/literal.

You did good in investigating but maybe you should have focused your research more on WSDL and SOAP standards instead of jax-ws and cxf documentation.

The WS-I (Web Services-Interoperability) organization defines a set of rules to be followed when creating a web service so it will work well, independently of the programming language or technologies used to implement it. This standard is called Basic Profile (usually referred as WS-I BP) and is currently on version 2.0.

WS-I BP recommends not to use the 'encoded' style and use only 'literal'. And since we always want our web services to be BP compliant (to adhere to the Basic Profile), newer web services frameworks such as JAX-WS started dropping support for creating rpc/encoded and document/encodedweb services.

You should not spend too much time looking into the document/encoded combination because it was never really used by anyone since it's like saying you are going to use xml schema types for the messaging but you are not going to include any xml schema. That's why it's very likely that you will find no information about document/encoded anywhere.

Since rpc/encoded is a very old messaging style you should use a framework of the same era, such as Axis 1.4 and forget about CXF or JAX-WS because I think they never supported it.



标签: cxf jax-ws