org.jaggeryjs.modules.ws
Class WSRequestHostObject

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.jaggeryjs.modules.ws.WSRequestHostObject
All Implemented Interfaces:
Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class WSRequestHostObject
extends org.mozilla.javascript.ScriptableObject

Mozilla Rhino host Object Implementation of the WSRequest Specification.

See the WSRequest Host Object reference guide for more information.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
WSRequestHostObject()
          Constructor for the use by Rhino
 
Method Summary
 String getClassName()
          Returns the name to be used for this JavaScript Object.
static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr)
          Constructor the user will be using inside javaScript
static String jsFunction_getResponseHeader(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] arguments, org.mozilla.javascript.Function funObj)
           
static void jsFunction_open(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] arguments, org.mozilla.javascript.Function funObj)
          

This method prepares the WSRequest object to invoke a Web service.

static void jsFunction_openWSDL(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] arguments, org.mozilla.javascript.Function funObj)
          This function enables you to give a WSDL and get WSRequest configured.
static void jsFunction_send(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] arguments, org.mozilla.javascript.Function funObj)
          

This method invokes the Web service with the requested payload.

 org.mozilla.javascript.Scriptable jsGet_error()
          

Getter for the WebServiceError object

 org.mozilla.javascript.Scriptable jsGet_onreadystatechange()
          Getter for the 'onreadystatechange' javascript function.
 int jsGet_readyState()
          

Getter for the readyState property

 org.mozilla.javascript.Scriptable jsGet_responseE4X()
          Getter for the responseE4X property.
 String jsGet_responseText()
          Getter for the responseText property.
 org.mozilla.javascript.Scriptable jsGet_responseXML()
          Getter for the responseXML property.
 int jsGet_status()
           
 void jsSet_onreadystatechange(org.mozilla.javascript.Function function)
          Setter for the 'onreadystatechange' javascript function.
protected  void updateResponse(org.apache.axiom.om.OMElement response)
           
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, equivalentValues, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasInstance, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSRequestHostObject

public WSRequestHostObject()
Constructor for the use by Rhino

Method Detail

jsConstructor

public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx,
                                                              Object[] args,
                                                              org.mozilla.javascript.Function ctorObj,
                                                              boolean inNewExpr)
                                                       throws org.jaggeryjs.scriptengine.exceptions.ScriptException
Constructor the user will be using inside javaScript

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

getClassName

public String getClassName()
Returns the name to be used for this JavaScript Object.

Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject

jsFunction_open

public static void jsFunction_open(org.mozilla.javascript.Context cx,
                                   org.mozilla.javascript.Scriptable thisObj,
                                   Object[] arguments,
                                   org.mozilla.javascript.Function funObj)
                            throws org.jaggeryjs.scriptengine.exceptions.ScriptException

This method prepares the WSRequest object to invoke a Web service. This method corresponds to the following function of the WSRequest java script object.

   void open ( in object options | in String method, in String url [, in boolean async [, in
 String user [, in String password]]]);
 

See WSRequest host object reference & WSRequest specification for more details.

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

jsFunction_openWSDL

public static void jsFunction_openWSDL(org.mozilla.javascript.Context cx,
                                       org.mozilla.javascript.Scriptable thisObj,
                                       Object[] arguments,
                                       org.mozilla.javascript.Function funObj)
                                throws org.jaggeryjs.scriptengine.exceptions.ScriptException
This function enables you to give a WSDL and get WSRequest configured. You dont have to configure it your self using an options object.

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

jsFunction_send

public static void jsFunction_send(org.mozilla.javascript.Context cx,
                                   org.mozilla.javascript.Scriptable thisObj,
                                   Object[] arguments,
                                   org.mozilla.javascript.Function funObj)
                            throws org.jaggeryjs.scriptengine.exceptions.ScriptException,
                                   org.apache.axis2.AxisFault

This method invokes the Web service with the requested payload.

   void send ( [in Document payload | in XMLString payload | in XMLString payload ]);
 

See WSRequest host object reference & WSRequest specification for more details.

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException
org.apache.axis2.AxisFault

jsGet_responseText

public String jsGet_responseText()
Getter for the responseText property. The raw text representing the XML (or non-XML) response. If the responseXML property is empty, you can check the responseText property to see if a non-XML response was received.


jsGet_status

public int jsGet_status()
                 throws org.jaggeryjs.scriptengine.exceptions.ScriptException
Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

updateResponse

protected void updateResponse(org.apache.axiom.om.OMElement response)
                       throws XMLStreamException
Throws:
XMLStreamException

jsFunction_getResponseHeader

public static String jsFunction_getResponseHeader(org.mozilla.javascript.Context cx,
                                                  org.mozilla.javascript.Scriptable thisObj,
                                                  Object[] arguments,
                                                  org.mozilla.javascript.Function funObj)
                                           throws org.jaggeryjs.scriptengine.exceptions.ScriptException
Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

jsGet_responseE4X

public org.mozilla.javascript.Scriptable jsGet_responseE4X()
                                                    throws org.jaggeryjs.scriptengine.exceptions.ScriptException
Getter for the responseE4X property. The parsed E4X XML message representing the response from the service.

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

jsGet_responseXML

public org.mozilla.javascript.Scriptable jsGet_responseXML()
                                                    throws org.jaggeryjs.scriptengine.exceptions.ScriptException
Getter for the responseXML property. The parsed XML message representing the response from the service. Currently we return an E4X object. But ideally this needs to be a DOM.

Throws:
org.jaggeryjs.scriptengine.exceptions.ScriptException

jsGet_onreadystatechange

public org.mozilla.javascript.Scriptable jsGet_onreadystatechange()
Getter for the 'onreadystatechange' javascript function. This property can be set to a javascript function object, which is invoked when the state of an asynchronous request changes (e.g. the request completes).


jsSet_onreadystatechange

public void jsSet_onreadystatechange(org.mozilla.javascript.Function function)
Setter for the 'onreadystatechange' javascript function. This property can be set to a javascript function object, which is invoked when the state of an asynchronous request changes (e.g. the request completes).


jsGet_readyState

public int jsGet_readyState()

Getter for the readyState property

readyState property represents current state of the object, which can be one of the following values:

  • 0: The object has not been initialized by calling the open() method.
  • 1: The object has been initialized successfully, but the send() method has not been called.
  • 2: The request is pending
  • 3: The request is partially complete (some data has been received, and may be available in the responseText property.
  • 4: The request is complete, all data has been received.
  • Of these, typically only the last (readyState == 4) is used.


    jsGet_error

    public org.mozilla.javascript.Scriptable jsGet_error()

    Getter for the WebServiceError object

    The WebServiceError object encapsulates information about the cause of a failed Web service invocation. When an service invocation failed to complete successfully (including internal errors, or protocol errors such as SOAP faults) this error property can be used to find the cause.

    WebServiceError object contains 3 member properties - code, reason & details. Refer to WebServiceError for more details.



    Copyright © 2015 WSO2 Inc. All rights reserved.