Overview
A Web service client is a client-side application that accesses a Web service hosted on a server. Communication between the client machine and host server typically occurs over the Internet using the HTTP protocol. Communication can be direct, or client requests and server responses can be routed through a series of gateways, proxy servers, and tunnels.
DataDirect XQuery provides two types of built-in functions to help you write Web service clients – ddtek:wscall and DataDirect HTTP functions.
- ddtek:wscall allows you to invoke a Web service operation synchronously using the SOAP protocol over HTTP.
- DataDirect XQuery provides full implementation of all HTTP methods like GET, POST, PUT, and DELETE. DataDirect XQuery HTTP functions provide a superset of the functionality available with ddtek:wscall, allowing more control at a lower level than is possible with ddtek:wscall.
Choosing a Function Type
Deciding whether to use ddtek:wscall or HTTP functions for your XQuery Web service client depends on a number of factors, the most basic of which is understanding which protocols the Web service supports. For example, if the XQuery Web service supports HTTP, then you must write the XQuery Web service client using HTTP functions. On the other hand, if the XQuery Web service supports SOAP, then you can use either HTTP functions or ddtek:wscall.
Other factors you should consider when designing your XQuery Web service client application include:
- Streaming – HTTP functions support streaming of both client-side requests and server-side responses. Streaming is an important consideration for Web service client applications that involve processing large XML documents – when streaming is not used, all data is read into memory before the function is invoked.
See Data Streaming for more information on this topic.
- Client-server connection – The DataDirect XQuery implementation of HTTP functions allows a level of control over the parameters that affect the client-server connection that is not possible using ddtek:wscall. Examples of these parameters include specifying the number of retries, socket timeout, and cookie policy management.
See HTTP Functions <request> Element for more information about specific HTTP parameters.
If the origin server uses REST or plain XML, or if you require direct control over the Web service payload or client-server connection, consider using the DataDirect XQuery HTTP functions to build your XQuery Web service client.