Consuming Web Service in Delphi 2009

I have used Delphi 2009 to WSDL import. The resulting unit is as follows; How do i consume this web service. All i need is some basic code to get me started. Please help.

// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://41.215.25.243:8000/sap/bc/srt/rfc/sap/zfi_customer_balance?sap-client=555&wsdl=1.1
//  >Import : http://41.215.25.243:8000/sap/bc/srt/rfc/sap/zfi_customer_balance?sap-client=555&wsdl=1.1>0
// Encoding : utf-8
// Version  : 1.0
// (5/26/2009 4:42:00 AM - - $Rev: 16699 $)
// ************************************************************************ //

unit zfi_customer_balance1;

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.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]

  ZfiCustomerBalance   = class;                 { "urn:sap-com:document:sap:soap:functions:mc-style"[GblElm] }
  ZfiCustomerBalanceResponse = class;           { "urn:sap-com:document:sap:soap:functions:mc-style"[GblElm] }



  // ************************************************************************ //
  // XML       : ZfiCustomerBalance, global, <element>
  // Namespace : urn:sap-com:document:sap:soap:functions:mc-style
  // ************************************************************************ //
  ZfiCustomerBalance = class(TRemotable)
  private
    FPKunnr: string;
  published
    property PKunnr: string  read FPKunnr write FPKunnr;
  end;



  // ************************************************************************ //
  // XML       : ZfiCustomerBalanceResponse, global, <element>
  // Namespace : urn:sap-com:document:sap:soap:functions:mc-style
  // ************************************************************************ //
  ZfiCustomerBalanceResponse = class(TRemotable)
  private
    FPBalance: string;
  published
    property PBalance: string  read FPBalance write FPBalance;
  end;


  // ************************************************************************ //
  // Namespace : urn:sap-com:document:sap:soap:functions:mc-style
  // ************************************************************************ //
  zfi_customer_balance = interface(IInvokable)
  ['{12AA8652-732C-FF34-7557-A071D7BCE9FB}']
    function  ZfiCustomerBalance(const parameters: ZfiCustomerBalance): ZfiCustomerBalanceResponse; stdcall;
  end;



implementation
  uses SysUtils;

initialization
  InvRegistry.RegisterInterface(TypeInfo(zfi_customer_balance), 'urn:sap-com:document:sap:soap:functions:mc-style', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(zfi_customer_balance), '');
  RemClassRegistry.RegisterXSClass(ZfiCustomerBalance, 'urn:sap-com:document:sap:soap:functions:mc-style', 'ZfiCustomerBalance');
  RemClassRegistry.RegisterXSClass(ZfiCustomerBalanceResponse, 'urn:sap-com:document:sap:soap:functions:mc-style', 'ZfiCustomerBalanceResponse');

end.
0
bernard
5/26/2009 3:51:30 AM
embarcadero.delphi.webservices 976 articles. 0 followers. Follow

1 Replies
926 Views

Similar Articles

[PageSpeed] 10

The importer generated an interface that inheritets from IInvokable.
In this interface is the only function of the webservice which returns a ZfiCustomerBalanceResponse.

>   // ************************************************************************ //
>   // Namespace : urn:sap-com:document:sap:soap:functions:mc-style
>   // ************************************************************************ //
>   zfi_customer_balance = interface(IInvokable)
>   ['{12AA8652-732C-FF34-7557-A071D7BCE9FB}']
>     function  ZfiCustomerBalance(const parameters: ZfiCustomerBalance): ZfiCustomerBalanceResponse; stdcall;
>   end;

Now you need a object of type THTTPRIO to access this function.
In previous versions of Delphi there was function generated from the wsdl importer which helped a lot to understand what is needed to call the webservice. I dont know if there is a option in the importer of D2009 to create this function.

Here is a sample of an inported WSDL. ITestWebService stands for your zfi_customer_balance.
The GetITestWebService returns the interface that can be used to call the function. 

  ITestWebService = interface(IInvokable)
  ['{A492B7CF-2D0B-1CBC-AD5F-B10807FB9B8B}']
    function  echoDouble(const Value: Double): Double; stdcall;
  end;

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


implementation
  uses SysUtils;

