81,092
社区成员
发帖
与我相关
我的任务
分享
<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>
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);
}
<?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>
package com.ws.test;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(name = "testsoapaction", serviceName = "hahah", targetNamespace = "http://xxoo.com")
public class SoapServiceImpl {
@WebMethod(action = "urn:Test", operationName = "test")
public String example(String message) {
return message;
}
}
service.xml这样写:
<beans>
<service xmlns="http://xfire.codehaus.org/config/1.0">
<name>HelloService</name>
<serviceClass>com.ws.test.SoapServiceImpl</serviceClass>
<serviceFactory>org.codehaus.xfire.annotations.AnnotationServiceFactory</serviceFactory>
</service>
</beans>
上面的serviceFactory必须写。