com.bowstreet.builders.webapp.methods
Class ServiceCallMethods

java.lang.Object
  extended by com.bowstreet.builders.webapp.methods.ServiceCallMethods

public class ServiceCallMethods
extends java.lang.Object

This is the LJO for the WebApp ServiceCall. To invoke the ServiceCall in the webapp (if the ServiceCall builder name is ws): webAppAccess.callMethod("ws.invoke"); Setters on the LJO populate the requestVariable object which is a ServiceCallMethodsData object that the builder regen set up. This is 'cos this LJO is created at regen time so one instance is shared by everyone so we cannot keep state in here. The reply populates the replyVariable and the replyStatusVariable. The developer should not know about the replyStatusVariable or the requestVariable, access to those objects should be through this LJO.


Field Summary
static java.lang.String HTTP_REQUEST
           
static java.lang.String LOCAL_REQUEST
           
static java.lang.String SOAP_REQUEST
           
 
Constructor Summary
ServiceCallMethods()
           
 
Method Summary
 java.util.List getCookies()
          Return unparsed List of response cookie strings (unparsed meaning they may have the form "name=val; path=/; domain=foo")
 java.lang.String getCookieValue(WebAppAccess webAppAccess, java.lang.String getCookieName)
           
 java.lang.String getRequestEnvelope()
           
 java.lang.String getResponseContentType(WebAppAccess webAppAccess)
           
 java.lang.String getResponseEnvelope()
           
 void init(WebAppAccess webapp, java.lang.String dataVariableName, java.lang.String replyVariableName, java.lang.String replyHeadersVariableName)
          Picks up the builder-specific data from the variables whose names are passed in, and populates the instance data in this ServiceCallMethods object.
 java.lang.Object invoke(WebAppAccess webapp)
          Issues the service call based on the data in the instance variables.
 java.lang.Object invokeInternal(WebAppAccess webapp)
          This method should never be called directly.
 void setAddHtmlDocumentWrapper(boolean b)
          Overrides the indicator set in the builder inputs to add a htmlDocument wrapper element.
 void setForceStringReturnToIXML(boolean b)
          Forces a xsd:string reply to be treated as XML.
 void setLogLevel(java.lang.String level)
          Overrides the level set in the builder inputs.
 void setStubResult(java.lang.String s)
          Overrides the indicator set in the builder inputs to set a dummy reply.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_REQUEST

public static final java.lang.String HTTP_REQUEST
See Also:
Constant Field Values

LOCAL_REQUEST

public static final java.lang.String LOCAL_REQUEST
See Also:
Constant Field Values

SOAP_REQUEST

public static final java.lang.String SOAP_REQUEST
See Also:
Constant Field Values
Constructor Detail

ServiceCallMethods

public ServiceCallMethods()
Method Detail

getCookies

public java.util.List getCookies()
Return unparsed List of response cookie strings (unparsed meaning they may have the form "name=val; path=/; domain=foo")

Returns:
cookie List or null if no cookies for this type of request

getCookieValue

public java.lang.String getCookieValue(WebAppAccess webAppAccess,
                                       java.lang.String getCookieName)

getRequestEnvelope

public java.lang.String getRequestEnvelope()

getResponseContentType

public java.lang.String getResponseContentType(WebAppAccess webAppAccess)

getResponseEnvelope

public java.lang.String getResponseEnvelope()

init

public void init(WebAppAccess webapp,
                 java.lang.String dataVariableName,
                 java.lang.String replyVariableName,
                 java.lang.String replyHeadersVariableName)
Picks up the builder-specific data from the variables whose names are passed in, and populates the instance data in this ServiceCallMethods object. The OnModelLoad handler set up by the ServiceCall builder instantiates a ServiceCallMethods object and then calls this init method giving us the webapp and the variables we need. The dataVariable holds the source data for our service call (resulting from regen). We pick that up now and put it in instance variables, whereafter we can receive calls to setTimeout, setURL etc to override.

Parameters:
webapp - the WebApp instance we're associated with
dataVariableName - the name of the variable in the webapp that holds a ServiceCallMethodsData object holding the builderinputs
replyVariableName - the name of the variable into which we will pass a reference to the data coming back from the
replyHeadersVariableName - name of the var to save response hdrs in invoke method.

invoke

public java.lang.Object invoke(WebAppAccess webapp)
                        throws java.lang.ClassNotFoundException,
                               java.net.MalformedURLException,
                               java.net.UnknownHostException,
                               com.bowstreet.util.parser.ParserException,
                               java.io.IOException,
                               java.lang.Exception
Issues the service call based on the data in the instance variables. The data result of the request is returned, or an exception is thrown.

Parameters:
webapp - the webapp instance from which we're being invoked
Throws:
java.lang.ClassNotFoundException - if the class specified for an argument is invalid
java.net.MalformedURLException - if the supplied URL is invalid
java.net.UnknownHostException - if the supplied URL is invalid
com.bowstreet.util.parser.ParserException - if the response HTML is malformed
java.io.IOException - is the response HTML is invalid
java.lang.Exception - if a SOAP failure occurred

invokeInternal

public java.lang.Object invokeInternal(WebAppAccess webapp)
This method should never be called directly. It should only be called internally from the invoke. It's public in order that it can be visible to the pickers and thus allows it to be set as the action in a Cache Control builder, allowing the ServiceCall internals to be cached, and allowing the ServiceCall side-effects (setting up the reply variable) to take place.

Parameters:
webapp - the webapp instance from which we're being invoked
Returns:
the service call result

setAddHtmlDocumentWrapper

public void setAddHtmlDocumentWrapper(boolean b)
Overrides the indicator set in the builder inputs to add a htmlDocument wrapper element.

Parameters:
b - true/false indicator to enable/disable logging of the request and response.

setForceStringReturnToIXML

public void setForceStringReturnToIXML(boolean b)
Forces a xsd:string reply to be treated as XML.

Parameters:
b - true/false indicator to set/unset this behaviour.

setLogLevel

public void setLogLevel(java.lang.String level)
Overrides the level set in the builder inputs. For backwards compat, "false" is none, "true" is just inputs and outputs, and "all" is everything.

Parameters:
level -

setStubResult

public void setStubResult(java.lang.String s)
Overrides the indicator set in the builder inputs to set a dummy reply.

Parameters:
s - the dummy response to return


Copyright © 2009 IBM. All Rights Reserved.