0

我正在尝试构建一个 xsd 文件(在 WSDL 内)以从 SOAP 请求中获取数据。我有预期的肥皂请求:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
    <m:upsertEntity xmlns:m="http://www.boomi.com/connector/wss">
        <eTimeRequest>
            <ObjectType>String</ObjectType>
            <Action>String</Action>
            <eTimeID>String</eTimeID>
            <OperativeID>String</OperativeID>
        </eTimeRequest>
    </m:upsertEntity>
</SOAP-ENV:Body>

这是我尝试过的。你不能有一个<xs:ComplexType>内另一个。我已经尝试过引用方法,但显然,当我尝试使用它进行 SOAP 请求时,它是无效的。我能做些什么?

这是 WSDL 中的 XSD:

    <xs:schema elementFormDefault="qualified" targetNamespace="http://www.boomi.com/connector/wss">
        <xs:element name="eTimeRequest" type="eTimeRequest"/>
        <xs:complexType name="eTimeRequest">
            <xs:sequence>
                <xs:element maxOccurs="1" minOccurs="0" name="ObjectType" type="xs:string"/>
                <xs:element maxOccurs="1" minOccurs="0" name="Action" type="xs:string"/>
                <xs:element maxOccurs="1" minOccurs="0" name="eTimeID" type="xs:string"/>
                <xs:element maxOccurs="1" minOccurs="0" name="OperativeID" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>

        <xs:element name="upsertEntity" type="tns:upsertEntity"/>
        <xs:complexType name="upsertEntity">
            <xs:sequence>
                <xs:element minOccurs="0" type="eTimeRequest"/> <!-- These should be the ObjectType, Action, eTimeID and OperativeID in here -->
            </xs:sequence>
        </xs:complexType>

    </xs:schema>

编辑 我在链接的代码中注意到的另一件事是我使用了Type="eTimeRequest"and not ref="eTimeRequest"。无论如何,仍然无效。这是我在验证时收到的错误消息:

无效的 XML 架构:“eTimeRequest”必须引用现有元素。

4

1 回答 1

0

对那些读过这篇文章的人感到抱歉。我显然在我的 XSD 代码中犯了一个错误,并且浪费了时间。

是的, 在<xs:ComplexType>不允许<xs:ComplexType>,但在中允许<xs:Element>包含。因此,生成的原始 SOAP 请求无效。我通过我们的系统运行了新版本,它工作正常。<xs:ComplexType> <xs:ComplexType>

WSDL 中的正确 XSD 架构应该是:

<xs:schema elementFormDefault="qualified" targetNamespace="http://www.boomi.com/connector/wss">
    <xs:element name="upsertEntity" type="tns:upsertEntity"/>           
    <xs:complexType  name="upsertEntity">
        <xs:sequence>
            <xs:element name="eTimeRequest">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="1" minOccurs="0" name="ObjectType" type="xs:string"/>
                        <xs:element maxOccurs="1" minOccurs="0" name="Action" type="xs:string"/>
                        <xs:element maxOccurs="1" minOccurs="0" name="eTimeID" type="xs:string"/>
                        <xs:element maxOccurs="1" minOccurs="0" name="OperativeID" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>           
</xs:schema>
于 2013-01-16T12:37:16.890 回答