Delphi:WSDL Import无法处理对象

时间:2012-12-04 18:40:39

标签: delphi wsdl delphi-xe

bellow地址上有第三方Web服务应用程序 http://webservice.magfa.com/services/urn:SOAPSmsQueue?wsdl
我想使用方法“getAllMessages”返回名为“CustomerReturnIncomingFormat”的对象数组,但是delphi wsdl importer无法正确导入。
并生成为“ArrayOf_xsd_anyType:变体数组”!!!
似乎delphi无法从wsdl导入对象! 任何的想法?

1 个答案:

答案 0 :(得分:2)

问题在于程序员一直懒惰并为所有返回实际上是对象数组的调用做了一个ArrayOf_xsd_anyType声明。 WSDL导入器尝试将此类型尽可能好地映射到变量数组。由于您拥有文档,因此您确切知道每个服务调用的内容。最简单的方法是修复WSDL:

<?xml version="1.0" encoding="utf-8"?>
<definitions targetNamespace="http://magfa.com/soap/SOAPSmsQueue" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://magfa.com/soap/SOAPSmsQueue" xmlns:intf="http://magfa.com/soap/SOAPSmsQueue" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:SOAPSmsQueue" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:types>
    <schema targetNamespace="urn:SOAPSmsQueue" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      <complexType name="CustomerReturnIncomingFormat">
        <sequence>
          <element name="body" nillable="true" type="xsd:string" />
          <element name="errorResult" nillable="true" type="xsd:string" />
          <element name="recipientNumber" nillable="true" type="xsd:string" />
          <element name="senderNumber" nillable="true" type="xsd:string" />
        </sequence>
      </complexType>
      <complexType name="DatedCustomerReturnIncomingFormat">
        <complexContent>
          <extension base="tns1:CustomerReturnIncomingFormat">
            <sequence>
              <element name="date" nillable="true" type="xsd:string" />
            </sequence>
          </extension>
        </complexContent>
      </complexType>
    </schema>
    <schema targetNamespace="http://magfa.com/soap/SOAPSmsQueue" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      <complexType name="ArrayOf_xsd_string">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
          </restriction>
        </complexContent>
      </complexType>
      <complexType name="ArrayOf_xsd_int">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]" />
          </restriction>
        </complexContent>
      </complexType>
      <complexType name="ArrayOf_xsd_long">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:long[]" />
          </restriction>
        </complexContent>
      </complexType>
      <complexType name="ArrayOf_xsd_anyType">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" />
          </restriction>
        </complexContent>
      </complexType>
      <complexType name="ArrayOf_CustomerReturnIncomingFormat">
        <complexContent>
          <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:CustomerReturnIncomingFormat[]" />
          </restriction>
        </complexContent>
      </complexType>
    </schema>
  </wsdl:types>
  <message name="getAllMessagesRequest">
    <part name="domain" type="xsd:string" />
    <part name="numberOfMessages" type="xsd:int" />
  </message>
  <message name="getCreditResponse">
    <part name="getCreditReturn" type="xsd:float" />
  </message>
  <message name="getMessageIdRequest">
    <part name="domain" type="xsd:string" />
    <part name="checkingMessageId" type="xsd:long" />
  </message>
  <message name="getMessagesWithNumberResponse">
    <part name="getMessagesWithNumberReturn" type="impl:ArrayOf_xsd_anyType" />
  </message>
  <message name="getMessageStatusesRequest">
    <part name="messagesId" type="impl:ArrayOf_xsd_long" />
  </message>
  <message name="getRealMessageStatusesRequest">
    <part name="messagesId" type="impl:ArrayOf_xsd_long" />
  </message>
  <message name="enqueueWithGatewayRequest">
    <part name="domain" type="xsd:string" />
    <part name="messageBodies" type="impl:ArrayOf_xsd_string" />
    <part name="recipientNumbers" type="impl:ArrayOf_xsd_string" />
    <part name="senderNumbers" type="impl:ArrayOf_xsd_string" />
    <part name="encodings" type="impl:ArrayOf_xsd_int" />
    <part name="udhs" type="impl:ArrayOf_xsd_string" />
    <part name="messageClasses" type="impl:ArrayOf_xsd_int" />
    <part name="priorities" type="impl:ArrayOf_xsd_int" />
    <part name="checkingMessageIds" type="impl:ArrayOf_xsd_long" />
    <part name="gateway" type="xsd:string" />
  </message>
  <message name="getAllMessagesResponse">
    <part name="getAllMessagesReturn" type="impl:ArrayOf_CustomerReturnIncomingFormat" />
  </message>
  <message name="getAllMessagesWithNumberResponse">
    <part name="getAllMessagesWithNumberReturn" type="impl:ArrayOf_xsd_anyType" />
  </message>
  <message name="enqueueResponse">
    <part name="enqueueReturn" type="impl:ArrayOf_xsd_long" />
  </message>
  <message name="getMessageStatusesResponse">
    <part name="getMessageStatusesReturn" type="impl:ArrayOf_xsd_int" />
  </message>
  <message name="getMessageStatusRequest">
    <part name="messageId" type="xsd:long" />
  </message>
  <message name="getMessagesResponse">
    <part name="getMessagesReturn" type="impl:ArrayOf_xsd_anyType" />
  </message>
  <message name="getMessagesRequest">
    <part name="domain" type="xsd:string" />
    <part name="numberOfMessages" type="xsd:int" />
  </message>
  <message name="getAllMessagesWithNumberRequest">
    <part name="domain" type="xsd:string" />
    <part name="numberOfMessages" type="xsd:int" />
    <part name="destNumber" type="xsd:string" />
  </message>
  <message name="enqueueRequest">
    <part name="domain" type="xsd:string" />
    <part name="messageBodies" type="impl:ArrayOf_xsd_string" />
    <part name="recipientNumbers" type="impl:ArrayOf_xsd_string" />
    <part name="senderNumbers" type="impl:ArrayOf_xsd_string" />
    <part name="encodings" type="impl:ArrayOf_xsd_int" />
    <part name="udhs" type="impl:ArrayOf_xsd_string" />
    <part name="messageClasses" type="impl:ArrayOf_xsd_int" />
    <part name="priorities" type="impl:ArrayOf_xsd_int" />
    <part name="checkingMessageIds" type="impl:ArrayOf_xsd_long" />
  </message>
  <message name="getRealMessageStatusesResponse">
    <part name="getRealMessageStatusesReturn" type="impl:ArrayOf_xsd_int" />
  </message>
  <message name="getMessagesWithNumberRequest">
    <part name="domain" type="xsd:string" />
    <part name="numberOfMessages" type="xsd:int" />
    <part name="destNumber" type="xsd:string" />
  </message>
  <message name="getMessageIdResponse">
    <part name="getMessageIdReturn" type="xsd:long" />
  </message>
  <message name="getCreditRequest">
    <part name="domain" type="xsd:string" />
  </message>
  <message name="getMessageStatusResponse">
    <part name="getMessageStatusReturn" type="xsd:int" />
  </message>
  <message name="enqueueWithGatewayResponse">
    <part name="enqueueWithGatewayReturn" type="impl:ArrayOf_xsd_long" />
  </message>
  <portType name="SoapSmsQueuableImplementation">
    <operation name="enqueue" parameterOrder="domain messageBodies recipientNumbers senderNumbers encodings udhs messageClasses priorities checkingMessageIds">
      <input message="impl:enqueueRequest" name="enqueueRequest" />
      <output message="impl:enqueueResponse" name="enqueueResponse" />
    </operation>
    <operation name="getMessages" parameterOrder="domain numberOfMessages">
      <input message="impl:getMessagesRequest" name="getMessagesRequest" />
      <output message="impl:getMessagesResponse" name="getMessagesResponse" />
    </operation>
    <operation name="getMessageId" parameterOrder="domain checkingMessageId">
      <input message="impl:getMessageIdRequest" name="getMessageIdRequest" />
      <output message="impl:getMessageIdResponse" name="getMessageIdResponse" />
    </operation>
    <operation name="getRealMessageStatuses" parameterOrder="messagesId">
      <input message="impl:getRealMessageStatusesRequest" name="getRealMessageStatusesRequest" />
      <output message="impl:getRealMessageStatusesResponse" name="getRealMessageStatusesResponse" />
    </operation>
    <operation name="getAllMessagesWithNumber" parameterOrder="domain numberOfMessages destNumber">
      <input message="impl:getAllMessagesWithNumberRequest" name="getAllMessagesWithNumberRequest" />
      <output message="impl:getAllMessagesWithNumberResponse" name="getAllMessagesWithNumberResponse" />
    </operation>
    <operation name="getMessagesWithNumber" parameterOrder="domain numberOfMessages destNumber">
      <input message="impl:getMessagesWithNumberRequest" name="getMessagesWithNumberRequest" />
      <output message="impl:getMessagesWithNumberResponse" name="getMessagesWithNumberResponse" />
    </operation>
    <operation name="getCredit" parameterOrder="domain">
      <input message="impl:getCreditRequest" name="getCreditRequest" />
      <output message="impl:getCreditResponse" name="getCreditResponse" />
    </operation>
    <operation name="getAllMessages" parameterOrder="domain numberOfMessages">
      <input message="impl:getAllMessagesRequest" name="getAllMessagesRequest" />
      <output message="impl:getAllMessagesResponse" name="getAllMessagesResponse" />
    </operation>
    <operation name="enqueueWithGateway" parameterOrder="domain messageBodies recipientNumbers senderNumbers encodings udhs messageClasses priorities checkingMessageIds gateway">
      <input message="impl:enqueueWithGatewayRequest" name="enqueueWithGatewayRequest" />
      <output message="impl:enqueueWithGatewayResponse" name="enqueueWithGatewayResponse" />
    </operation>
    <operation name="getMessageStatuses" parameterOrder="messagesId">
      <input message="impl:getMessageStatusesRequest" name="getMessageStatusesRequest" />
      <output message="impl:getMessageStatusesResponse" name="getMessageStatusesResponse" />
    </operation>
    <operation name="getMessageStatus" parameterOrder="messageId">
      <input message="impl:getMessageStatusRequest" name="getMessageStatusRequest" />
      <output message="impl:getMessageStatusResponse" name="getMessageStatusResponse" />
    </operation>
  </portType>
  <binding name="TSOAPSoapBinding" type="impl:SoapSmsQueuableImplementation">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="enqueue">
      <wsdlsoap:operation soapAction="" />
      <input name="enqueueRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="enqueueResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getMessages">
      <wsdlsoap:operation soapAction="" />
      <input name="getMessagesRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getMessagesResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getMessageId">
      <wsdlsoap:operation soapAction="" />
      <input name="getMessageIdRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getMessageIdResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getRealMessageStatuses">
      <wsdlsoap:operation soapAction="" />
      <input name="getRealMessageStatusesRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getRealMessageStatusesResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getAllMessagesWithNumber">
      <wsdlsoap:operation soapAction="" />
      <input name="getAllMessagesWithNumberRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getAllMessagesWithNumberResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getMessagesWithNumber">
      <wsdlsoap:operation soapAction="" />
      <input name="getMessagesWithNumberRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getMessagesWithNumberResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getCredit">
      <wsdlsoap:operation soapAction="" />
      <input name="getCreditRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getCreditResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getAllMessages">
      <wsdlsoap:operation soapAction="" />
      <input name="getAllMessagesRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getAllMessagesResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="enqueueWithGateway">
      <wsdlsoap:operation soapAction="" />
      <input name="enqueueWithGatewayRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="enqueueWithGatewayResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getMessageStatuses">
      <wsdlsoap:operation soapAction="" />
      <input name="getMessageStatusesRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getMessageStatusesResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
    <operation name="getMessageStatus">
      <wsdlsoap:operation soapAction="" />
      <input name="getMessageStatusRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </input>
      <output name="getMessageStatusResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://magfa.com/soap/SOAPSmsQueue" use="encoded" />
      </output>
    </operation>
  </binding>
  <service name="SoapSmsQueuableImplementationService">
    <port binding="impl:TSOAPSoapBinding" name="TSOAP">
      <wsdlsoap:address location="http://webservice.magfa.com/services/urn:SOAPSmsQueue" />
    </port>
  </service>
