8,909
社区成员




JaxWsProxyFactoryBean jaxFactory = new JaxWsProxyFactoryBean();
jaxFactory.setAddress("http://localhost:8081/test/test/TestSOAP?wsdl");
jaxFactory.setServiceClass(ITestService.class);
ITestService test = (ITestService)jaxFactory.create();
String returnxml = test.getXMLString("xml");
System.out.println("结果:"+returnxml);
@WebServicepublic
interface ITestService {
@WebMethod String
getXMLString(@WebParam(name = "xml")String xml);
}
<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://soap.test.jit.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" targetNamespace="http://soap.test.jit.com/" name="TestService"> -<wsdl:types> -<xs:schema xmlns:tns="http://soap.test.jit.com/" targetNamespace="http://soap.test.jit.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="unqualified"> <xs:element name="getXMLString" type="tns:getXMLString"/> <xs:element name="getXMLStringResponse" type="tns:getXMLStringResponse"/> -<xs:complexType name="getXMLString"> -<xs:sequence> <xs:element name="xml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> -<xs:complexType name="getXMLStringResponse"> -<xs:sequence> <xs:element name="returnxml" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> -<wsdl:message name="getXMLStringResponse"> <wsdl:part name="parameters" element="tns:getXMLStringResponse"> </wsdl:part> </wsdl:message> -<wsdl:message name="getXMLString"> <wsdl:part name="parameters" element="tns:getXMLString"> </wsdl:part> </wsdl:message> -<wsdl:portType name="ITestService"> -<wsdl:operation name="getXMLString"> <wsdl:input name="getXMLString" message="tns:getXMLString"> </wsdl:input> <wsdl:output name="getXMLStringResponse" message="tns:getXMLStringResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> -<wsdl:binding name="TestServiceSoapBinding" type="tns:ITestService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> -<wsdl:operation name="getXMLString"> <soap:operation style="document" soapAction=""/> -<wsdl:input name="getXMLString"> <soap:body use="literal"/> </wsdl:input> -<wsdl:output name="getXMLStringResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> -<wsdl:service name="TestService"> -<wsdl:port name="TestServiceImplPort" binding="tns:TestServiceSoapBinding"> <soap:address location="http://localhost:8081/test/test/TestSOAP"/> </wsdl:port> </wsdl:service> </wsdl:definitions>