com.ibm.di.fc.webservice.util
Class WebServiceCall

java.lang.Object
  extended by org.apache.axis.client.Call
      extended by 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
static String ENCODING_LATIN_1
          standard character encoding of the Latin alphabet
static String ENCODING_UTF8
          variable-length character encoding for Unicode
static 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
 
Fields inherited from interface javax.xml.rpc.Call
ENCODINGSTYLE_URI_PROPERTY, OPERATION_STYLE_PROPERTY, PASSWORD_PROPERTY, SESSION_MAINTAIN_PROPERTY, SOAPACTION_URI_PROPERTY, SOAPACTION_USE_PROPERTY, USERNAME_PROPERTY
 
Constructor Summary
WebServiceCall(org.apache.axis.client.Service aService, QName aPortQN, String aSoapOperation, Log aLog)
          Class constructor
WebServiceCall(String url, Log aLog)
          Class constructor
 
Method Summary
static String callSoap(String aWebServiceURL, String aSoapRequest, String aSoapActionURI)
          This method gives the chance to invoke callSOAP method without providing basic authentication
static String callSoap(String aWebServiceURL, String aSoapRequest, String aSoapActionURI, String aBasicAuth)
          This method establishes request/response connection http connection to the provided url
static Vector convertComplexTypeList(String aString)
          Returns Vector, which contains the type information for the tokens of the calling argument
static String[] convertOperationParams(String aList)
          The method splits the operations from one String into an array of Strings
static org.apache.axis.client.Service createService(String wsdlDoc, QName serviceName)
          Creates new Service object.
static WebServiceCall createWebServiceCall(String aWsdlUrl, QName aServiceQN, QName aPortQN, String aSoapOperation, Log aLog)
          Creates new WebServiceCall object
 String generateSOAP(Vector aClasses, Object[] aParams, boolean aIsRequest)
          Creates the SOAP protocol for exchanging XML-messages
static Element getAsDOM(String aString)
          Converts the input argument into Element object
static String getAsString(Node aNode)
          Converts the input Node element into String
static String getChildNodesAsString(Node aNode)
          This method returns String , holding the child elements of the input Node.
static String getJavaEncoding(String aContentType)
          This method returns the encoding type
 HashMap getOutParams()
          Retrieves out parameters.
static ResourceHash getResHash()
          Returns a NLS Property set which holds all the translated values in the current language.
 QName getReturnParamQName()
          Returns the value of a QName containing a Namespace URI, local name and prefix
static Vector getSoapHeaderAndBodyAsDOM(String aSoapMsg)
          Converts the SOAP message into DOM format
 String getSoapString(org.apache.axis.message.RPCElement body)
          This method returns a String representation of the Message from the input SOAP body
static int min(int a, int b)
          This method returns the smaller of two numbers
