public class WebService extends BaseClass
A Web Service object allows you to invoke operations (via
callOperation()
), inspect schema declared in the
WSDL file (getSchema()
), and perform simple read-only
databinding getFetchDS()
.
Once a WebService has been loaded, a DataSource can be declared with a
serviceNamespace
to connect it to the web service, allowing DataSource
data to be loaded and saved to the web service using
operationBindings
.
Modifier and Type | Field and Description |
---|---|
protected com.google.gwt.core.client.JavaScriptObject |
jsObj |
config, configOnly, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
WebService() |
WebService(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
void |
callOperation(java.lang.String operationName,
java.util.Map paramData,
java.lang.String resultType,
WebServiceCallback callback)
Invoke a web service operation.
|
void |
callOperation(java.lang.String operationName,
java.util.Map paramData,
java.lang.String resultType,
WebServiceCallback callback,
WSRequest wsRequestProperties)
Invoke a web service operation.
|
com.google.gwt.core.client.JavaScriptObject |
create() |
static WebService |
get(java.lang.String serviceNamespace)
Retrieve a WebService object by the targetNamespace declared on the
|
DataSource |
getFetchDS(java.lang.String operationName,
java.lang.String resultType)
Retrieve a DataSource that provides read-only access to records returned by a web service operation.
|
DataSource |
getFetchDS(java.lang.String operationName,
java.lang.String resultType,
OperationBinding operationBindingProperties)
Retrieve a DataSource that provides read-only access to records returned by a web service operation.
|
DataSource |
getInputDS(java.lang.String operationName)
Get a DataSource representing the input message to a web service operation.
|
com.google.gwt.core.client.JavaScriptObject |
getJsObj() |
com.google.gwt.core.client.JavaScriptObject |
getOrCreateJsObj() |
static WebService |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
DataSource |
getSchema(java.lang.String schemaName)
Get the schema definition of any complexType or element of complexType defined in any
|
DataSource |
getSchema(java.lang.String schemaName,
java.lang.String schemaType)
Get the schema definition of any complexType or element of complexType defined in any
|
java.lang.String |
getSoapMessage(WSRequest wsRequestProperties)
Return the SOAP message that will be formed from this WSRequest.
|
boolean |
isCreated() |
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
setLocation(java.lang.String url)
Set location can be used when the actual URL where a service will be accessible isn't known until runtime, or changes at runtime, hence can't be embedded in the service definition.
|
void |
setLocation(java.lang.String url,
java.lang.String operation)
Set location can be used when the actual URL where a service will be accessible isn't known until runtime, or changes at runtime, hence can't be embedded in the service definition.
|
applyFactoryProperties, asSGWTComponent, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getScClassName, getTestInstance, hasAutoAssignedID, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setScClassName
public WebService()
public WebService(com.google.gwt.core.client.JavaScriptObject jsObj)
public static WebService getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public com.google.gwt.core.client.JavaScriptObject getJsObj()
public com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()
getOrCreateJsObj
in class BaseClass
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
setJavaScriptObject
in class BaseClass
public com.google.gwt.core.client.JavaScriptObject create()
public void callOperation(java.lang.String operationName, java.util.Map paramData, java.lang.String resultType, WebServiceCallback callback)
The data
parameter will be serialized to XML to form the input message for
the operation, as described by XmlSerialize
. Namespacing,
element ordering, and SOAP encoding rules are automatically followed. If the web
service you are trying to contact requires a complicated nested structure, consider
using
WSRequest.setUseFlatFields(Boolean)
to simplify the required JavaScript input data.
The resultType
selects what part of the message should be decoded to
JavaScript and made
available as the "data" variable in the callback. The
resultType
parameter can be either:
DataSource.recordsFromXML(Object)
.
In this case, since the XML Schema type of the
NOTE: callOperation()
is appropriate for simple operations that do not
involve DataBound Components, such as logging into a web service,
or retrieving simple
String data. callOperation()
can also be used to retrieve small, read-only
datasets such as the option list for a SelectItem, but only if the dataset is guaranteed
to remain small enough for paging to be unnecessary.
For any larger datasets or
anything that will be edited, DataSource integration is more appropriate.
operationName
- Name of the operation to invokeparamData
- data to serialize as XML to form the inbound message of the operationresultType
- Type, Element name, or XPath that should be selected from the resultcallback
- Callback to invoke on completionpublic void callOperation(java.lang.String operationName, java.util.Map paramData, java.lang.String resultType, WebServiceCallback callback, WSRequest wsRequestProperties)
The data
parameter will be serialized to XML to form the input message for
the operation, as described by XmlSerialize
. Namespacing,
element ordering, and SOAP encoding rules are automatically followed. If the web
service you are trying to contact requires a complicated nested structure, consider
using
WSRequest.setUseFlatFields(Boolean)
to simplify the required JavaScript input data.
The resultType
selects what part of the message should be decoded to
JavaScript and made
available as the "data" variable in the callback. The
resultType
parameter can be either:
DataSource.recordsFromXML(Object)
.
In this case, since the XML Schema type of the
NOTE: callOperation()
is appropriate for simple operations that do not
involve DataBound Components, such as logging into a web service,
or retrieving simple
String data. callOperation()
can also be used to retrieve small, read-only
datasets such as the option list for a SelectItem, but only if the dataset is guaranteed
to remain small enough for paging to be unnecessary.
For any larger datasets or
anything that will be edited, DataSource integration is more appropriate.
operationName
- Name of the operation to invokeparamData
- data to serialize as XML to form the inbound message of the operationresultType
- Type, Element name, or XPath that should be selected from the resultcallback
- Callback to invoke on completionwsRequestProperties
- Additional properties for the WSRequest, such as HTTPHeaderspublic void setLocation(java.lang.String url)
url
- the URL where web service can be contactedpublic void setLocation(java.lang.String url, java.lang.String operation)
url
- the URL where web service can be contactedoperation
- optional operation name to set the location for, for debugging onlypublic DataSource getInputDS(java.lang.String operationName)
operationName
- name of the web service operation whose inputs the returned DataSource will representpublic DataSource getFetchDS(java.lang.String operationName, java.lang.String resultType)
operationName
- name of the web service operation to invoke to fetch recordsresultType
- tag or type name of the XML element to be returned as DataSource recordspublic DataSource getFetchDS(java.lang.String operationName, java.lang.String resultType, OperationBinding operationBindingProperties)
operationName
- name of the web service operation to invoke to fetch recordsresultType
- tag or type name of the XML element to be returned as DataSource recordsoperationBindingProperties
- additional properties for the operationType:"fetch" operationBinding which this method automatically creates.
This can be used to set properties such as com.smartgwt.client.data.OperationBinding#setUseFlatFields(Boolean)
or OperationBinding.setRecordXPath(String)
public DataSource getSchema(java.lang.String schemaName)
schemaName
- name of type or elementpublic DataSource getSchema(java.lang.String schemaName, java.lang.String schemaType)
schemaName
- name of type or elementschemaType
- optional type of schema to return, either "element" for xs:element definitions only or "type" for xs:complexType definitions.
If unspecified, either will be returned, with types preferred if names collidepublic static WebService get(java.lang.String serviceNamespace)
serviceNamespace
- uri from the "targetNamespace" attribute of the public java.lang.String getSoapMessage(WSRequest wsRequestProperties)
web
- service request object