Portlet Factory, Version 6.1.2


 

Web Service Call builder

This builder is used to call a web service defined with WSDL (Web Services Definition Language).

You can also use it to make a simple HTTP request, but, if you are calling a REST service or RSS/ATOM feeds, the REST Service Call builder may be more convenient.

The inputs that the web service call builder call editor displays depend on the type of service you select in the builder call editor.

 

Key inputs

In the most common application of this builder, the WSDL call is used. In that case, use this input to complete the call:

  • WSDL URL

 

Key objects this builder creates

When used to create a WSDL call, the key objects this builder creates are:

  • Data service

    • input

    • results

 

More about this builder

Executing the service call

Call the serviceCallName.invoke() method. In a model method or in an linked Java object method, call the invoke() method on the linked Java object that the Web Service Call builder call adds to the model. This linked Java object has the same name as the web Service Call builder call. The code below shows how to invoke a service call defined by a Web Service Call builder call named getISBN:
webAppAccess.callMethod("getISBN.invoke"); 

Storing the outputs

The serviceCallName_reply variable stores the outputs of the service call. You can walk the results of the service call in the Choose Reference dialog when trying to use a value returned by the service call as an input to a builder call or as the value for an argument to an action.

Using SOAP headers

The serviceCallName_replyHeaders variable contains any SOAP headers stored in the SOAP response. SOAP headers are optional and not yet frequently used. And SOAP headers in SOAP response envelopes are used less often. It is expected that this variable value is not set under most common use cases.

Sending raw data

You can use the HTTP type of Web service call to send raw data. To do so, set a POST parameter called BODY_CONTENT. The supplied value is sent as the complete HTTP POST content of the request.

Examination of specific error information

If a web service call fails, you can retrieve the message for the SOAP fault. Rather than letting an error propagate to an error handler, you can examine specific error information on a web service call failure by implementing something similar to the following sample code.
    IXml returnValue = null;
    try {
        returnValue = (IXml)webAppAccess.callMethod("myservice.invoke");
        System.out.println("returnValue is: "+returnValue);
    }    catch (Exception e)
    {    // Note, actual exception may be wrapped in method call exception
        if (e instanceof com.bowstreet.util.WrappedException) {
         // If the method exception is wrapping another one, get the target exception
            Throwable se = ((com.bowstreet.util.WrappedException)e).getTargetException();
            String msg = se.getMessage();
            System.out.println("\nDEBUG: got " + msg);
         // Do something with the error message 
        } else { 
         // Do something with information from a generic exception
        }
    }

Parent topic: Builder help


Library | Support |