function GetITestWebService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ITestWebService;
const
  defWSDL = 'http://testserver/cgi-bin/DEV/Project25.exe/wsdl/ITestWebService';
  defURL  = 'http://testserver/cgi-bin/DEV/Project25.exe/soap/ITestWebService';
  defSvc  = 'ITestWebServiceservice';
  defPrt  = 'ITestWebServicePort';
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 ITestWebService);
    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;

Edited by: Christian Loidl on May 26, 2009 12:13 AM
0
Christian
5/26/2009 7:14:12 AM
Reply:

Similar Artilces:

Consuming a .NET web service in Delphi 2010 using a service reference
Hi, I've been asked to modify one of my existing applications (D2010 Win32) to interact with a web service written under VS2010/.Net 4. The information I have so far is :- "As communication is secured by .NET WsHttpBinding data encrypting, In order to consume it you have to add to your application a Service Reference (not a web reference) that joins the service available at the URL: http://ctm.mobilling.it/SmsComApi/Sms.svc . Assuming that the binding created in your app.confing is named "WSHttpBinding_ISms" you have to instantiate a client as shown below: {c...

Consuming WCF services from Delphi 2009
Hi, We have problem consuming a webservice from Delphi 2009. If we publish the service as pure ASMX it works just fine, but we want to use the new SVC-file.We have published a simple service, which Delphi should be able to consume: http://webservices.uvdata.net/wcfdelphitest/testservice.svc?wsdl Unfortunately when Delphi generates the code it doen't translate the WSDL correctly - i.e. testservice.GetITestService().Echo() shouldn't take a parameter of type Echo. Can you please explain what happens ? Regards Jan Jensen ...

Problem upgrading web service client from Delphi 7 to Delphi XE
In trying to upgrade our web service client to Delphi XE we have now get a web service error of Invalid Format. When we examine the SOAP request we see the following differences from Delphi 7 vs Delphi XE In Delphi 7 we get <SomeStuff xmlns="" xsi:nil="true" /> In Delphi XE we get <SomeStuff xsi:nil="true" /> We have narrowed the failure down to these differences in the client request. Is there anyway to get Delphi XE to generate a SOAP request with the xmlns attribute set to blank as it used to be? Hello, > In trying to u...

How to consume a Delphi web service in asp.net ?
Can anyone tell us how to consume a delphi web service in asp.net Thanks in advance Bryan If you are consuming the web service you should be able to do it just as you would a web service created using ASP.NET. If you are using Visual Studio .NET you should add a Web Reference to your project. Otherwise, you should use WSDL.exe to generate a proxy.Daniel Richardson...

delphi 2009 web service parameter as xml
Hi I'm trying to make a web service function with a xml as parameter. I don't want to make the parameter as a string, instead I want to add the xml schema to the wsdl, so that the client program gets the schema and requests the function with a proper xml. Could somebody help me? On 03.03.2010 20:54, vesa tuominen wrote: > I'm trying to make a web service function with a xml as parameter. I don't want to make the parameter as a string, instead I want to add the xml schema to the wsdl, so that the client program gets the schema and requests the function with a proper xm...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Has anyone successfully used a Delphi web service client against an ENCRYPTED WCF web service server?
Has anyone successfully used a Delphi web service client against an ENCRYPTED WCF web service server? Which is to say, of course, that the URL would be starting with https. Anyone? ...

Out Of Memory error after converting web services from Delphi 7 to 2009
Hello All I have a set of Web Services written in Delphi 7 which I now compiled with D2009 to be able to use unicode. They use MySql on the server and return invokable objects instead of XML docs. The only change I had to make was the library/vendorlib properties for the MySql connection. The client was also converted from D7 to D2009. All services now give me a 'Out Of Memory error' on the client. Any ideas? Thanks Dolf It's a strange error, but you might try to re-import the wsdl from the D2009 importer. Perhaps things have changed. albert <Dolf vanEnk> ...

Trying to use MS TAG API Web Services with Delphi 2009
Can anyone please advise who to solve my problem with MS TAG API. Extract from my code is: procedure TForm1.TagCategoryActivate; var lv_Contract :IMIBPContract; lv_Client :ActivateCategory; lv_Resp :ActivateCategoryResponse; begin try lv_Contract := GetIMIBPContract(false, '', HTTPRIO1); lv_Client := ActivateCategory.Create; lv_Client.userCredential := UserCredential.Create; lv_Client.userCredential.AccessToken := cv_AccessToken; lv_Client.categoryName := 'CatName123'; lv_Resp := lv_Contract....

