3

Delphi を使用して構築されたクライアント アプリで使用するために、C# で WCF サービスを作成しようとしています。Delphi で WSDL をダウンロードすると、Delphi によって生成されたファイルにオブジェクトが含まれません。

Delphi にインポートするときに WSDL でオブジェクトを宣言するには、C# で何をする必要がありますか?

編集

C# で EntityFramework を使用して、データベースからクラスを生成しています (これは既存のデータベースだったので、最初にコードを作成する必要があるとは言わないでください)。以下は、クラス ファイルの 1 つの例です。

namespace LeadVendorModel
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;

    public partial class T_LeadVendorEmailDetail : DbContext
    {
        public int LeadVendorEmailDetailID { get; set; }
        public int LeadVendorEmailID { get; set; }
        public string Field_label { get; set; }
        public string Field_Data { get; set; }
        public Nullable<System.DateTime> EnteredOn { get; set; }

        public virtual T_LeadVendorEmailHeader T_LeadVendorEmailHeaders { get; set; }
    }
}

C# プロジェクトで「発行」アクションを使用してプロジェクトを発行しているだけです。Delphi が不平を言っている型/オブジェクトを他にどこで定義するかはわかりません。Web.config に追加する必要がある XML 設定はありますか?

他に何が役立つかわかりませんが、他に必要な情報を喜んで提供します(初めてEFを使用し、初めてAPIを作成します)。

編集終了

生成されたファイルのスニペットを次に示します (オブジェクトは作成されません)。

unit LeadService;

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 Borland types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:GetFranchiseDetails - "http://tempuri.org/"
  // !:GetFranchiseDetailsResponse - "http://tempuri.org/"
  // !:FranchiseExists - "http://tempuri.org/"
  // !:FranchiseExistsResponse - "http://tempuri.org/"
  // !:GetLeadDetails  - "http://tempuri.org/"
  // !:GetLeadDetailsResponse - "http://tempuri.org/"
  // !:GetLookupList   - "http://tempuri.org/"
  // !:GetLookupListResponse - "http://tempuri.org/"
  // !:SubmitLead      - "http://tempuri.org/"
  // !:SubmitLeadResponse - "http://tempuri.org/"
  // !:SubmitLeadAction - "http://tempuri.org/"
  // !:SubmitLeadActionResponse - "http://tempuri.org/"
  // !:SubmitLeadOutcome - "http://tempuri.org/"
  // !:SubmitLeadOutcomeResponse - "http://tempuri.org/"


  // ************************************************************************ //
  // Namespace : http://tempuri.org/
  // binding   : wsHttpBinding
  // service   : LeadService
  // port      : wsHttpBinding
  // ************************************************************************ //
  ILeadService = interface(IInvokable)
  ['{C61A5600-2BA8-436A-41AA-F81C45A9A738}']
    function  GetFranchiseDetails(const parameters: GetFranchiseDetails): GetFranchiseDetailsResponse; stdcall;
    function  FranchiseExists(const parameters: FranchiseExists): FranchiseExistsResponse; stdcall;
    function  GetLeadDetails(const parameters: GetLeadDetails): GetLeadDetailsResponse; stdcall;
    function  GetLookupList(const parameters: GetLookupList): GetLookupListResponse; stdcall;
    function  SubmitLead(const parameters: SubmitLead): SubmitLeadResponse; stdcall;
    function  SubmitLeadAction(const parameters: SubmitLeadAction): SubmitLeadActionResponse; stdcall;
    function  SubmitLeadOutcome(const parameters: SubmitLeadOutcome): SubmitLeadOutcomeResponse; stdcall;
  end;

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

