public class JSONClient extends Context
Context
with invoke and invokeThreaded methods that accept JSON text.
The character encoding used when serializing and deserializing the JSON text defaults to "UTF-8". Call
the setEncoding(JSON_ENCODING) method prior to calling the invoke or invokeThreaded methods to
use a different encoding.
Note: JSONClient requires that the SoftwareAG_directory/common/lib/glassfish/gf-jackson-core-asl.jar is present in the classpath. Without gf-jackson-core-asl.jar, JSONClient cannot parse JSON responses.
CONTENT_TYPE_HTML, CONTXT0003, CONTXT0004, CONTXT0005, CONTXT0006, CONTXT0007, CONTXT0008, CONTXT0009, DISCONNECT_MSG, HTTP_HEADER_CONTENT_TYPE, HTTP_OK_RESPONSE_CODE, PING_FAILED_MSG, PING_SERVER_MSG, TIME_OUT_MSG, TRY_PING_MSG, UNKNOWN_HOST_MSG, UNNOWN_PARTNER_MSG
Constructor and Description |
---|
JSONClient()
Creates a JSONClient.
|
Modifier and Type | Method and Description |
---|---|
IDataJSONCoder.JSON_ENCODING |
getEncoding() |
java.lang.String |
invoke(java.lang.String ifc,
java.lang.String svc,
java.lang.String jsonData)
Invokes a service on an Integration Server.
|
InvokeThread |
invokeThreaded(NSName svcName,
java.lang.String jsonData)
Calls invoke asynchronously and returns an InvokeThread.
|
InvokeThread |
invokeThreaded(java.lang.String ifc,
java.lang.String svc,
java.lang.String jsonData)
Calls invoke asynchronously and returns an InvokeThread.
|
void |
setEncoding(IDataJSONCoder.JSON_ENCODING encoding)
Sets the character encoding used when serializing and deserializing the JSON text.
|
appletSetup, cleanUpConnection, connect, connect, connect, connect, disconnect, disconnect, fakeConnect, getCookies, getCookiesAsArray, getNamespace, getQuery, invoke, invoke, invoke, invoke, invoke, invoke, invokeThreaded, invokeThreaded, setCookie
getSSLSupport, isClusteredEnv, isConnected, isSecure, isUseJSSE, setAllowRedir, setAuthentication, setFixedUri, setProxy, setRetryServer, setSecure, setSecureProxy, setSSLCertificates, setSSLCertificates, setSSLCertificates, setUseJSSE
public void setEncoding(IDataJSONCoder.JSON_ENCODING encoding)
encoding
- The possible values are:public IDataJSONCoder.JSON_ENCODING getEncoding()
#setEncoding(JSON_ENCODING)
.public java.lang.String invoke(java.lang.String ifc, java.lang.String svc, java.lang.String jsonData) throws ServiceException
ifc
- The interface of the service to invoke.svc
- The name of the service to invoke.jsonData
- A string holding JSON text containing the input to the service being invoked.ServiceException
- If this JSONClient is not connected to an Integration Server
or if the server threw an Exception while processing this request.public InvokeThread invokeThreaded(NSName svcName, java.lang.String jsonData)
svcName
- namespace name of the service to invokejsonData
- input data for the serviceInvokeThread
. Call InvokeThread#getJSONData()
to
get the results of the service invocation.#invoke(String, String, String)}
public InvokeThread invokeThreaded(java.lang.String ifc, java.lang.String svc, java.lang.String jsonData)
ifc
- interface name of the service to invokesvc
- service to invokejsonData
- input data for the serviceInvokeThread
. Call InvokeThread#getJSONData()
to
get the results of the service invocation.#invoke(String, String, String)}