org.aselect.system.communication.server.soap11
Class SOAP11MessageCreator

java.lang.Object
  extended by org.aselect.system.communication.server.soap11.SOAP11MessageCreator
All Implemented Interfaces:
IInputMessage, IMessageCreatorInterface, IOutputMessage

public class SOAP11MessageCreator
extends java.lang.Object
implements IMessageCreatorInterface

Message creator which uses SOAP 1.1 messages.

Description:
A SOAP 1.1 implementation of the IMessageCreatorInterface.

The SOAP11MessageCreator parses the request message to an XML DOM object and validates it manually against the SOAP 1.1 XML Schema. If the request can�t be parsed, a SOAP Fault message will be sent directly. The XML DOM object containing the request message is used as a buffer; the object will be removed if the response message is sent.

The parameters for the response message will be buffered in a XML Document object. This object will be serialized to a valid SOAP 1.1 response message when the send() method is called.

This implementation uses the Xerces XML parser and DOM objects implementation (xercesImpl.jar and xml-apis.jar). For more info about Xerces see: Xerces Java Parser documentation

Note: The SOAP request isn�t validated to the full W3C SOAP 1.1 XML Schema, but only checked if the information can be retrieved from the message in the way that the XML schema describes. Full schema validation can be turned on by uncomment some code in createInputMessage() method, but slows down the parsing extremely.

Concurrency issues:
The used Xerces implemenations are non threadsafe and therefore every SOAP request requires its own SOAP11MessageCreator.

Author:
Alfa & Ariss

Constructor Summary
SOAP11MessageCreator(java.lang.String sMethodEnv, java.lang.String sMethodName, SystemLogger systemLogger)
          Creates a new instance.
 
Method Summary
 java.lang.String[] getArray(java.lang.String sName)
          Get array Parameter values from this SOAP 1.1 message.
 java.lang.String getParam(java.lang.String sName)
          Returns a Parameter from the input SOAP message.
 boolean init(IProtocolRequest oRequest, IProtocolResponse oResponse)
          Initializes the SOAP11MessageCreator.
 boolean send()
          Sends the output message.
 boolean setParam(java.lang.String sName, java.lang.String sValue)
          Sets a parameter in the SOAP output message.
 boolean setParam(java.lang.String sName, java.lang.String[] saValue)
          Sets an array parameter in the SOAP output message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SOAP11MessageCreator

public SOAP11MessageCreator(java.lang.String sMethodEnv,
                            java.lang.String sMethodName,
                            SystemLogger systemLogger)
Creates a new instance.

Description:
Creates a new SOAP11MessageCreator with the given values. All other instance variables are initalized with default values.

Concurrency issues:
-

Preconditions:

Postconditions:
All instance variables are initialized.

Parameters:
sMethodEnv - The method environment URI for the RPC body.
sMethodName - the method name for the RPC body.
systemLogger - The logger that is used to log system entries.
Method Detail

init

public boolean init(IProtocolRequest oRequest,
                    IProtocolResponse oResponse)
             throws ASelectCommunicationException
Initializes the SOAP11MessageCreator.

note: A Fault message will be send imediately to the sender

Specified by:
init in interface IMessageCreatorInterface
Parameters:
oRequest - The request to create an input message from.
oResponse - The response to write the output message to.
Returns:
true - if initialization was succesfull.
false - if initialization fails.
Throws:
ASelectCommunicationException - if communication fails.
See Also:
IMessageCreatorInterface.init(org.aselect.system.communication.server.IProtocolRequest, org.aselect.system.communication.server.IProtocolResponse)

getParam

public java.lang.String getParam(java.lang.String sName)
                          throws ASelectCommunicationException
Returns a Parameter from the input SOAP message.

Specified by:
getParam in interface IInputMessage
Parameters:
sName - The name of the parameter to return.
Returns:
The value of the queried parameter.
Throws:
ASelectCommunicationException - If parameter retrieving fails.
See Also:
IInputMessage.getParam(java.lang.String)

getArray

public java.lang.String[] getArray(java.lang.String sName)
                            throws ASelectCommunicationException
Get array Parameter values from this SOAP 1.1 message.

Specified by:
getArray in interface IInputMessage
Parameters:
sName - The name of the parameter to return.
Returns:
An array of all values belonging to the queried parameter.
Throws:
ASelectCommunicationException - If parameter retrieving fails.
See Also:
IInputMessage.getArray(java.lang.String)

setParam

public boolean setParam(java.lang.String sName,
                        java.lang.String sValue)
                 throws ASelectCommunicationException
Sets a parameter in the SOAP output message.

Specified by:
setParam in interface IOutputMessage
Parameters:
sName - The name of the parameter
sValue - The value of the parameter
Returns:
true - if parameter succesfully set otherwise false.
Throws:
ASelectCommunicationException - If communication fails.
See Also:
IOutputMessage.setParam(java.lang.String, java.lang.String)

setParam

public boolean setParam(java.lang.String sName,
                        java.lang.String[] saValue)
                 throws ASelectCommunicationException
Sets an array parameter in the SOAP output message.

Specified by:
setParam in interface IOutputMessage
Parameters:
sName - The name of the parameter
saValue - The values of the parameter
Returns:
true - if parameter succesfully set otherwise false.
Throws:
ASelectCommunicationException - If communication fails.
See Also:
IOutputMessage.setParam(java.lang.String, java.lang.String[])

send

public boolean send()
             throws ASelectCommunicationException
Sends the output message.

Description:
Performs the following steps:

Specified by:
send in interface IOutputMessage
Returns:
true if send successfully, otherwise false.
Throws:
ASelectCommunicationException - If communication fails.
See Also:
IOutputMessage.send()


Copyright © 2008 SURFnet BV. All Rights Reserved.