WebService SOAP

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.dingyingsi.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CalculatorService" targetNamespace="http://www.dingyingsi.com/">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.dingyingsi.com/" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.dingyingsi.com/">
            <xsd:element name="a" nillable="true" type="xsd:int"/>
            <xsd:element name="b" nillable="true" type="xsd:int"/>
            <xsd:element name="result" nillable="true" type="xsd:int"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="addResponse">
        <wsdl:part element="tns:result" name="result"> </wsdl:part>
    </wsdl:message>
    <wsdl:message name="add">
        <wsdl:part element="tns:a" name="a"> </wsdl:part>
        <wsdl:part element="tns:b" name="b"> </wsdl:part>
    </wsdl:message>
    <wsdl:portType name="Calculator">
        <wsdl:operation name="add">
            <wsdl:input message="tns:add" name="add"> </wsdl:input>
            <wsdl:output message="tns:addResponse" name="addResponse"> </wsdl:output>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CalculatorServiceSoapBinding" type="tns:Calculator">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="add">
            <soap:operation soapAction="http://www.dingyingsi.com/" style="document"/>
            <wsdl:input name="add">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="addResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="CalculatorService">
        <wsdl:port binding="tns:CalculatorServiceSoapBinding" name="CalculatorPort">
            <soap:address location="http://192.168.146.1:9000/calculator"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
POST /calculator HTTP/1.1
Content-Type: text/xml; charset=UTF-8
Accept: */*
SOAPAction: "http://www.dingyingsi.com/"
User-Agent: Apache-CXF/3.3.0
Cache-Control: no-cache
Pragma: no-cache
Host: 192.168.146.1:9999
Connection: keep-alive
Content-Length: 197

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><a xmlns="http://www.dingyingsi.com/">10</a><b xmlns="http://www.dingyingsi.com/">20</b></soap:Body></soap:Envelope>
HTTP/1.1 200 OK
Date: Fri, 08 Mar 2019 02:49:50 GMT
Content-Type: text/xml;charset=utf-8
Content-Length: 163
Server: Jetty(9.4.14.v20181114)

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><result xmlns="http://www.dingyingsi.com/">30</result></soap:Body></soap:Envelope>

猜你喜欢

转载自www.cnblogs.com/dingyingsi/p/10494552.html