static String objectArrayToString(Object[] aObjArray)
          This method converts an input array of objects in the following String format: [obj1 , obj2 , ...
 Object parseSOAP(String aSoapMsgString, Vector aClasses, String aMsgType)
          Parses a SOAP message
static String readHttpContent(InputStream aInputStream, String aContentType, int aContentLength)
          Reads a specific amount of information from the InputStream and returns the content as String
static String readHttpContentNoContentLength(InputStream aInputStream, String aContentType)
          Reads the information from the InputStream and returns the content as String
 void registerClassMapping(org.apache.axis.MessageContext aMsgCtx, Class aClass)
          Registers a class mapping .
 void registerCustomTypeMapping(Class javaType, 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, addHeader, addParameter, addParameter, addParameter, addParameter, addParameterAsHeader, addParameterAsHeader, addTransportPackage, clearHeaders, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_LATIN_1

public static final String ENCODING_LATIN_1
standard character encoding of the Latin alphabet

See Also:
Constant Field Values

ENCODING_UTF8

public static final 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,
                      QName aPortQN,
                      String aSoapOperation,
                      Log aLog)
               throws Exception
Class constructor

Parameters:
aService - String
aPortQN - QName
aSoapOperation - String
aLog - Log
Throws:
Exception - if the arguments are not valid

WebServiceCall

public WebServiceCall(String url,
                      Log aLog)
               throws MalformedURLException
Class constructor

Parameters:
url - String
aLog - Log
Throws:
MalformedURLException - If the string specifies an unknown protocol.
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 QName getReturnParamQName()
Returns the value of a QName containing a Namespace URI, local name and prefix

Returns:
QName

createWebServiceCall

public static WebServiceCall createWebServiceCall(String aWsdlUrl,
                                                  QName aServiceQN,
                                                  QName aPortQN,
                                                  String aSoapOperation,
                                                  Log aLog)
                                           throws Exception
Creates new WebServiceCall object

Parameters:
aWsdlUrl - String
aServiceQN - QName
aPortQN - QName
aSoapOperation - String
aLog -
Returns:
new WebServiceCall Object
Throws:
Exception

createService

public static org.apache.axis.client.Service createService(String wsdlDoc,
                                                           QName serviceName)
                                                    throws Exception
Creates new Service object.

Parameters:
wsdlDoc - String
serviceName - QName
Returns:
Service object
Throws:
Exception - if the the arguments are not valid

convertComplexTypeList

public static Vector convertComplexTypeList(String aString)
                                     throws ClassNotFoundException
Returns Vector, which contains the type information for the tokens of the calling argument

Parameters:
aString - String
Returns:
Vector
Throws:
ClassNotFoundException

getAsDOM

public static Element getAsDOM(String aString)
                        throws Exception
Converts the input argument into Element object

Parameters:
aString - String
Returns:
Element
Throws:
Exception - if somewhere occurs an error

getAsString

public static String getAsString(Node aNode)
                          throws Exception
Converts the input Node element into String

Parameters:
aNode - Node
Returns:
String
Throws:
Exception - if null is pass, or error during the transforming occurs

generateSOAP

public String generateSOAP(Vector aClasses,
                           Object[] aParams,
                           boolean aIsRequest)
                    throws Exception
Creates the SOAP protocol for exchanging XML-messages

Parameters:
aClasses - Vector
aParams - Array of objects , parameter list
aIsRequest - boolean , indicates whether the call is a request or response
Returns:
String , the name of the operation
Throws:
Exception - if error occurs

getSoapString

public String getSoapString(org.apache.axis.message.RPCElement body)
                     throws Exception
This method returns a String representation of the Message from the input SOAP body

Parameters:
body - RPCElement
Returns:
String
Throws:
Exception

getOutParams

public HashMap getOutParams()
Retrieves out parameters.

Returns:
a HashMap with the out parameters

registerCustomTypeMapping

public void registerCustomTypeMapping(Class javaType,
                                      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 type
xmlType - QName
serializerFactory - SerializerFactory
deserializerFactory - DeserializerFactory

parseSOAP

public Object parseSOAP(String aSoapMsgString,
                        Vector aClasses,
                        String aMsgType)
                 throws Exception
Parses a SOAP message

Parameters:
aSoapMsgString - the SOAP Message
aClasses - - String , class type
aMsgType - - String , Message type for the Message
Returns:
the result of the parsing
Throws:
Exception - : if error occurs

registerClassMapping

public void registerClassMapping(org.apache.axis.MessageContext aMsgCtx,
                                 Class aClass)
                          throws Exception
Registers a class mapping . Used by the parseSOAP method

Parameters:
aMsgCtx - MessageContext
aClass - Class type
Throws:
Exception - if an error during mapping occurs

convertOperationParams

public static String[] convertOperationParams(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 String callSoap(String aWebServiceURL,
                              String aSoapRequest,
                              String aSoapActionURI)
                       throws Exception
This method gives the chance to invoke callSOAP method without providing basic authentication

Parameters:
aWebServiceURL - String
aSoapRequest - String
aSoapActionURI - String
Returns:
String
Throws:
Exception
See Also:
callSoap(String, String, String, String)

callSoap

public static String callSoap(String aWebServiceURL,
                              String aSoapRequest,
                              String aSoapActionURI,
                              String aBasicAuth)
                       throws Exception
This method establishes request/response connection http connection to the provided url

Parameters:
aWebServiceURL - - String , the URL address
aSoapRequest - - String , the request
aSoapActionURI - - intent of the action String , SOAP URI
aBasicAuth - - String , authentication
Returns:
String , information for the received messages
Throws:
Exception - , if some problem occurs

getSoapHeaderAndBodyAsDOM

public static Vector getSoapHeaderAndBodyAsDOM(String aSoapMsg)
                                        throws Exception
Converts the SOAP message into DOM format

Parameters:
aSoapMsg - String representation of the soap message, used to create new Message
Returns:
Vector , that holds the body and header elements of the message
Throws:
Exception - , if the required information cannot be retrieved

objectArrayToString

public static String objectArrayToString(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 String getChildNodesAsString(Node aNode)
                                    throws Exception
This method returns String , holding the child elements of the input Node.

Parameters:
aNode - Node
Returns:
String
Throws:
Exception - if the passed Node is null

readHttpContent

public static String readHttpContent(InputStream aInputStream,
                                     String aContentType,
                                     int aContentLength)
                              throws IOException
Reads a specific amount of information from the InputStream and returns the content as String

Parameters:
aInputStream - InputStream to be read
aContentType - type of data, so that the encoding style can be set
aContentLength - length of data to be read
Returns:
String
Throws:
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 - integer
b - integer
Returns:
integer

resizeByteArray

public static byte[] resizeByteArray(byte[] aByteArray,
                                     int aNewSize)
Changes the size of a byte array

Parameters:
aByteArray - byte array
aNewSize - integer
Returns:
the resized array

readHttpContentNoContentLength

public static String readHttpContentNoContentLength(InputStream aInputStream,
                                                    String aContentType)
                                             throws IOException
Reads the information from the InputStream and returns the content as String

Parameters:
aInputStream - the InputStream
aContentType - type of data, so that the encoding style can be set
Returns:
String
Throws:
IOException - , if error occurs during reading

getJavaEncoding

public static String getJavaEncoding(String aContentType)
This method returns the encoding type

Parameters:
aContentType - String
Returns:
- String ,null if argument has null value , the specified encoding style or the default unicode encryption