【服务端处理】
我发布的 wsdl 中 soapAction 中为空的, 导致我调用失败, 所以我想手动制定 soapAction 的路径, 但是怎么添加在wsdl 中都没有添加进去,附上部分wsdl 代码
接口java 代码:
services.xml 代码:
我发布的 wsdl 中 soapAction 中为空的, 导致我调用失败, 所以我想手动制定 soapAction 的路径, 但是怎么添加在wsdl 中都没有添加进去,附上部分wsdl 代码
<wsdl:binding name="CalculatorServiceHttpBinding" type="tns:CalculatorServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="multiply">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="multiplyRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="multiplyResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="divide">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="divideRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="divideResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="add">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
接口java 代码:
public interface CalculatorService {
@WebMethod(operationName = "add" ,action = "urn:add")
public int add(int a, int b);
@WebMethod(operationName = "multiply" ,action = "urn:multiply")
public int multiply(int a, int b);
@WebMethod(operationName = "divide" , action = "urn:divide")
public int divide(int a, int b);
}
services.xml 代码:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service >
<name>CalculatorService</name>
<serviceClass>com.test.service.CalculatorService</serviceClass>
<implementationClass>com.test.service.impl.CalculatorServiceImpl</implementationClass>
<properties name="method">
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="add" />
<property name="soapAction" value="urn:add" />
</bean>
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="multiply" />
<property name="soapAction" value="urn:multiply" />
</bean>
<bean class="org.codehaus.xfire.spring.config.MethodBean">
<property name="name" value="divide" />
<property name="soapAction" value="urn:divide" />
</bean>
</properties>
</service>
</beans>