2013-01-16 49 views
0

我想构建一个xsd文件(在WSDL中)从SOAP请求中获取数据。我有预期的SOAP请求:在XSD中引用复杂类型/序列元素中的复杂类型元素

<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",而不是ref="eTimeRequest"。不管如何,仍然无效。以下是我验证的错误消息:

无效的XML模式:''eTimeRequest'必须引用现有元素'。

回答

0

对不起,已阅读此文的人。我显然在我的XSD代码中犯了一个错误,并浪费时间这样做。

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

的正确XSD架构在WSDL应改为:

<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>