Web Service Basics: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
Creating a page to hold a series of simple "how-to" mechanism so as to avoid cluttering other text with them.
 
mNo edit summary
Line 2: Line 2:


====Creating a WebApp Project====
====Creating a WebApp Project====
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Project => Web Project</span>.
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Project => Web Project</span> and follow the wizard's instructions.


====Creating a Web Service Object====
====Creating a Web Service Object====
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Web Object => Web Service Object</span>.
In the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Web Object => Web Service Object</span> 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]] <nowiki><documentation></nowiki> 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 <u>no requirement</u> 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 <nowiki><documentation></nowiki> 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====
====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 the [[Visual DataFlex Studio]], select <span style="color:blue; font-weight:bold">File => New => Class => Client Web Service Class</span>.

Revision as of 17:40, 21 November 2007

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.