SOAP请求中的复杂数组
我试图弄清楚如何编写SOAP请求的数组部分,其WSDL的相关部分如下:SOAP请求中的复杂数组,soap,soapui,Soap,Soapui,我试图弄清楚如何编写SOAP请求的数组部分,其WSDL的相关部分如下: <xsd:complexType name="ArrayOfProductInfo"> <xsd:complexContent> <xsd:restriction base="soap-enc:Array"> <xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:Prod
<xsd:complexType name="ArrayOfProductInfo">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:ProductInfo[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ProductInfo">
<xsd:all>
<xsd:element name="productID" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:int"/>
<xsd:element name="price" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="clCostRequest">
<xsd:all>
<xsd:element name="language" type="xsd:string"/>
<xsd:element name="items" type="tns:ArrayOfProductInfo"/>
<xsd:element name="shipmentOriginCountry" type="xsd:string"/>
<xsd:element name="shipmentDestinationCountry" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
使用soapUI,我可以看到SOAP请求应该如下所示,除了我用“?”标记包装的内容,soapUI没有显示这些内容。(还要注意,它将此节点显示为自动关闭标记。)
EN
产品ID
量
价格
产品ID
量
价格
美国
判定元件
我需要传入“ProductInfo”数组,但我不知道它的标记应该是什么样子。我试过了,但没有用:
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]">
<ProductInfo xsi:type="tns:ProductInfo">
<productID xsi:type="xsd:string">86595</productID>
<quantity xsi:type="xsd:int">50</quantity>
<price xsi:type="xsd:float">1.99</price>
</ProductInfo>
<ProductInfo xsi:type="tns:ProductInfo">
<productID xsi:type="xsd:string">12215</productID>
<quantity xsi:type="xsd:int">60</quantity>
<price xsi:type="xsd:float">5.99</price>
</ProductInfo>
</items>
86595
50
1.99
12215
60
5.99
任何对类似例子的提示或参考都将不胜感激 SoapUI将翻译您给他的WSDL,并向您显示请求及其参数。从WSDL生成的任何SOAPUI都应该是正确的。因此,我建议您检查您的WSDL,因为存在故障。这应该可以工作
<soapenv:Envelope mlns:xsi="http:...">
<soapenv:Header/>
<soapenv:Body>
<clCost soapenv:encodingStyle="http://schemas.xmlsoap.org/...">
<request xsi:type="clCostRequest">
<language xsi:type="xsd:string">en</language>
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]">
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">86595</productID>
<quantity xsi:type="xsd:int">50</quantity>
<price xsi:type="xsd:float">1.99</price>
</item>
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">12215</productID>
<quantity xsi:type="xsd:int">60</quantity>
<price xsi:type="xsd:float">5.99</price>
</item>
</items>
<shipmentOriginCountry xsi:type="xsd:string">US</shipmentOriginCountry>
<shipmentDestinationCountry xsi:type="xsd:string">DE</shipmentDestinationCountry>
</request>
</clCost>
</soapenv:Body>
</soapenv:Envelope>
EN
86595
50
1.99
12215
60
5.99
美国
判定元件
我仍然可以使用帮助…仍然!杜迪,请告诉我你知道怎么做了?我需要帮助@E.E.33我本以为ProductInfo上的maxOccurs无界会实现这一点,而不是试图将其定义为数组
<soapenv:Envelope mlns:xsi="http:...">
<soapenv:Header/>
<soapenv:Body>
<clCost soapenv:encodingStyle="http://schemas.xmlsoap.org/...">
<request xsi:type="clCostRequest">
<language xsi:type="xsd:string">en</language>
<items xsi:type="ArrayOfProductInfo" soapenc:arrayType="ProductInfo[]">
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">86595</productID>
<quantity xsi:type="xsd:int">50</quantity>
<price xsi:type="xsd:float">1.99</price>
</item>
<item xsi:type="xsd:ProductInfo">
<productID xsi:type="xsd:string">12215</productID>
<quantity xsi:type="xsd:int">60</quantity>
<price xsi:type="xsd:float">5.99</price>
</item>
</items>
<shipmentOriginCountry xsi:type="xsd:string">US</shipmentOriginCountry>
<shipmentDestinationCountry xsi:type="xsd:string">DE</shipmentDestinationCountry>
</request>
</clCost>
</soapenv:Body>
</soapenv:Envelope>