Note that there are some explanatory texts on larger screens.

plurals
  1. POcan not add wcf service to delphi
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2473051/delphi-soap-envelope-and-wcf">Delphi SOAP Envelope and WCF</a> </p> </blockquote> <p>I have made a self hosted WCF application on C#. Binding method is <code>BasicHttpBinding (SOAP)</code>. Then I made client C# application that consumes the service, I added service reference with Visual Studio with no errors at all. Till here everything is fine. Problem occurs when I try to connect a Delphi 7 client. Here are steps I did:</p> <blockquote> <ol> <li>Created a new Application</li> <li>Dropped HTTPRIO component on the form</li> <li>With WSDL Importer Wizard imported service</li> <li>step 3 created a file, I named it as FRS.pas and saved.</li> <li>Added FRS to main applications "uses"</li> <li>Run application and get error message saying "[Error] FRS.pas(52): Undeclared identifier: 'GetOptions'" And "[Fatal Error] Unit1.pas(7): Could not compile used unit 'FRS.pas'"</li> </ol> </blockquote> <p>Here is generated code</p> <pre><code>// ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://localhost:933/FRS?wsdl // Encoding : utf-8 // Version : 1.0 // (29.11.2012 13:16:07 - 1.33.2.5) // ************************************************************************ // unit FRS; 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. // ************************************************************************ // // !:GetOptions - "http://tempuri.org/" // !:GetOptionsResponse - "http://tempuri.org/" // !:SetOptions - "http://tempuri.org/" // !:SetOptionsResponse - "http://tempuri.org/" // !:Beep - "http://tempuri.org/" // !:BeepResponse - "http://tempuri.org/" // !:GetStatus - "http://tempuri.org/" // !:GetStatusResponse - "http://tempuri.org/" // !:RegisterReceipt - "http://tempuri.org/" // !:RegisterReceiptResponse - "http://tempuri.org/" // !:RegisterBill - "http://tempuri.org/" // !:RegisterBillResponse - "http://tempuri.org/" // !:PrintReport - "http://tempuri.org/" // !:PrintReportResponse - "http://tempuri.org/" // ************************************************************************ // // Namespace : http://tempuri.org/ // soapAction: http://tempuri.org/IFRS/%operationName% // transport : http://schemas.xmlsoap.org/soap/http // binding : BasicHttpBinding_IFRS // service : FRS // port : BasicHttpBinding_IFRS // URL : http://localhost:933/FRS/soap // ************************************************************************ // IFRS = interface(IInvokable) ['{75F3494A-C58E-25D0-475B-CD49AEDABE03}'] function GetOptions(const parameters: GetOptions): GetOptionsResponse; stdcall; function SetOptions(const parameters: SetOptions): SetOptionsResponse; stdcall; function Beep(const parameters: Beep): BeepResponse; stdcall; function GetStatus(const parameters: GetStatus): GetStatusResponse; stdcall; function RegisterReceipt(const parameters: RegisterReceipt): RegisterReceiptResponse; stdcall; function RegisterBill(const parameters: RegisterBill): RegisterBillResponse; stdcall; function PrintReport(const parameters: PrintReport): PrintReportResponse; stdcall; end; function GetIFRS(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IFRS; implementation function GetIFRS(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IFRS; const defWSDL = 'http://localhost:933/FRS?wsdl'; defURL = 'http://localhost:933/FRS/soap'; defSvc = 'FRS'; defPrt = 'BasicHttpBinding_IFRS'; var RIO: THTTPRIO; begin Result := nil; if (Addr = '') then begin if UseWSDL then Addr := defWSDL else Addr := defURL; end; if HTTPRIO = nil then RIO := THTTPRIO.Create(nil) else RIO := HTTPRIO; try Result := (RIO as IFRS); if UseWSDL then begin RIO.WSDLLocation := Addr; RIO.Service := defSvc; RIO.Port := defPrt; end else RIO.URL := Addr; finally if (Result = nil) and (HTTPRIO = nil) then RIO.Free; end; end; initialization InvRegistry.RegisterInterface(TypeInfo(IFRS), 'http://tempuri.org/', 'utf-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IFRS), 'http://tempuri.org/IFRS/%operationName%'); InvRegistry.RegisterInvokeOptions(TypeInfo(IFRS), ioLiteral); end. </code></pre> <p>And Here is c# service interface</p> <pre><code>[ServiceContract] public interface IFRS { [OperationContract] string GetOptions(); [OperationContract] void SetOptions(string xml); [OperationContract] void Beep(); [OperationContract] string GetStatus(); [OperationContract] void RegisterReceipt(string xml); [OperationContract] void RegisterBill(string xml); [OperationContract] void PrintReport(string xml); } </code></pre> <p>As I can understand there is some compatibility issues, cause c# client works fine. I am not good at Delphi, but I must give a working sample. If anyone has faced this kind of problem, please help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload