SoFunction
Updated on 2025-03-04

Summary of problems encountered in calling JavaWebservice services in C#

1. A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.

Cause of the problem:

The SOAP protocol versions of the client and server are inconsistent.

Solution:

① Modify the client SOAP protocol version and the server
② Modify the server SOAP protocol version and the client

Attached is the method of exposing the SOAP version of Java server modification service:

Add annotations on the interface implementation class

//import ;
//import ;

@BindingType(SOAPBinding.SOAP12HTTP_BINDING) //1.2
@BindingType(SOAPBinding.SOAP11HTTP_BINDING) //1.1
 

2. MustUnderstand headers: [{http:///2005/08/addressing}Action, {http:///2005/08/addressing}To] are not understood

Cause of the problem:

When C# calls Java service, ws-addressing information is added when requesting, while CXF does not turn on the ws-addressing switch by default, the above warning will appear.

Solution:

①In the service exposure below, add the following nodes to support ws-addressing.

<jaxws:endpoint 
    implementor="#monitorConfigService" address="/javaMonitorConfigService">
    <jaxws:features>
      <wsa:addressing xmlns:wsa="/ws/addressing" />
    </jaxws:features>
  </jaxws:endpoint>