オブジェクト定義を含む別の Delphi 生成ファイルの抜粋を次に示します。

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 Borland types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"
  // !:int             - "http://www.w3.org/2001/XMLSchema"
  // !:boolean         - "http://www.w3.org/2001/XMLSchema"
  // !:decimal         - "http://www.w3.org/2001/XMLSchema"
  // !:string          - "http://www.w3.org/2001/XMLSchema"

  CompanyID            = class;                 { "http://..." }
  Address              = class;                 { "http://..." }
  Property_            = class;                 { "http://..." }
  AppointmentRequest   = class;                 { "http://..." }


  { "http://..." }
  PersonServiceRoleID = (
      BuyersAgent, 
      SellersAgent, 
      SellersLawyer, 
      BuyersLawyer, 
      Seller,
      Buyer, 
      Owner, 
      Tenant, 
      TransactionCoordinator, 
      RelocationCoordinator, 
      ReferredBy,
      ContractorAdministrator, 
      InsuranceAgent, 
      Contractor,
      PropertyManagement, 
      Buyer1,
      Seller1, 
      Owner1, 
      Tenant1
);

  { "http://..." }
  PersonSearchCriteriaActiveType = (DeletedOnly, Both, UndeletedOnly);

  ArrayOfInt = array of Integer;                { "http://..." }


  // ************************************************************************ //
  // Namespace : http://...
  // ************************************************************************ //
  CompanyID = class(TRemotable)
  private
    FServiceCompanyID: Integer;
  published
    property ServiceCompanyID: Integer read FServiceCompanyID write FServiceCompanyID;
  end;


  // ************************************************************************ //
  // Namespace : http://...
  // soapAction: http://...
  // transport : http://schemas.xmlsoap.org/soap/http
  // binding   : CompanySoap
  // service   : Company
  // port      : CompanySoap
  // URL       : http://...
  // ************************************************************************ //
  CompanySoap= interface(IInvokable)
  ['{44A8B9BE-7E75-8534-279B-46BF5D1674D7}']
    function  GetAvailableAppointments(const appointmentRequest: AppointmentRequest; const companyID: CompanyID): ArrayOfAppointmentSlot; stdcall;
    function  GetQuote(const quoteRequest: QuoteRequest; const companyID: CompanyID): ServiceFee; stdcall;
    function  GetPropertyTypes(const companyID: CompanyID): ArrayOfPropertyType; stdcall;
    function  GetFoundationTypes(const companyID: CompanyID): ArrayOfFoundationType; stdcall;
    function  GetServiceTypes(const companyID: CompanyID): ArrayOfServiceType; stdcall;
    function  GetServiceProfessionals(const companyID: CompanyID): ArrayOfInspectorDetails; stdcall;
    function  ScheduleAppointment(const appointmentslot: AppointmentSlot; const customer: Contact; const companyID: CompanyID; const Quote: QuoteRequest; const agent: ArrayOfServiceAgent): AppointmentInfo; stdcall;
    function  FindAppointment(const contactID: Integer; const companyID: CompanyID): ArrayOfAppointmentInfo; stdcall;
    procedure CancelAppointment(const companyID: CompanyID; const appointmentID: Integer); stdcall;
    function  CustomerLookUp(const criteria: PersonSearchCriteria): ArrayOfContact; stdcall;
    function  AddContact(const customer: Contact; const companyID: CompanyID): Contact; stdcall;
    function  UpdateContact(const customer: Contact; const companyID: CompanyID): Contact; stdcall;
    function  ProcessCompanyID(const serviceCompanyID: CompanyID): CompanyID; stdcall;
  end;

function GetCompanySoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CompanySoap;
4

1 に答える 1

0

ファイルの上部にある大きなコメント ブロックは、作成されていないタイプとそれらのリストについて説明しています。なぜそれらが作成されなかったのかを説明しています - 先頭!に .

コメントは、スキーマの宣言またはインポートに失敗した誤った WSDL ドキュメントを示している可能性があると述べています。あなたのサービスはスキーマを宣言するか、どこかからスキーマをインポートしますか? スキップされたクラスはすべて tempuri.org を使用しますが、これはサービスで使用する有効な名前空間ではありません。

于 2012-09-27T12:26:12.587 に答える