【问题标题】:soapui wsdl empty requestsoapui wsdl 空请求
【发布时间】:2018-06-26 11:40:03
【问题描述】:

我尝试生成一个 wsdl,但是在将其导入到 soap UI 时,请求模板是空的 - 没有警告或任何其他表明问题的东西。

这是结果

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body/>
</soapenv:Envelope>

我制作的 wsdl 看起来像这样(为了清楚起见,删除了一些)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://localhost/powershell/" targetNamespace="http://localhost/powershell/" name="powershell">
    <wsdl:types>
        <xs:schema targetNamespace="http://localhost/powershell/" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="GetProcessRequest">
                <xs:complexType name="GetProcessRequestType">
                    <xs:sequence>
                        <xs:element name="field1" minOccurs="0" type="xs:string" nillable="false" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetProcessResponse">
                <xs:complexType name="GetProcessResponseType">
                    <xs:sequence>
                        <xs:element name="o1" minOccurs="0" type="xs:string" nillable="false" />
                        <xs:element name="o2" minOccurs="0" type="xs:string" nillable="false" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="ListGetProcessResponse">
                <xs:complexType name="ListGetProcessResponseType">
                    <xs:complexContent mixed="false">
                        <xs:restriction base="soapenc:Array">
                            <xs:attribute ref="soapenc:arrayType" wsdl:arrayType="GetProcessResponseType[]" />
                        </xs:restriction>
                    </xs:complexContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetItemsRequest">
                <xs:complexType name="GetItemsRequestType">
                    <xs:sequence>
                        <xs:element name="field1" minOccurs="0" type="xs:string" nillable="false" />
                        <xs:element name="field2" minOccurs="0" type="xs:string" nillable="false" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="GetItemsResponse">
                <xs:complexType name="GetItemsResponseType">
                    <xs:sequence>
                        <xs:element name="o1" minOccurs="0" type="xs:string" nillable="false" />
                        <xs:element name="o2" minOccurs="0" type="xs:string" nillable="false" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="ListGetItemsResponse">
                <xs:complexType name="ListGetItemsResponseType">
                    <xs:complexContent mixed="false">
                        <xs:restriction base="soapenc:Array">
                            <xs:attribute ref="soapenc:arrayType" wsdl:arrayType="GetItemsResponseType[]" />
                        </xs:restriction>
                    </xs:complexContent>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:portType name="powershell">
        <wsdl:operation name="GetProcess">
            <wsdl:input message="tns:GetProcessRequestMessage" />
            <wsdl:output message="tns:GetProcessResponseMessage" />
        </wsdl:operation>
        <wsdl:operation name="GetItems">
            <wsdl:input message="tns:GetItemsRequestMessage" />
            <wsdl:output message="tns:GetItemsResponseMessage" />
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="powershellBinding" type="tns:powershell">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
            <wsdl:operation name="GetProcess">
                <soap:operation soapAction="http://localhost/powershell.svc/GetProcess" style="document">
                    <wsdl:input>
                        <soap:body use="literal" />
                    </wsdl:input>
                    <wsdl:output>
                        <soap:body use="literal" />
                    </wsdl:output>
                </soap:operation>
            </wsdl:operation>
            <wsdl:operation name="GetItems">
                <soap:operation soapAction="http://localhost/powershell.svc/GetItems"     style="document">
                    <wsdl:input>
                        <soap:body use="literal" />
                    </wsdl:input>
                    <wsdl:output>
                        <soap:body use="literal" />
                    </wsdl:output>
                </soap:operation>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="powershell">
            <wsdl:port binding="tns:powershellBinding" name="powershellBinding">
                <soap:address location="http://localhost/powershell.svc" />
            </wsdl:port>
        </wsdl:service>
        <wsdl:message name="GetProcessRequestMessage">
            <wsdl:part name="parameters" element="tns:GetProcessRequest" />
        </wsdl:message>
        <wsdl:message name="GetProcessResponseMessage">
            <wsdl:part name="parameters" element="tns:ListGetProcessResponse" />
        </wsdl:message>
        <wsdl:message name="GetItemsRequestMessage">
            <wsdl:part name="parameters" element="tns:GetItemsRequest" />
        </wsdl:message>
        <wsdl:message name="GetItemsResponseMessage">
            <wsdl:part name="parameters" element="tns:GetItemsResponse" />
        </wsdl:message>
    </wsdl:definitions>

据我所知,一切都应该正确链接,但显然我在某处遗漏了一些东西,我就是找不到。

【问题讨论】:

    标签: request wsdl soapui


    【解决方案1】:

    您的 WSDL 无效。 soap:operation 元素的定义不允许任何内容。您需要立即关闭元素soap:operation,不带任何子元素:

    <soap:operation soapAction="http://localhost/powershell.svc/GetItems"     style="document" />
    

    您需要进行以下更改:

    <wsdl:operation name="GetItems">
                <soap:operation soapAction="http://localhost/powershell.svc/GetItems"     style="document" />
                    <wsdl:input>
                        <soap:body use="literal" />
                    </wsdl:input>
                    <wsdl:output>
                        <soap:body use="literal" />
                    </wsdl:output>
            </wsdl:operation>
    

    其他操作也是如此。

    【讨论】:

    • 非常感谢 - 已经盯着这个几个小时了 - 错过了我将输入和输出添加到错误的节点。知道这很简单 - 只是看不到 - 非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-01
    • 2022-07-27
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2012-03-19
    相关资源
    最近更新 更多