SOAP Web services APIs
Genero provides high-level and low-level APIs for creating SOAP Web services.
High-level and low-level SOAP APIs
SOAP APIs are identified as high-level or low-level. They each offer solutions for different scenarios. The high-level APIs are specially-designed classes to implement your Web service's function with minimal coding, while low-level APIs use standard HTTP classes. A summary of the classes are described next.
- SOAP high-level APIs classes
-
Note: If you have generated code via the fglwsdl tool (client and server side), these high-level APIs are automatically used.
- The
com.WebServices
class is used to implement a Web service on the server. Instances of this class are used to create a Web service that can be stateless or stateful. Object methods for registering HTTP headers for request and response handling, and generating the WSDL are provided by this class. - The
com.WebOperation
class provides for the interface to create and manage the operations of a Web service. Instances of this class are used to create different style options (Document or RPC) and the encoding mechanism (literal or encoded) for the service. Object methods for this class are used to set the headers, action, and encoding. A stateful Web service can also be initiated by this class. - The
com.WebServiceEngine
class provides an interface to manage the Web Services engine. Instances of this class are used to start the service and handle HTTP requests. This class also handles request faults, timeout, and cookie options for both client and server.
- The
- SOAP low level APIs classes
-
Web services can be implemented with the
HTTPRequest
,HTTPResponse
, andHTTPServiceRequest
classes, but you have to write all the HTTP code of your services by hand.
When to use high-level SOAP APIs
The recommendation is to use the high-level APIs wherever possible to implement SOAP Web services because High-level APIs require less code in your application. They provide functionality that would otherwise need to be handled with many low-level API calls. They are therefore easier to use in comparison with low-level APIs.
You can perform a defined set of simple functions with one call to a high-level API. The global
endpoint user-defined type (tGlobalEndpointType
) generated by the WSDL stub, is
used by the high-level API. For example, you can set variables for the interface, binding, etc., in
the endpoint type record at runtime. For an example of this use see the Compression and a Web services client.
When to use low-level SOAP APIs
You may opt to use low-level APIs when there is a need for more detailed and granular control or you may opt to use them in specific scenarios because a high-level implementation may not yet be available.
For example, a request to send an attached file in separate parts of the request requires a low-level implementation of a multipart style SOAP request. For an example of this implementation see SOAP multipart style requests in GWS.