第一次使用apache cfx发现自动生成的wsdl是SOAP 1.1版本的。
Google上说加@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)就可以,事实并非如此.
最后才发现cfx目前不支持自动生成soap1.2的wsdl,只能通过cfx的工具java2ws通过加参数-soap12去生成soap12的wsdl.
在spring的配置文件中使用wsdlLocation去设置手动生成的wsdl文件。wsdlLocation支持WEB-INF或classpath:方式配置。
visual studio 中使用 soap1.1 的方法 修改配置文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceHelloPortBinding" />
<binding name="dogSoapBinding" />
<binding name="UserServiceSoapBinding" />
</basicHttpBinding>
<customBinding>
<binding name="UserServiceImplPort">
<textMessageEncoding messageVersion="Soap11" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:9002/Service/ServiceHello"
binding="basicHttpBinding" bindingConfiguration="ServiceHelloPortBinding"
contract="ServiceReference1.ServiceHello" name="ServiceHelloPort" />
<endpoint address="http://localhost:8080/ng/services/dog" binding="basicHttpBinding"
bindingConfiguration="dogSoapBinding" contract="ServiceReference2.dog"
name="dog" />
<endpoint address="http://127.0.0.1/soap/user" binding="basicHttpBinding"
bindingConfiguration="UserServiceSoapBinding" contract="ServiceReference3.UserService"
name="UserServiceImplPort" />
</client>
</system.serviceModel>
</configuration>