</definitions>

我刚刚为ArrayOf_CustomerReturnIncomingFormat添加了一个定义,并将getAllMessagesReturn部分的返回值类型更改为此定义。

确保在导入此wsdl文件时关闭“不发出未使用的类型(-Ot)”选项。这是使用delphi XE导入固定WSDL文件时的结果单位:

unit SOAPSmsQueue;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:anyType         - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:float           - "http://www.w3.org/2001/XMLSchema"[]
  // !:CustomerReturnIncomingFormat - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:long            - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:int             - "http://www.w3.org/2001/XMLSchema"[Gbl]

  CustomerReturnIncomingFormat = class;         { "urn:SOAPSmsQueue"[!U][GblCplx] }
  DatedCustomerReturnIncomingFormat = class;    { "urn:SOAPSmsQueue"[!U][GblCplx] }

  ArrayOf_xsd_anyType = array of Variant;       { "http://magfa.com/soap/SOAPSmsQueue"[GblCplx] }
  ArrayOf_CustomerReturnIncomingFormat = array of CustomerReturnIncomingFormat;   { "http://magfa.com/soap/SOAPSmsQueue"[GblCplx] }
  ArrayOf_xsd_string = array of string;         { "http://magfa.com/soap/SOAPSmsQueue"[GblCplx] }


  // ************************************************************************ //
  // XML       : CustomerReturnIncomingFormat, global, <complexType>
  // Namespace : urn:SOAPSmsQueue
  // ************************************************************************ //
  CustomerReturnIncomingFormat = class(TRemotable)
  private
    Fbody: string;
    FerrorResult: string;
    FrecipientNumber: string;
    FsenderNumber: string;
  published
    property body:            string  read Fbody write Fbody;
    property errorResult:     string  read FerrorResult write FerrorResult;
    property recipientNumber: string  read FrecipientNumber write FrecipientNumber;
    property senderNumber:    string  read FsenderNumber write FsenderNumber;
  end;



  // ************************************************************************ //
  // XML       : DatedCustomerReturnIncomingFormat, global, <complexType>
  // Namespace : urn:SOAPSmsQueue
  // ************************************************************************ //
  DatedCustomerReturnIncomingFormat = class(CustomerReturnIncomingFormat)
  private
    Fdate: string;
  published
    property date: string  read Fdate write Fdate;
  end;

  ArrayOf_xsd_long = array of Int64;            { "http://magfa.com/soap/SOAPSmsQueue"[GblCplx] }
  ArrayOf_xsd_int = array of Integer;           { "http://magfa.com/soap/SOAPSmsQueue"[GblCplx] }

  // ************************************************************************ //
  // Namespace : http://magfa.com/soap/SOAPSmsQueue
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // use       : encoded
  // binding   : TSOAPSoapBinding
  // service   : SoapSmsQueuableImplementationService
  // port      : TSOAP
  // URL       : http://webservice.magfa.com/services/urn:SOAPSmsQueue
  // ************************************************************************ //
  SoapSmsQueuableImplementation = interface(IInvokable)
  ['{9DBBFB75-511D-1D3D-5200-4133705D96F5}']
    function  enqueue(const domain: string; const messageBodies: ArrayOf_xsd_string; const recipientNumbers: ArrayOf_xsd_string; const senderNumbers: ArrayOf_xsd_string; const encodings: ArrayOf_xsd_int; const udhs: ArrayOf_xsd_string;
                      const messageClasses: ArrayOf_xsd_int; const priorities: ArrayOf_xsd_int; const checkingMessageIds: ArrayOf_xsd_long): ArrayOf_xsd_long; stdcall;
    function  getMessages(const domain: string; const numberOfMessages: Integer): ArrayOf_xsd_anyType; stdcall;
    function  getMessageId(const domain: string; const checkingMessageId: Int64): Int64; stdcall;
    function  getRealMessageStatuses(const messagesId: ArrayOf_xsd_long): ArrayOf_xsd_int; stdcall;
    function  getAllMessagesWithNumber(const domain: string; const numberOfMessages: Integer; const destNumber: string): ArrayOf_xsd_anyType; stdcall;
    function  getMessagesWithNumber(const domain: string; const numberOfMessages: Integer; const destNumber: string): ArrayOf_xsd_anyType; stdcall;
    function  getCredit(const domain: string): Single; stdcall;
    function  getAllMessages(const domain: string; const numberOfMessages: Integer): ArrayOf_CustomerReturnIncomingFormat; stdcall;
    function  enqueueWithGateway(const domain: string; const messageBodies: ArrayOf_xsd_string; const recipientNumbers: ArrayOf_xsd_string; const senderNumbers: ArrayOf_xsd_string; const encodings: ArrayOf_xsd_int; const udhs: ArrayOf_xsd_string;
                                 const messageClasses: ArrayOf_xsd_int; const priorities: ArrayOf_xsd_int; const checkingMessageIds: ArrayOf_xsd_long; const gateway: string): ArrayOf_xsd_long; stdcall;
    function  getMessageStatuses(const messagesId: ArrayOf_xsd_long): ArrayOf_xsd_int; stdcall;
    function  getMessageStatus(const messageId: Int64): Integer; stdcall;
  end;

