Interface WebServiceResource

All Superinterfaces:
Element, Resource, java.io.Serializable, XmlResourceBase

public interface WebServiceResource
extends XmlResourceBase
The WebServiceResource interface represents an Web Service Resource. A Web Service Resource is used to call a web service, either locally or remotely.

Further documentation.

Since:
V4.4
  • Method Summary

    Modifier and Type Method Description
    void call()
    Calls the default adapter specified on the Web Service Resource.
    void call​(java.lang.String adapterName)
    Calls the adapter specified by adapterName on the Web Service Resource.

    Methods inherited from interface com.ebasetech.xi.api.Element

    getElementName, getElementType

    Methods inherited from interface com.ebasetech.xi.api.Resource

    isDebug, setDebug

    Methods inherited from interface com.ebasetech.xi.api.XmlResourceBase

    fetch, getDocument, setDocument, update
  • Method Details

    • call

      void call() throws com.ebasetech.xi.exceptions.FormRuntimeException, com.ebasetech.xi.exceptions.SoapFaultException
      Calls the default adapter specified on the Web Service Resource. When this is a Web Services Adapter, the web service is called. Note that different adapters support different methods and not all adapters support this method.

      Before the call request is processed, the update() method is called internally - this transfers any non-tabular field data to the resource from mapped form fields . After the call request is processed, the fetch() method is called internally - this transfers any non-tabular field data from the resource to mapped form fields.

      If the resource is mapped to tables in the form, resource data must be updated prior to invoking this method; this is done using the updateTable() method on all relevant tables. Similarly, any tables resulting from the call should be fetched after invoking this method using the fetchTable() method.

      Further documentation.

      Javascript example:

       // update the BOOKS_REQUEST table in the request document
       tables.BOOKS_REQUEST.updateTable();
       // call the web service
       try {
         resources.BOOKS_WS.call();
       }
       catch (e if e.javaException instanceof com.ebasetech.xi.exceptions.SoapFaultException)
       {
         log(e.javaException.message);
       }
       // load the BOOKS table from the response document 
       tables.BOOKS.fetchTable();
       
      Specified by:
      call in interface XmlResourceBase
      Throws:
      com.ebasetech.xi.exceptions.SoapFaultException - if the web service returns a SOAP Fault or if a client SOAP Fault is generated because it is not possible to connect to the web service
      com.ebasetech.xi.exceptions.FormRuntimeException - if any other error occurs during execution
      Since:
      V4.4
      See Also:
      call(String)
    • call

      void call​(java.lang.String adapterName) throws com.ebasetech.xi.exceptions.FormRuntimeException, com.ebasetech.xi.exceptions.SoapFaultException
      Calls the adapter specified by adapterName on the Web Service Resource. Note that different adapters support different methods and not all adapters support this method.

      Before the call request is processed, the update() method is called internally - this transfers any non-tabular field data to the resource from mapped form fields . After the call request is processed, the fetch() method is called internally - this transfers any non-tabular field data from the resource to mapped form fields.

      If the resource is mapped to tables in the form, resource data must be updated prior to invoking this method; this is done using the updateTable() method on all relevant tables. Similarly, any tables resulting from the call should be fetched after invoking this method using the fetchTable() method.

      Further documentation.

      Javascript example:

       // update the BOOKS_REQUEST table in the request document
       tables.BOOKS_REQUEST.updateTable();
       // call the web service
       try {
         resources.BOOKS_WS.call("ADAPTER1");
       }
       catch (e if e.javaException instanceof com.ebasetech.xi.exceptions.SoapFaultException)
       {
         log(e.javaException.message);
       }
       // load the BOOKS table from the response document 
       tables.BOOKS.fetchTable();
       
      Specified by:
      call in interface XmlResourceBase
      Parameters:
      adapterName - the adapter to be called
      Throws:
      com.ebasetech.xi.exceptions.SoapFaultException - if the web service returns a SOAP Fault or if a client SOAP Fault is generated because it is not possible to connect to the web service
      com.ebasetech.xi.exceptions.FormRuntimeException - if any other error occurs during execution
      Since:
      V4.4
      See Also:
      call()