客户端和服务器之间不匹配-肥皂 [英] Mismatch between between client and server - Soap
问题描述
服务器在Content-Type上运行:Text/xml(soap 1.1),而客户端尝试使用application/soap + xml(soap 1.2)进行通信.这是在http错误之后引发的
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?
该Web服务是部署在weblogic服务器配置上的jax-ws web服务.我们希望通过更改客户端代码来解决此问题.
The webservice is jax-ws webservice deployed on weblogic server configuration. We would like the issue to be resolved with changing the client code.
我们如何确保服务器肥皂同时接受1.1和1.2请求
How can we make sure the server soap accepts both 1.1 and 1.2 request
推荐答案
从weblogic 9.2开始(甚至可能在此之前),Soap 1.1均已发布.和Soap 1.2被支持.您可以在 Oracle Docs
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
由于默认为1.1,您最终将不得不更改应用程序本身以支持1.2.具体来说,可以通过更改weblogic.jws.Binding
像这样:
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) {
...
}
}
关于如何同时支持这两种方法,还有一些其他好的示例,您可能必须两次实现方法并更改WSDL才能列出两种实现.请将其视为良好的来源:
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
这篇关于客户端和服务器之间不匹配-肥皂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!