Package com.ibm.di.fc.webservice.util
Class WebServiceCall
- java.lang.Object
-
- org.apache.axis.client.Call
-
- com.ibm.di.fc.webservice.util.WebServiceCall
-
- All Implemented Interfaces:
javax.xml.rpc.Call
public class WebServiceCall extends org.apache.axis.client.Call
This class defines APIs that can be accessed over network.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ENCODING_LATIN_1
standard character encoding of the Latin alphabetstatic java.lang.String
ENCODING_UTF8
variable-length character encoding for Unicodestatic int
INITIAL_BUFFER_SIZE
constant to set the default buffer size-
Fields inherited from class org.apache.axis.client.Call
ATTACHMENT_ENCAPSULATION_FORMAT, ATTACHMENT_ENCAPSULATION_FORMAT_DIME, ATTACHMENT_ENCAPSULATION_FORMAT_MIME, ATTACHMENT_ENCAPSULATION_FORMAT_MTOM, attachmentParts, CHARACTER_SET_ENCODING, CHECK_MUST_UNDERSTAND, CONNECTION_TIMEOUT_PROPERTY, entLog, FAULT_ON_NO_RESPONSE, JAXRPC_PORTTYPE_NAME, JAXRPC_SERVICE, log, ONE_WAY, SEND_TYPE_ATTR, STREAMING_PROPERTY, TRANSPORT_NAME, TRANSPORT_PROPERTY, WSDL_PORT_NAME, WSDL_SERVICE
-
-
Constructor Summary
Constructors Constructor Description WebServiceCall(java.lang.String url, Log aLog)
Class constructorWebServiceCall(org.apache.axis.client.Service aService, javax.xml.namespace.QName aPortQN, java.lang.String aSoapOperation, Log aLog)
Class constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHeader(org.apache.axis.message.SOAPHeaderElement header)
static java.lang.String
callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI)
This method gives the chance to invoke callSOAP method without providing basic authenticationstatic java.lang.String
callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI, java.lang.String aBasicAuth)
This method establishes request/response connection http connection to the provided urlstatic java.lang.String
callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI, java.util.Map<java.lang.String,java.lang.String> headers)
This method establishes request/response connection http connection to the provided urlvoid
clearHeaders()
static java.util.Vector
convertComplexTypeList(java.lang.String aString)
Returns Vector, which contains the type information for the tokens of the calling argumentstatic java.lang.String[]
convertOperationParams(java.lang.String aList)
The method splits the operations from one String into an array of Stringsstatic org.apache.axis.client.Service
createService(java.lang.String wsdlDoc, javax.xml.namespace.QName serviceName)
Creates newService
object.static org.apache.axis.client.Service
createService(java.lang.String wsdlDoc, javax.xml.namespace.QName serviceName, java.lang.String username, java.lang.String password)
static WebServiceCall
createWebServiceCall(java.lang.String aWsdlUrl, javax.xml.namespace.QName aServiceQN, javax.xml.namespace.QName aPortQN, java.lang.String aSoapOperation, Log aLog)
Creates new WebServiceCall objectjava.lang.String
generateSOAP(java.util.Vector aClasses, java.lang.Object[] aParams, boolean aIsRequest)
Creates the SOAP protocol for exchanging XML-messagesstatic org.w3c.dom.Element
getAsDOM(java.lang.String aString)
Converts the input argument intoElement
objectstatic java.lang.String
getAsString(org.w3c.dom.Node aNode)
Converts the inputNode
element intoString
static java.lang.String
getChildNodesAsString(org.w3c.dom.Node aNode)
This method returns String , holding the child elements of the inputNode
.static java.util.Map<java.lang.String,java.lang.String>
getDefaultHttpHeaders()
static java.lang.String
getJavaEncoding(java.lang.String aContentType)
This method returns the encoding typejava.util.HashMap
getOutParams()
Retrieves out parameters.static ResourceHash
getResHash()
Returns a NLS Property set which holds all the translated values in the current language.javax.xml.namespace.QName
getReturnParamQName()
Returns the value of aQName
containing a Namespace URI, local name and prefixstatic java.util.Vector
getSoapHeaderAndBodyAsDOM(java.lang.String aSoapMsg)
Converts the SOAP message into DOM formatjava.lang.String
getSoapString(org.apache.axis.message.RPCElement body)
This method returns a String representation of theMessage
from the input SOAP bodystatic int
min(int a, int b)
This method returns the smaller of two numbersstatic java.lang.String
objectArrayToString(java.lang.Object[] aObjArray)
This method converts an input array of objects in the following String format: [obj1 , obj2 , ...java.lang.Object
parseSOAP(java.lang.String aSoapMsgString, java.util.Vector aClasses, java.lang.String aMsgType)
Parses a SOAP messagestatic java.lang.String
readHttpContent(java.io.InputStream aInputStream, java.lang.String aContentType, int aContentLength)
Reads a specific amount of information from theInputStream
and returns the content asString
static java.lang.String
readHttpContentNoContentLength(java.io.InputStream aInputStream, java.lang.String aContentType)
Reads the information from theInputStream
and returns the content asString
void
registerClassMapping(org.apache.axis.MessageContext aMsgCtx, java.lang.Class aClass)
Registers a class mapping .void
registerCustomTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, javax.xml.rpc.encoding.SerializerFactory serializerFactory, javax.xml.rpc.encoding.DeserializerFactory deserializerFactory)
Records a type mapping to be used by the 'parseSOAP' method.static byte[]
resizeByteArray(byte[] aByteArray, int aNewSize)
Changes the size of a byte array-
Methods inherited from class org.apache.axis.client.Call
addAttachmentPart, addFault, addParameter, addParameter, addParameter, addParameter, addParameterAsHeader, addParameterAsHeader, addTransportPackage, clearOperation, getEncodingStyle, getMaintainSession, getMessageContext, getOperation, getOperationName, getOperationStyle, getOperationUse, getOutputParams, getOutputValues, getParameterTypeByName, getParameterTypeByQName, getPassword, getPortName, getPortTypeName, getProperty, getPropertyNames, getResponseMessage, getReturnType, getService, getSOAPActionURI, getStreaming, getTargetEndpointAddress, getTimeout, getTransportForProtocol, getTypeMapping, getUsername, initialize, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invokeOneWay, isParameterAndReturnSpecRequired, isPropertySupported, registerTypeMapping, registerTypeMapping, registerTypeMapping, registerTypeMapping, removeAllParameters, removeProperty, setClientHandlers, setEncodingStyle, setMaintainSession, setOperation, setOperation, setOperation, setOperation, setOperationName, setOperationName, setOperationStyle, setOperationStyle, setOperationUse, setOperationUse, setOption, setPassword, setPortName, setPortTypeName, setProperty, setRequestMessage, setReturnClass, setReturnQName, setReturnType, setReturnType, setReturnTypeAsHeader, setReturnTypeAsHeader, setSOAPActionURI, setSOAPService, setSOAPVersion, setStreaming, setTargetEndpointAddress, setTargetEndpointAddress, setTimeout, setTransport, setTransportForProtocol, setUsername, setUseSOAPAction, useSOAPAction
-
-
-
-
Field Detail
-
ENCODING_LATIN_1
public static final java.lang.String ENCODING_LATIN_1
standard character encoding of the Latin alphabet- See Also:
- Constant Field Values
-
ENCODING_UTF8
public static final java.lang.String ENCODING_UTF8
variable-length character encoding for Unicode- See Also:
- Constant Field Values
-
INITIAL_BUFFER_SIZE
public static final int INITIAL_BUFFER_SIZE
constant to set the default buffer size- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WebServiceCall
public WebServiceCall(org.apache.axis.client.Service aService, javax.xml.namespace.QName aPortQN, java.lang.String aSoapOperation, Log aLog) throws java.lang.Exception
Class constructor- Parameters:
aService
-String
aPortQN
-QName
aSoapOperation
-String
aLog
-Log
- Throws:
java.lang.Exception
- if the arguments are not valid
-
-
Method Detail
-
getResHash
public static ResourceHash getResHash()
Returns a NLS Property set which holds all the translated values in the current language.- Returns:
- ResourceHash
-
getReturnParamQName
public javax.xml.namespace.QName getReturnParamQName()
Returns the value of aQName
containing a Namespace URI, local name and prefix- Returns:
- QName
-
createWebServiceCall
public static WebServiceCall createWebServiceCall(java.lang.String aWsdlUrl, javax.xml.namespace.QName aServiceQN, javax.xml.namespace.QName aPortQN, java.lang.String aSoapOperation, Log aLog) throws java.lang.Exception
Creates new WebServiceCall object- Parameters:
aWsdlUrl
-String
aServiceQN
-QName
aPortQN
-QName
aSoapOperation
-String
aLog
-- Returns:
- new WebServiceCall Object
- Throws:
java.lang.Exception
-
createService
public static org.apache.axis.client.Service createService(java.lang.String wsdlDoc, javax.xml.namespace.QName serviceName) throws java.lang.Exception
Creates newService
object.- Parameters:
wsdlDoc
-String
serviceName
-QName
- Returns:
- Service object
- Throws:
java.lang.Exception
- if the the arguments are not valid
-
createService
public static org.apache.axis.client.Service createService(java.lang.String wsdlDoc, javax.xml.namespace.QName serviceName, java.lang.String username, java.lang.String password) throws java.lang.Exception
- Throws:
java.lang.Exception
-
convertComplexTypeList
public static java.util.Vector convertComplexTypeList(java.lang.String aString) throws java.lang.ClassNotFoundException
Returns Vector, which contains the type information for the tokens of the calling argument- Parameters:
aString
- String- Returns:
Vector
- Throws:
java.lang.ClassNotFoundException
-
getAsDOM
public static org.w3c.dom.Element getAsDOM(java.lang.String aString) throws java.lang.Exception
Converts the input argument intoElement
object- Parameters:
aString
-String
- Returns:
- Element
- Throws:
java.lang.Exception
- if somewhere occurs an error
-
getAsString
public static java.lang.String getAsString(org.w3c.dom.Node aNode) throws java.lang.Exception
Converts the inputNode
element intoString
- Parameters:
aNode
-Node
- Returns:
- String
- Throws:
java.lang.Exception
- ifnull
is pass, or error during the transforming occurs
-
generateSOAP
public java.lang.String generateSOAP(java.util.Vector aClasses, java.lang.Object[] aParams, boolean aIsRequest) throws java.lang.Exception
Creates the SOAP protocol for exchanging XML-messages- Parameters:
aClasses
-Vector
aParams
- Array of objects , parameter listaIsRequest
-boolean
, indicates whether the call is a request or response- Returns:
- String , the name of the operation
- Throws:
java.lang.Exception
- if error occurs
-
clearHeaders
public void clearHeaders()
- Overrides:
clearHeaders
in classorg.apache.axis.client.Call
-
addHeader
public void addHeader(org.apache.axis.message.SOAPHeaderElement header)
- Overrides:
addHeader
in classorg.apache.axis.client.Call
-
getSoapString
public java.lang.String getSoapString(org.apache.axis.message.RPCElement body) throws java.lang.Exception
This method returns a String representation of theMessage
from the input SOAP body- Parameters:
body
- RPCElement- Returns:
- String
- Throws:
java.lang.Exception
-
getOutParams
public java.util.HashMap getOutParams()
Retrieves out parameters.- Returns:
- a HashMap with the out parameters
-
registerCustomTypeMapping
public void registerCustomTypeMapping(java.lang.Class javaType, javax.xml.namespace.QName xmlType, javax.xml.rpc.encoding.SerializerFactory serializerFactory, javax.xml.rpc.encoding.DeserializerFactory deserializerFactory)
Records a type mapping to be used by the 'parseSOAP' method. Note: calling 'registerTypeMapping' on the WebServiceCall object will not affect the 'parseSOAP' method. So use this method instead.- Parameters:
javaType
-Class
typexmlType
-QName
serializerFactory
-SerializerFactory
deserializerFactory
-DeserializerFactory
-
parseSOAP
public java.lang.Object parseSOAP(java.lang.String aSoapMsgString, java.util.Vector aClasses, java.lang.String aMsgType) throws java.lang.Exception
Parses a SOAP message- Parameters:
aSoapMsgString
- the SOAP MessageaClasses
- - String , class typeaMsgType
- - String , Message type for theMessage
- Returns:
- the result of the parsing
- Throws:
java.lang.Exception
- : if error occurs
-
registerClassMapping
public void registerClassMapping(org.apache.axis.MessageContext aMsgCtx, java.lang.Class aClass) throws java.lang.Exception
Registers a class mapping . Used by the parseSOAP method- Parameters:
aMsgCtx
-MessageContext
aClass
-Class
type- Throws:
java.lang.Exception
- if an error during mapping occurs
-
convertOperationParams
public static java.lang.String[] convertOperationParams(java.lang.String aList)
The method splits the operations from one String into an array of Strings- Parameters:
aList
- String- Returns:
- array of Strings
-
callSoap
public static java.lang.String callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI) throws java.lang.Exception
This method gives the chance to invoke callSOAP method without providing basic authentication- Parameters:
aWebServiceURL
-String
aSoapRequest
-String
aSoapActionURI
-String
- Returns:
- String
- Throws:
java.lang.Exception
- See Also:
callSoap(String, String, String, String)
-
callSoap
public static java.lang.String callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI, java.lang.String aBasicAuth) throws java.lang.Exception
This method establishes request/response connection http connection to the provided url- Parameters:
aWebServiceURL
- - String , the URL addressaSoapRequest
- - String , the requestaSoapActionURI
- - intent of the action String , SOAP URIaBasicAuth
- - String , authentication- Returns:
- String , information for the received messages
- Throws:
java.lang.Exception
- , if some problem occurs
-
getDefaultHttpHeaders
public static java.util.Map<java.lang.String,java.lang.String> getDefaultHttpHeaders()
-
callSoap
public static java.lang.String callSoap(java.lang.String aWebServiceURL, java.lang.String aSoapRequest, java.lang.String aSoapActionURI, java.util.Map<java.lang.String,java.lang.String> headers) throws java.lang.Exception
This method establishes request/response connection http connection to the provided url- Parameters:
aWebServiceURL
- - String , the URL addressaSoapRequest
- - String , the requestaSoapActionURI
- - intent of the action String , SOAP URIheaders
- - Map with custom headers, e.g. authentication- Returns:
- String , information for the received messages
- Throws:
java.lang.Exception
- , if some problem occurs
-
getSoapHeaderAndBodyAsDOM
public static java.util.Vector getSoapHeaderAndBodyAsDOM(java.lang.String aSoapMsg) throws java.lang.Exception
Converts the SOAP message into DOM format- Parameters:
aSoapMsg
- String representation of the soap message, used to create newMessage
- Returns:
- Vector , that holds the body and header elements of the message
- Throws:
java.lang.Exception
- , if the required information cannot be retrieved
-
objectArrayToString
public static java.lang.String objectArrayToString(java.lang.Object[] aObjArray)
This method converts an input array of objects in the following String format: [obj1 , obj2 , ... ]- Parameters:
aObjArray
- array of objects- Returns:
- String
-
getChildNodesAsString
public static java.lang.String getChildNodesAsString(org.w3c.dom.Node aNode) throws java.lang.Exception
This method returns String , holding the child elements of the inputNode
.- Parameters:
aNode
-Node
- Returns:
- String
- Throws:
java.lang.Exception
- if the passed Node isnull
-
readHttpContent
public static java.lang.String readHttpContent(java.io.InputStream aInputStream, java.lang.String aContentType, int aContentLength) throws java.io.IOException
Reads a specific amount of information from theInputStream
and returns the content asString
- Parameters:
aInputStream
-InputStream
to be readaContentType
- type of data, so that the encoding style can be setaContentLength
- length of data to be read- Returns:
- String
- Throws:
java.io.IOException
- , if error occurs during reading
-
min
public static int min(int a, int b)
This method returns the smaller of two numbers- Parameters:
a
- integerb
- integer- Returns:
- integer
-
resizeByteArray
public static byte[] resizeByteArray(byte[] aByteArray, int aNewSize)
Changes the size of a byte array- Parameters:
aByteArray
- byte arrayaNewSize
- integer- Returns:
- the resized array
-
readHttpContentNoContentLength
public static java.lang.String readHttpContentNoContentLength(java.io.InputStream aInputStream, java.lang.String aContentType) throws java.io.IOException
Reads the information from theInputStream
and returns the content asString
- Parameters:
aInputStream
- theInputStream
aContentType
- type of data, so that the encoding style can be set- Returns:
- String
- Throws:
java.io.IOException
- , if error occurs during reading
-
getJavaEncoding
public static java.lang.String getJavaEncoding(java.lang.String aContentType)
This method returns the encoding type- Parameters:
aContentType
- String- Returns:
- - String ,
null
if argument hasnull
value , the specified encoding style or the default unicode encryption
-
-