Mismatch between between client and server - Soap

2019-08-09 20:10发布

Server is running on Content-Type : Text/xml(soap 1.1) while client is trying to communicate using application/soap+xml(soap 1.2) . This is throwing following http error

HTTP/1.1 415 Unsupported Media Type 
Date: Thu, 24 Jul 2014 15:35:02 GMT 
Content-Length: 0 
X-Powered-By: Servlet/3.0 JSP/2.2

So is there any way to resolve this issue?

The webservice is jax-ws webservice deployed on weblogic server configuration. We would like the issue to be resolved with changing the client code.

How can we make sure the server soap accepts both 1.1 and 1.2 request

1条回答
Juvenile、少年°
2楼-- · 2019-08-09 20:51

Since weblogic 9.2 (and maybe even before) both Soap 1.1. and Soap 1.2 are supported. You can see the relevant documentation in the Oracle Docs

You will end up having to change your application itself to support 1.2 since 1.1 is the default. Specifically by changing the weblogic.jws.Binding like:

package examples.webservices.soap12;
...
import javax.jws.WebMethod;
import javax.jws.WebService;
import weblogic.jws.Binding;
@WebService(name="SOAP12PortType",
        serviceName="SOAP12Service",
        targetNamespace="http://example.org")
@Binding(Binding.Type.SOAP12)
public class SOAP12Impl {
  @WebMethod()
  public String sayHello(String message) {
  ...
 }
}

There are some other good examples out there on how to support both, you may have to implement methods twice and change your WSDL to have both implementations listed. See these as good sources:

http://blog.allanglen.com/2010/04/wcf-interoperability-with-soap-1-1-and-soap-1-2-clients

https://community.jboss.org/thread/158841

查看更多
登录 后发表回答