function GetSoapSmsQueuableImplementation(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SoapSmsQueuableImplementation;


implementation
  uses SysUtils;

function GetSoapSmsQueuableImplementation(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SoapSmsQueuableImplementation;
const
  defWSDL = 'C:\Temp\SOAPSmsQueue.xml';
  defURL  = 'http://webservice.magfa.com/services/urn:SOAPSmsQueue';
  defSvc  = 'SoapSmsQueuableImplementationService';
  defPrt  = 'TSOAP';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as SoapSmsQueuableImplementation);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;


initialization
  { SoapSmsQueuableImplementation }
  InvRegistry.RegisterInterface(TypeInfo(SoapSmsQueuableImplementation), 'http://magfa.com/soap/SOAPSmsQueue', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SoapSmsQueuableImplementation), '');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOf_xsd_anyType), 'http://magfa.com/soap/SOAPSmsQueue', 'ArrayOf_xsd_anyType');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOf_CustomerReturnIncomingFormat), 'http://magfa.com/soap/SOAPSmsQueue', 'ArrayOf_CustomerReturnIncomingFormat');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOf_xsd_string), 'http://magfa.com/soap/SOAPSmsQueue', 'ArrayOf_xsd_string');
  RemClassRegistry.RegisterXSClass(CustomerReturnIncomingFormat, 'urn:SOAPSmsQueue', 'CustomerReturnIncomingFormat');
  RemClassRegistry.RegisterXSClass(DatedCustomerReturnIncomingFormat, 'urn:SOAPSmsQueue', 'DatedCustomerReturnIncomingFormat');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOf_xsd_long), 'http://magfa.com/soap/SOAPSmsQueue', 'ArrayOf_xsd_long');
  RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOf_xsd_int), 'http://magfa.com/soap/SOAPSmsQueue', 'ArrayOf_xsd_int');

end.