【问题标题】:WSDL import issue in delphidelphi中的WSDL导入问题
【发布时间】:2012-12-30 21:05:54
【问题描述】:

我有一个 WSDL 网址: http://www.persiansms.info/webservice/smsService.php?wsdl

当我尝试使用 Delphi WSDL Importer 生成接口时,Delphi 会生成以下警告:

  // ************************************************************************ //
  // 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.
  // ************************************************************************ //
  // !:int             - "http://www.w3.org/2001/XMLSchema"[]
  // !:ArrayOf_xsd_long - "http://www.w3.org/2001/XMLSchema"[]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[]
  // !:array           - "http://www.w3.org/2001/XMLSchema"[]

那么,数组是什么? WSDL 文档从未提及它的类型,例如:

<part name="note" type="xsd:array"/>

我很困惑,这是delphi中的错误吗?还是 WSDL 文档不完整? 一个 C# 程序可以很好地使用它,但我没有源代码。

那我该怎么办? 有没有可能找出那是什么?

【问题讨论】:

  • 看起来你在下面得到了答案。我之所以问 Delphi 的哪个版本是因为五六年前我发现 D7 的 WSDL 导入器在特定站点上生成的代码有问题。我确认了这些错误是特定于 D7 的,并且当时在 Embarcadero 负责代码的人提供了一些帮助,但我没有记录问题是什么或与谁一起工作。如果您遇到问题,虽然我知道这会很痛苦,但您可能需要看看是否可以在其中的某些部分使用更现代的 Delphi 版本,也许在 DLL 中?抱歉,我无法提供更多帮助。

标签: web-services delphi wsdl delphi-7 soap-client


【解决方案1】:

我们可以解决此类型的问题,应将其替换为“Array;” :

T2dArray = WideString 数组的数组;

也许它可以帮助其他人。 我正在测试它,它仍然有效!

【讨论】:

    【解决方案2】:

    我的旧 BDS2006(德语)在生成的代码中添加注释

    // ************************************************************************ //
    // Die folgenden Typen, auf die im WSDL-Dokument Bezug genommen wird, sind in dieser Datei
    // nicht repräsentiert. Sie sind entweder Aliase(@) anderer repräsentierter Typen oder auf sie wurde Bezug genommen,
    // aber in diesem Dokument nicht deklariert (!). Die Typen aus letzterer Kategorie
    // sind normalerweise mit vordefinierten/bekannten XML- oder Borland-Typen verbunden; sie könnten aber auch ein Anzeichen
    // für ein falsches WSDL-Dokument sein, das einen Schema-Typ nicht deklariert oder importiert..
    // ************************************************************************ //
    // !:string          - "http://www.w3.org/2001/XMLSchema"
    // !:array           - "http://www.w3.org/2001/XMLSchema"
    // !:int             - "http://www.w3.org/2001/XMLSchema"
    // !:ArrayOf_xsd_long - "http://www.w3.org/2001/XMLSchema"
    

    意思是: WSDL 文档中引用的以下类型未在其中表示(声明?)。它们要么是包含的其他类型的别名 (@),但未在本文档中声明 (!)。后一类的类型通常与预定义/已知的 XML 或 Borland 类型相关联,但也可以指示未声明或导入模式类型的无效 WSDL 文档。

    抱歉翻译的异域风情。

    【讨论】:

      【解决方案3】:

      问题是由于 WSDL RPC 编码和 Delphi 不支持它(甚至不支持 XE3),如下 wsdl 摘录所示:

      <binding name="sms_webserviceBinding" type="tns:sms_webservicePort">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
          <operation name="send_sms_array">
      

      它确实适用于 C# 客户端,因为支持 RPC,如下所示:

      public interface sms_webservicePort {
      
          [System.ServiceModel.OperationContractAttribute(Action="urn:sms_webservice#sms_webservice#send_sms_array", ReplyAction="*")]
          [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
          [return: System.ServiceModel.MessageParameterAttribute(Name="send_sms_array")]
          string send_sms_array(string username, string password, string sender_number, string receiver_number, string note, string ersal_flash, string onlysend, int date);
      

      在使用 NetBeans 7.x 的 Java 中,可以得到更明确的信息:

      选定的 wsdl 是 rpc 编码的。您必须选择 JAX-RPC 客户端。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多