2011-03-14 41 views
2

作为导入Web服务以与其系统进行互操作的一部分,我从客户端收到了一个WSDL。他们发送了两个文件:一个WSDL和一个模式。当我运行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的进口线看起来是这样,但它并没有改变什么:

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

如何设置这种不当使德尔福的WSDL导入向导会检查我的本地系统上的模式文件并从中读取类型定义?

+0

我还没有尝试过,但在WSDL导入程序中有一个选项。 '包含进程和导入模式'。听起来像你需要的东西。默认打开,所以你可能已经有了。 – 2011-03-14 18:48:37

+0

在使用我们自己的服务和客户时,我们在工作中遇到了这样的麻烦。这与D2010导入拒绝非标准类型的元素有关,即使它们在名称空间中被明确定义。我认为他们通过在soap界面中使用标准数据类型来解决这个问题。如果您明天早上(UTC + 1)还没有找到答案,我会与同事核对。 – 2011-03-14 18:49:56

+0

@duffymo:请仔细阅读问题。我没有在问题中包含WSDL,只是(输出的匿名版本)。这特别是一个Delphi WSDL Importer问题;不是WSDL/XML问题。 – 2011-03-14 18:52:18

回答

0

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

  • 一个Delphi编码的服务器应用程序,它也响应SOAP webrequests。
  • 一个.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平功能,一切都正常工作。

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

我想你可以检查你从客户端获得的WSDL,看它是否使用任何类,祖先层次中的一个或多个类不包含在WSDL/Schema中。如果是这种情况,那么你可能不得不回到你的客户,让他们修改接口。或者,如果你很幸运,也许会发现一些选项可以让祖先类不包含在WSDL/Schema中。我们没有对后者进行调查,因为我们有两个应用程序都在我们自己的控制之下,并且简单地添加“Ping”功能更容易。