Share via


Calling Web Services

When you have your Web Service registered, you can add code to call Web Services in your source programs easily.

To call a Web Service in code

  1. In your Code editor, add a strong typed memory variable reference.

    ex. LOCAL oWS AS
    
  2. In the drop-down list of IntelliSense types and registered Web Services, select a Web Service that you have registered already.

    ex. LOCAL oWS AS MyWebService
    
  3. When you press the ENTER key, Web Service proxy code is added automatically to your source file. For example:

       LOCAL oWS AS MyWebService
       oWS = CREATEOBJECT("MSSOAP.SoapClient")
       oWS.MSSoapInit("http://www.myWebServices.com/vfpcalc.wsdl")
       * Add error handling here for failed call
    

At this point you have code to access the Web Service as well as to provide IntelliSense for discovery of available methods and their parameters. For example, typing the following line of code would display an IntelliSense list members drop-down list of available methods provided by that Web Service.

? oWS.

You can select an available method and continue typing to specify parameters. When you do so, as in the following example, an IntelliSense quick info tip displays parameters and the return type for that method.

? oWS.Add(

Note   You do not have to register a Web Service using the IntelliSense Manager to access it. If you do so, however, Visual FoxPro will provide IntelliSense for the Web Service methods and their parameters.

Refer to the Toolkit online documentation for more details on accessing Web Services through both high and low level calls.

See Also

Web Services Overview | Web Service Registration | Specifying a Web Service Default Location | Web Service Publishing | Web Service Deployment | Using the Web Services Project Hook