如何在一个 WSDL 中创建多个方法并在每个方法中创建唯一的属性?

问题描述 投票:0回答:1

我不知道如何编写 WSDL 规范。

我尝试在 Soap UI 中执行此操作。

我不知道如何编写 WSDL 规范。

我尝试在 Soap UI 中执行此操作。

我不知道如何编写 WSDL 规范。

我尝试在 Soap UI 中执行此操作。

xml xsd wsdl
1个回答
0
投票

这可能有用

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://www.example.com"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.example.com">

    <!-- Определение элементов данных -->
    <wsdl:types>
        <xs:schema
            targetNamespace="http://www.example.com"
            xmlns:tns="http://www.example.com">

            <!-- Типы для Method1 -->
            <xs:element name="Method1Request">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Element1" type="xs:string"/>
                        <xs:element name="Element2" type="xs:string"/>
                        <xs:element name="Element3" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:element name="Method1Response">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Element1" type="xs:string"/>
                        <xs:element name="Element2" type="xs:string"/>
                        <xs:element name="Element3" type="xs:string"/>
                        <xs:element name="Element11" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <!-- Типы для Method2 -->
            <xs:element name="Method2Request">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Element4" type="xs:string"/>
                        <xs:element name="Element5" type="xs:string"/>
                        <xs:element name="Element6" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:element name="Method2Response">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Element4" type="xs:string"/>
                        <xs:element name="Element5" type="xs:string"/>
                        <xs:element name="Element6" type="xs:string"/>
                        <xs:element name="Element22" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

        </xs:schema>
    </wsdl:types>

    <!-- Определение сообщений -->
    <wsdl:message name="Method1RequestMessage">
        <wsdl:part name="parameters" element="tns:Method1Request"/>
    </wsdl:message>

    <wsdl:message name="Method1ResponseMessage">
        <wsdl:part name="parameters" element="tns:Method1Response"/>
    </wsdl:message>

    <wsdl:message name="Method2RequestMessage">
        <wsdl:part name="parameters" element="tns:Method2Request"/>
    </wsdl:message>

    <wsdl:message name="Method2ResponseMessage">
        <wsdl:part name="parameters" element="tns:Method2Response"/>
    </wsdl:message>

    <!-- Определение операций -->
    <wsdl:portType name="MyPortType">
        <wsdl:operation name="Method1">
            <wsdl:input message="tns:Method1RequestMessage"/>
            <wsdl:output message="tns:Method1ResponseMessage"/>
        </wsdl:operation>
        <wsdl:operation name="Method2">
            <wsdl:input message="tns:Method2RequestMessage"/>
            <wsdl:output message="tns:Method2ResponseMessage"/>
        </wsdl:operation>
    </wsdl:portType>

    <!-- Определение привязок -->
    <wsdl:binding name="MyBinding" type="tns:MyPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Method1">
            <soap:operation soapAction="Method1"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="Method2">
            <soap:operation soapAction="Method2"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <!-- Определение служб -->
    <wsdl:service name="MyService">
        <wsdl:port name="MyPort" binding="tns:MyBinding">
            <soap:address location="http://www.example.com/MyService"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

© www.soinside.com 2019 - 2024. All rights reserved.