samdung 发表于 2017-2-8 09:07:00

Web Service框架XFire与Tomcat集成(2)

Wsdl内容如下

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservice"
    xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
    xmlns:tns="http://webservice"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <wsdl:types>
       <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           attributeFormDefault="qualified" elementFormDefault="qualified"
           targetNamespace="http://webservice">
           <xsd:element name="sayHello">
              <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element maxOccurs="1" minOccurs="1"
                         name="in0" nillable="true" type="xsd:string" />
                  </xsd:sequence>
               </xsd:complexType>
           </xsd:element>
           <xsd:element name="sayHelloResponse">
              <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element maxOccurs="1" minOccurs="1"
                         name="out" nillable="true" type="xsd:string" />
                  </xsd:sequence>
              </xsd:complexType>
           </xsd:element>
       </xsd:schema>
    </wsdl:types>
    <wsdl:message name="sayHelloResponse">
       <wsdl:part name="parameters" element="tns:sayHelloResponse">
       </wsdl:part>
    </wsdl:message>
    <wsdl:message name="sayHelloRequest">
       <wsdl:part name="parameters" element="tns:sayHello"></wsdl:part>
    </wsdl:message>
    <wsdl:portType name="sayHelloPortType">
       <wsdl:operation name="sayHello">
           <wsdl:input name="sayHelloRequest"
              message="tns:sayHelloRequest">
           </wsdl:input>
           <wsdl:output name="sayHelloResponse"
              message="tns:sayHelloResponse">
           </wsdl:output>
       </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="sayHelloHttpBinding"
       type="tns:sayHelloPortType">
       <wsdlsoap:binding style="document"
           transport="http://schemas.xmlsoap.org/soap/http" />
       <wsdl:operation name="sayHello">
           <wsdlsoap:operation soapAction="" />
           <wsdl:input name="sayHelloRequest">
              <wsdlsoap:body use="literal" />
           </wsdl:input>
           <wsdl:output name="sayHelloResponse">
              <wsdlsoap:body use="literal" />
           </wsdl:output>
       </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="sayHello">
       <wsdl:port name="sayHelloHttpPort"
           binding="tns:sayHelloHttpBinding">
           <wsdlsoap:address
               location="http://127.0.0.1:8080/xfireClient/services/sayHello" />
       </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
到此,一个小小的web service已经发布成功。下次有时间在写XFire客户端的代码和实例。
页: [1]
查看完整版本: Web Service框架XFire与Tomcat集成(2)