如何导入此 WSDL?

发布于 2024-10-22 09:06:06 字数 1845 浏览 3 评论 0原文

我从客户那里收到了 WSDL,作为导入 Web 服务以与他们的系统进行互操作的一部分。他们发送了两个文件:WSDL 和模式。当我运行 WSDL 导入器时,我得到如下所示的输出:

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.
  // ************************************************************************ //
  // !:LoadData     - "http://client.com/"[Lit][]
  // !:LoadDataResponse - "http://client.com/"[Lit][]


  // ************************************************************************ //
  // Namespace : http://client.com/
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : ClientPortBinding
  // service   : ClientService
  // port      : ClientPort
  // URL       : http://localhost:8080/ClientService
  // ************************************************************************ //
  IClientLoad = interface(IInvokable)
  ['{8DC02C6F-78D3-E09A-FE43-EE5211DB188D}']

    // Cannot unwrap:
    //     - Input part does not refer to an element
    //     - Output part does not refer to an element
    function  LoadDataBatch(const parameters: LoadData): LoadDataResponse; stdcall;
  end;

缺少的类型在它们发送的架构文件中定义。我尝试将 WSDL 的导入行更改为如下所示,但它没有改变任何内容:

如何正确设置此选项,以便 Delphi 的 WSDL 导入向导将检查本地系统上的架构文件并读取从中键入定义?

I received a WSDL from a client, as part of importing a web service to interoperate with their system. They sent two files: a WSDL and a schema. When I run the WSDL importer, I get an output that looks like this:

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.
  // ************************************************************************ //
  // !:LoadData     - "http://client.com/"[Lit][]
  // !:LoadDataResponse - "http://client.com/"[Lit][]


  // ************************************************************************ //
  // Namespace : http://client.com/
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : ClientPortBinding
  // service   : ClientService
  // port      : ClientPort
  // URL       : http://localhost:8080/ClientService
  // ************************************************************************ //
  IClientLoad = interface(IInvokable)
  ['{8DC02C6F-78D3-E09A-FE43-EE5211DB188D}']

    // Cannot unwrap:
    //     - Input part does not refer to an element
    //     - Output part does not refer to an element
    function  LoadDataBatch(const parameters: LoadData): LoadDataResponse; stdcall;
  end;

The missing types are defined in the schema file they sent. I tried changing the WSDL's import line to look like this, but it didn't change anything:

<xsd:import namespace="http://client.com/" schemaLocation="file://C:/Users/mwheeler/Documents/WSDL/ClientLoadData Schema.xml"></xsd:import>

How do I set this up properly so Delphi's WSDL import wizard will examine the schema file on my local system and read the type definitions from it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑看君怀她人 2024-10-29 09:06:06

问题可能不是出在进口方面,而是出在出口方面。我们遇到的情况:

  • Delphi 编码的服务器应用程序也响应 SOAP Web 请求。
  • .Net 编码的客户端应用程序,使用 SOAP 与 Delphi 服务器应用程序进行通信。

如果任何导出的 SOAP 接口中均未使用该(基)类型,则 Delphi 服务器应用程序不会也不会在其 WSDL 响应中导出该(基)类型。

示例:

TBaseReponseClass = class(TRemotable)
end;

TLoginResponseClass = class(TBaseReponseClass)
end;

ISOAPResponse = interface(IInvokable)
['{SomeGUID}']
  function Ping: TBaseReponseClass ; stdcall
  function Login: TLoginResponseClass ; stdcall;
end;

使用 ISOAPResponse 中的 Ping 功能,一切正常。

如果 ISOAPResponse 中没有 Ping 函数,TBaseResponseClass 将不会在 WSDL 中导出,并且在 .Net 端导入 WSDL 会引发有关未定义元素的错误。

我想您可以检查从客户端获得的 WSDL,看看它是否使用了祖先层次结构中的一个或多个类未包含在 WSDL/Schema 中的任何类。如果是这种情况,那么您可能必须返回客户以让他们修改界面。或者,如果幸运的话,也许可以找到一些选项来将未直接引用的祖先类包含在 WSDL/Schema 中。我们没有研究后者,因为这两个应用程序都在我们自己的控制之下,并且简单地添加“Ping”功能更容易。

The problem may not be on the import side, but rather on the export side. The situation we had:

  • A Delphi coded server application that also responds to SOAP webrequests.
  • A .Net coded client application that uses SOAP to communicate with the Delphi server application.

The Delphi server application would not and will not export a specific (base) type in its WSDL response if that (base) type is not used in any of the exported SOAP interfaces.

Example:

TBaseReponseClass = class(TRemotable)
end;

TLoginResponseClass = class(TBaseReponseClass)
end;

ISOAPResponse = interface(IInvokable)
['{SomeGUID}']
  function Ping: TBaseReponseClass ; stdcall
  function Login: TLoginResponseClass ; stdcall;
end;

With the Ping function in the ISOAPResponse, everything functions normally.

Without the Ping function in the ISOAPResponse, the TBaseResponseClass won't be exported in the WSDL and importing the WSDL on the .Net side would throw errors about undefined elements.

I suppose you can check the WSDL you got from your client to see whether it uses any classes for which one or more of classes in the ancestor hierarchy are not included in the WSDL/Schema. If this is the case, then you might have to go back to your clients to have them amend the interfaces. Or, if you are lucky, perhaps find some options to have ancestor classes that are not directly referenced included in the WSDL/Schema. We did not investigate the latter as we have both applications under our own control and it was easier to simply add the "Ping" function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文