Delphi 2006 XML Validation w/ XSD Schemas by Consuming ASMX Web Service
Utilizing Delphi 2006, is there a straight forward method of validating a CCD and/or CCR xml with a corresponding schema? Here are some samples which work at http://xreg2.nist.gov/cda-validation/mu.html: - http://www.selectayacht.com/validation/NoInfoNoErrors.xml - http://www.selectayacht.com/validation/SomeContentNoErrors.xml - http://www.selectayacht.com/validation/LotsofContentNoErrors.xml Here is a sample with four errors: - http://www.selectayacht.com/validation/4errors.xml I am unable to achieve the same results however attempting to perform validatio...

Delphi 2007 to Delphi 2009 Conversion
CharArrayPtr = ^CharArray; CharArray = array[0..MaxInt-1] of Char; How to convert to Delphi 2009? Bill Bill Miller wrote: > CharArrayPtr = ^CharArray; > CharArray = array[0..MaxInt-1] of Char; > > How to convert to Delphi 2009? > > Bill it depends heavelly on how it is used fearther down in your project and what you want to convert it to. I you want to simple convert the declarations ignoring UNicode altogether then the only think you have to change is the CharArray declaratin from a Char to an AnsiChar eg CharArrayPtr = ^CharArray; CharArray =...

Delphi 7 to Delphi 2009 conversion
Hello group, What do I need to do to comile the following code in D2009. Compiler error after the Else E2010: Incompatible Types 'AnsiChar' and 'Char' if isUnicode then SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) else SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> Regards, Bryan > What do I need to do to comile the following code in D2009. > Compiler error after the Else > E2010: Incompati...

Delphi 2009 alongside Delphi 2007
Hi all, I am about to install Delphi 2009 on the same development system as Delphi 2007, before I embark is there anything I should be aware of so as to not break my Delphi 2007 installation and projects ? Thanks JT John Taylor wrote: > Hi all, > > I am about to install Delphi 2009 on the same development system > as Delphi 2007, before I embark is there anything I should be aware > of so as to not break my Delphi 2007 installation and projects ? As long as you install into a separate folder there is no problem with the two versions getting into each other...

Web resources about - Consuming Web Service in Delphi 2009 - embarcadero.delphi.webservices

Tumblr : How do teenagers waste hours upon hours consuming Tumblr?
Answer (1 of 6): I am a teenager and also have a fascination with Tumblr. I will try my best to explain this from our perspective as teens. This ...

Are You Consuming Your Coffee Correctly? - YouTube
Have you been doing it wrong? The Scientific Smell Challenge: https://youtu.be/bI5HEl3u848 SUBSCRIBE (it's free!): http://bit.ly/asapsci GET ...

Briton sentenced to four years for consuming hashish in Dubai
... to having 6.4 grams of the drug for his personal use and he will be deported after serving his sentence. DUBAI // A Briton charged with consuming ...

Eating meat is hurting the environment - stop consuming so much, top US nutritional panel says
The country's foremost nutrition advisory panel is taking a stand against meat: Americans should eat less of it, top experts say, in order to ...

Teen love shown to be most consuming
BACK in 1965, Cat Stevens wrote The First Cut is the Deepest. It turns out he was right. New research from a joint American and Australian study ...

With legal marijuana, more little kids are accidentially consuming drug
Children's rates of exposure to marijuana have increased, even in US states where the drug has not been legalised.

Australians falling short on calcium intake and consuming too much sodium, survey finds
Australians aren't getting enough calcium from their food and most are consuming too much sodium, a new national survey has found.

Canadians consuming sky-high amounts of sodium, study finds
Canadians are consuming potentially dangerous amounts of sodium and Ottawa must take action to limit those levels, a leading expert on heart ...

13 Causes Of Insomnia, From Work Stress To What You're Consuming
After a long day, the only thing you want to do is crawl into bed for a good night's rest. Unfortunately, for 3.3 million Canadians, that isn't ...

Consuming Walker - AdPulp - AdPulp
It’s Sunday, which means it time to open The New York Times Magazine and read “Consumed,” the weekly column by Rob Walker. Today’s piece is about ...

Resources last updated: 12/15/2015 10:57:25 PM