Web Service Basics

From DataFlex Wiki
Revision as of 17:40, 21 November 2007 by Mikepeat (talk | contribs)
Jump to navigationJump to search

Mechanisms

Creating a WebApp Project

In the Visual DataFlex Studio, select File => New => Project => Web Project and follow the wizard's instructions.

Creating a Web Service Object

In the Visual DataFlex Studio, select File => New => Web Object => Web Service Object and follow the wizard's instructions.

The psDocumentation property will be automatically set to some default text, but you should replace this with a description of your own service, as this will appear in the WSDL <documentation> element describing the service. There are several other properties which it now a good idea to set:

  • psServiceURI - this should be set to a unique URI; a good choice is something like "http://yourDomainName/projectName/serviceName - there is no requirement that it actually exist as a valid URL
  • psServiceName - this will be used to name the exposed web service object (.wso) and hence will be part of the "endpoint" URL of your service, so chose it with care
  • psServiceTitle - this will appear as the "display" name of the service in the human-readable HTML interface to the service

Publishing a Method

In the Code Explorer pane in the Visual DataFlex Studio, right-click on the method and select "Published" from the context menu. This will cause (a) the "Published" item to subsequently appear "checked", (b) a globe to appear next to the method's icon in Code Explorer and (c) the lines:

{ Published = True  }
{ Description = ""  }

to appear above the method declaration line. The Description should then be filled-in with something meaningful, as this will form the <documentation> element in the WSDL describing the method (operation in web service terminology). If you later chose to "unpublish" the method (uncheck "Published" on the context menu), the "True" will change to "False", however you could also just delete the two lines in braces, at the cost of losing anything you had written into the "Description" there.

Creating a Web Service Client

In the Visual DataFlex Studio, select File => New => Class => Client Web Service Class.