delphi WSDL导入器问题

时间:2015-05-22 13:30:14

标签: delphi wsdl delphi-2010

我正在尝试导入第三方提供的WSDL。在其中一个方法(get_orders)中,查看WSDL,它可能会返回多个记录( <part name="orders" type="tns:order" xsi:minOccurs="0" xsi:maxOccurs="unbounded"/> )但Delphi会创建一个函数,当我相信它应该返回一个对象时是一个数组。我做错了吗?

WSDL文件

  
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:WashOut" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="integration" targetNamespace="urn:WashOut">
    <types>
        <schema targetNamespace="urn:WashOut" xmlns="http://www.w3.org/2001/XMLSchema">
            <xsd:complexType name="order">
                <xsd:sequence>
                    <xsd:element name="number" type="xsd:string"/>
                    <xsd:element name="total" type="xsd:decimal"/>
                </xsd:sequence>
            </xsd:complexType>
        </schema>
    </types>
    <message name="get_orders">
  </message>
    <message name="get_orders_response">
        <part name="orders" type="tns:order" xsi:minOccurs="0"     xsi:maxOccurs="unbounded"/>
    </message>
    <portType name="integration_port">
        <operation name="get_orders">
            <input message="tns:get_orders"/>
            <output message="tns:get_orders_response"/>
        </operation>
    </portType>
    <binding name="integration_binding" type="tns:integration_port">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="get_orders">
            <soap:operation soapAction="get_orders"/>
            <input>
                <soap:body use="encoded"     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
            </output>
        </operation>
    </binding>
    <service name="service">
        <port name="integration_port" binding="tns:integration_binding">
            <soap:address location="http://www.url.com/integration/action"/>
        </port>
    </service>
</definitions>

delphi创建的函数

  
function  get_orders: order; stdcall;  

2015年5月25日更新

webservice返回如下内容:

  
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:WashOut">
  <soap:Body>
    <tns:get_orders_response>
      <orders xsi:type="tns:orders">
        <number xsi:type="xsd:string">565474258</number>
        <total xsi:type="xsd:decimal">0.0</total>
      </orders>
      <orders xsi:type="tns:orders">
        <number xsi:type="xsd:string">519301205</number>
        <total xsi:type="xsd:decimal">0.0</total>
      </orders>
      <orders xsi:type="tns:orders">
        <number xsi:type="xsd:string">619118175</number>
        <total xsi:type="xsd:decimal">347.33</total>
      </orders>
      <orders xsi:type="tns:orders">
        <number xsi:type="xsd:string">105590906</number>
        <total xsi:type="xsd:decimal">127.74</total>
      </orders>
    </tns:get_orders_response>
  </soap:Body>
</soap:Envelope>

所以,也许我问的是错误的问题。我如何使用WSDL Importer生成的单元迭代从Web服务返回的“订单”?

0 个答案:

没有答案