Web Service Basics: Difference between revisions

Web Service Client stuff
(Adding more...)
(Web Service Client stuff)
Line 75: Line 75:


===Creating a Web Service Client===
===Creating a Web Service Client===
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Class => Client Web Service Class</span>.
In order to create a [[Visual DataFlex]] web service client you must have access to the service's [[WSDL]] in some form.  This might be directly from the service itself - in [http://msdn2.microsoft.com/en-gb/webservices/default.aspx Microsoft .Net] or Visual DataFlex services this is the service's URL with "WSDL" appended as a [http://en.wikipedia.org/wiki/Query_string query string]: something like <span style="color:blue;"><nowiki>http://server/someService/service.wso?WSDL</nowiki></span> - or it might be an XML file provided by the service's developer or publisher which you have saved to a locally acessible file: <span style="color:blue;">C:\Services\Docs\someServiceWSDL.xml</span> - or it might be an XML/WSDL file statically published on a web site: <span style="color:blue;"><nowiki>http://server/services/wsdl/someService.xml</nowiki></span>.
 
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Class => Client Web Service Class</span>.  This will run the Web Service Client Class Generator.  Into its "WSDL URL" window paste (or type) the location (of whatever type) of the service's WSDL, then click the "Parse" button.  If this succeeds, then the "Generate Class" button will become available and can be clicked to create the client.  You should generally accept the default name and group.
 
====Using a Web Service Client Class====
The class created above will (by default) then appear within the [[Visual DataFlex Studio]] on the [[Class Palette]] pane under the "Web Services" group.  From there it can be dragged and dropped onto a visual component (a [[View]] or whatever) in the Studio's "Designer", creating an object of that class within the component.
 
This object - which we can think of as a "''stub''" or "''proxy''" for the web service itself - can then have its methods (which will map onto the ''operations'' of the service) invoked, passing them the appropriate data, to invoke the service itself, and receive any returned data from it.