我正在尝试构建一个 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”必须引用现有元素。