2012-09-26 51 views
3

我正嘗試在C#中創建一個WCF服務,供使用由Delphi構建的客戶端應用程序使用。在Delphi中下載WSDL時,Delphi生成的文件中不包含任何對象。Delphi:未包含在WSDL文件中的WSDL對象

當我導入到Delphi中時,我需要在C#中聲明WSDL中的對象嗎?

編輯

我使用的EntityFramework在C#中生成從數據庫中的類(這是一個現有的數據庫,所以請不要告訴我,我應該首先做的代碼)。下面是類文件的一個示例:

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)。

END EDIT

這裏是所生成的文件的一個片段(無創建的對象):

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; 
+1

您是否閱讀過有關未創建類型的文件頂部的大註釋塊以及它們的列表?它解釋了爲什麼它們沒有被創建 - 因爲領先的'!',它們從未被聲明過。該評論指出,這可能表示未能聲明或導入模式的錯誤WSDL文檔。您的服務是否聲明瞭模式或從某處導入了模式?所有跳過的類都使用'tempuri.org'。 –

+0

我看到了那條評論,這就是爲什麼我假設我必須在C#中做一些聲明才能生成這些對象。 – BrianKE

+0

但是你沒有發佈任何來自你的C#,我們可以看出來找出你錯過了什麼...... ??? 「我明白我錯過了一些東西,但我不會告訴你我到目前爲止的情況,請告訴我我需要做些什麼來解決它。」 - 這是你的問題嗎? –

回答

0

該文件頂部的大註釋塊解釋了未被創建的類型以及米它解釋了爲什麼他們沒有創建 - 因爲領先的!,這表明他們從未宣佈。

註釋說這可能表示未能聲明或導入架構的WSDL文檔不正確。您的服務是否聲明瞭模式或從某處導入了模式?所有跳過的類都使用tempuri.org,它不會成爲您的服務中使用的有效命名空間。

+0

感謝所有的評論,請參閱編輯原始帖子,如果有任何其他信息可以幫助解決這個問題,我很樂意提供,而不是 – BrianKE

+0

忘了提及我在整個項目中搜索了'tempuri',並且唯一找到它的地方是在一個名爲SdrConfigExample.e2e的文件中,它是一個生成的文件。 – BrianKE