Mismatch between between client and server - Soap

南楼画角 提交于 2020-01-05 12:28:13

问题


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:


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



来源:https://stackoverflow.com/questions/24938472/mismatch-between-between-client-and-server-soap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!