3

https://ourmail.server/ews/services.wsdlから wsdl ファイルをインポートすると、生成されたサービスで「WSDL ドキュメントで参照されている次のタイプは、このファイルで表現されていません」というメッセージが大量に表示されました。パス。
次に、wdsl ファイルをディスクにダウンロードし、http://schemas.microsoft.com/exchange/services/2006/messagesおよびhttp://schemas.microsoft.com/exchange/services/2006/typesを参照し、ダウンロードしたことを確認しましたhttps://ourmail.server/ews/types.xsdおよびhttps://ourmail.server/ews/messages.xsd から services.wdsl の開始を変更しました

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:s="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="messages.xsd"/>
        </xs:schema>
    </wsdl:types>

に:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:s="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="file://d:/testing/web/exchange web services/types.xsd"/>
            <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="file://d:/testing/web/exchange web services/messages.xsd"/>
        </xs:schema>
    </wsdl:types>

生成された services.pas には、次のエラー (のみ) が含まれています。

// ************************************************************************ //
// 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.
// ************************************************************************ //
// !:double          - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:duration        - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:time            - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:base64Binary    - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:boolean         - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:int             - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:language        - "http://www.w3.org/2001/XMLSchema"[Hdr][Gbl]
// !:dateTime        - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:lang            - "http://www.w3.org/2001/XMLSchema"[GblAttr]
// !:nonNegativeInteger - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:anyURI          - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:short           - "http://www.w3.org/2001/XMLSchema"[Gbl]

これらを解決するには、どの「xs:import」行を追加できますか?
W3C の datatypes.xsd と structure.xsd を検索して同じ方法を試しましたが、うまくいきません。

4

2 に答える 2

1

Delphi および Free Pascal 用の Web Services Toolkitがあり、これには WSDL インポーターもあります。

たぶん、これで WSDL を処理できるので、試してみたいと思います。

于 2012-10-26T11:08:21.260 に答える
0

ファイル内の「表現されていない型」は問題ないことがわかりました。「後者のカテゴリの型は、通常、定義済み/既知の XML または Embarcadero 型にマップされる」が、これらの型のほとんどに当てはまるようです。nonNegativeInteger や Base64Binary などの「奇妙な」ものは、​​ソースの他の場所では使用されていません。

追加の注意: 初期 WDSL の指定に誤りがありました。その URL で証明書エラーが発生したため、依存ファイルをインポートできませんでした。証明書エラーなしで別の URL を試してみると、https://webmail.ourmailserver.nl/ews/messages.xsdhttps://webmail.ourmailserver.nl/ews/types.xsdが適切にインポートされ、その必要がなくなりました。ディスクからそれを行います。

生成されたファイルは、次の構造のため、最初はコンパイルされません。

type

ProtectionRuleAllInternalType = string;      
ProtectionRuleTrueType = string;   

ProtectionRuleConditionType = class(TRemotable)
private
  FAllInternal: ProtectionRuleAllInternalType;
  FAllInternal_Specified: boolean;
  procedure SetAllInternal(Index: Integer; const AProtectionRuleAllInternalType: ProtectionRuleAllInternalType);
public
published
  property True: ProtectionRuleTrueType;
end;

procedure ProtectionRuleConditionType.SetAllInternal(Index: Integer; const AProtectionRuleAllInternalType: ProtectionRuleAllInternalType);
begin
  FAllInternal := AProtectionRuleAllInternalType;
  FAllInternal_Specified := True;
end;

セッターでは、ブール値が意味されますが、コンパイラはそれが公開された適切な名前の True であると見なし、「互換性のない型」を発行します。「FAllInternal_Specified := True;」を変更しました。「FAllInternal_Specified := System.True;」に

同様に、発行された 2 つのプロパティ Create があり、コンパイラは、これらが基本呼び出し内のプロパティをオーバーライドするコンストラクタであると認識します。名前を MyCreate に変更しました。

これにより、生成されたファイルがコンパイルされます。

于 2012-10-31T12:23:06.790 に答える