在用cxf 做webservice客户端的时候碰到的:
javax.xml.ws.soap.SOAPFaultException: A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.
在网上上找了一些资料但是还是不能解决我的问题,但是还是要感谢下, 不然太不厚道了
- if (soapVersion == Soap12.getInstance()
- && version == Soap11.getInstance()) {
- throw new SoapFault(new Message("INVALID_11_VERSION", LOG, ns, xmlReader.getLocalName()),
- Soap11.getInstance().getVersionMismatch());
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://cxf.apache.org/jaxws
- http://cxf.apache.org/schemas/jaxws.xsd">
- <bean id="jaxWsProxyFatory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
- <property name="bindingId" value="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
- <property name="serviceClass" value="net.carefx.cds.v1.services.core.CdsCoreServices" />
- <property name="address" value="http://localhost:8181/cxf/coreServices" />
- </bean>
- <bean id="soapSerivces" class="net.carefx.cds.testtool.proxy.SoapServices">
- <property name="factory" ref="jaxWsProxyFatory" />
- </bean>
- </beans>
- <span style="font-weight: normal;">
- public class SoapServices
- {
- private static final Logger logger = new Logger (SoapServices.class.getName ());
- private JaxWsProxyFactoryBean m_factory;
- private CdsCoreServices cdsCoreServices;
- public JaxWsProxyFactoryBean getFactory ()
- {
- return m_factory;
- }
- public void setFactory (JaxWsProxyFactoryBean factory)
- {
- m_factory = factory;
- }
- public CdsCoreServices getCdsCoreServices ()
- {
- if (cdsCoreServices == null)
- {
- cdsCoreServices = (CdsCoreServices) m_factory.create ();
- }
- return cdsCoreServices;
- }
- }</span>
C# java JAX-WS 问题
webservices 是java写的,用 JDK自带的EndPoint发布,客户端是用C#调用,
在服务器端抛出异常,尽管执行是正常的。
Unsupported Content-Type: application/soap+xml;charset=UTF-8 Supported ones are: [text/xml]
请问这是什么问题? 怎么解决呢? Google 了半天也没找到答案
----------------------
经试验,是C#生成客户端的过程中抛出的,用wsimport 没问题。 是soap版本的问题?
这个问题是解决了, 确实版本问题, jdk6默认是soap1.1
增加 @BindingType("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/")
高亮的地址真是难找,SOAPBinding 里面定义的是 http://www.w3.org/2003/05/soap/bindings/HTTP/, 但不能用,提示找不到
communication, my WSDL and here is also my sun-jaxws.xml:
<?xml
version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns=" http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint
name="FormDataService"
implementation="de.bolsys.netcon.gatewaydb.wsdl.DefaultFormDataService"
wsdl="WEB-INF/wsdl/netgateway.wsdl"
binding=" http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"
url-pattern="/FormDataService"
enable-mtom="true"/>
</endpoints>
My service annotations:
@WebService(name =
"formDataPortType", targetNamespace = " http://bolsys.de/netcon/gatewaydb/wsdl")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING)
@XmlSeeAlso({
ObjectFactory.class
})
My client
annotations:
@WebServiceClient(name = "FormDataService", targetNamespace =
" http://bolsys.de/netcon/gatewaydb/wsdl")
Did I
forget anything?
[Message sent by forum member 'radovana' (radovana)]
It
is because your wsdl using soap11 binding, you can either change the binding to
soap12
like this " xmlns:soapbind=" http://schemas.xmlsoap.org/wsdl/soap12/"
or simply
remove binding=" http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"
from your deploy descriptor