Web services 公开一个既支持SOAP1.1又支持;SOAP 1.2客户端
目前,我正在使用注释来指定绑定类型,具体地说,我的web服务应该使用SOAP 1.2,但我想修改我的web服务以同时接受SOAP 1.1和SOAP 1.2请求 如果有办法的话,你能帮忙吗Web services 公开一个既支持SOAP1.1又支持;SOAP 1.2客户端,web-services,soap,cxf,jax-ws,ws-security,Web Services,Soap,Cxf,Jax Ws,Ws Security,目前,我正在使用注释来指定绑定类型,具体地说,我的web服务应该使用SOAP 1.2,但我想修改我的web服务以同时接受SOAP 1.1和SOAP 1.2请求 如果有办法的话,你能帮忙吗 @WebService public interface ExternalService { @WebMethod public WebTx getTxByTxRefNum(@WebParam(name="txRefNumber") String txRefNumber,
@WebService
public interface ExternalService {
@WebMethod
public WebTx getTxByTxRefNum(@WebParam(name="txRefNumber") String txRefNumber,
@WebParam(name="applicationName") String applicationName);
}
@WebService(endpointInterface = "com.abc.cde.service.ExternalService", serviceName ="ExternalService")
@BindingType(value = SOAP12HTTP_BINDING)
@WSDLDocumentation(value="ABC SOAP 1.2 Services for External Applications", placement = WSDLDocumentation.Placement.TOP)
public class ExternalServiceImpl implements ExternalService {
@Autowired
private TxService txService = null;
public WebTx getTxByTxRefNum(String txRefNumber, String applicationName) {
try {
---
---
Tx tx = this.txService.getTransactionByTxRefNum(txRefNumber, applicationName);
} catch(RuntimeException runtimeException) {
---
----
---
}
}
}
<bean id="externalService" class="com.abc.cde.service.ExternalServiceImpl"/>
<jaxws:endpoint id="ExternalService" implementor="#externalService" address="/ExternalService">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken" />
<entry key="passwordType" value="PasswordText" />
<entry key="passwordCallbackRef">
<ref bean="serverPasswordCallback" />
</entry>
</map>
</constructor-arg>
</bean>
<!-- <ref bean="logInbound" />
<ref bean="logOutbound" /> -->
</jaxws:inInterceptors>
</jaxws:endpoint>
@WebService
公共接口外部服务{
@网络方法
public WebTx gettxbytrefnum(@webgram(name=“txrefernumber”)字符串txrefernumber,
@WebParam(name=“applicationName”)字符串applicationName);
}
@WebService(endpointInterface=“com.abc.cde.service.ExternalService”,serviceName=“ExternalService”)
@BindingType(值=SOAP12HTTP\U绑定)
@WSDLDocumentation(value=“ABC SOAP 1.2外部应用程序服务”,placement=WSDLDocumentation.placement.TOP)
公共类ExternalServiceImpl实现ExternalService{
@自动连线
私有TxService TxService=null;
public WebTx gettxbytrefnum(字符串txrefernumber,字符串applicationName){
试一试{
---
---
Tx Tx=this.txService.getTransactionByTxRefNum(txRefNumber,applicationName);
}捕获(RuntimeException RuntimeException){
---
----
---
}
}
}
在CXF中,它是自动的。通过SOAP 1.2公开的端点也将处理1.1请求,并将自动响应1.1响应。我也这么认为。但它不起作用。若我删除@BindingType(value=SOAP12HTTP_BINDING),该服务可以处理SOAP1.1请求,但不能处理SOAP1.2请求。