org.sape.smfw.soapengine
Class MessageClient

java.lang.Object
  extended byorg.sape.smfw.soapengine.MessageClient

public class MessageClient
extends Object

MessageClient provides the functionality to send messages to a MessageService. It wraps the SOAP Call object which is accessible and customizatble to meet the application needs. For example, if the client needs to maintain a session with the server, it can call messageClient.getCall().setMaintainSession(true).


Field Summary
private  org.apache.axis.client.Call call
          The call object used to send the SOAP request to the server
private static org.apache.commons.logging.Log log
           
private  MessageContext messageContext
          The MessageContext for this client
private  MessageReader messageReader
          The MessageReader used to receive messages
private  MessageWriter messageWriter
          The MessageWriter used to send messages
 
Constructor Summary
MessageClient(String address, MessageContext messageContext, MessageReader messageReader, MessageWriter messageWriter)
          Constructs a MessageClient object.
 
Method Summary
private  void addUserHeader(User user)
          Adds a user header to each outgoing message we generate.
 org.apache.axis.client.Call getCall()
          Returns the Call object used to send the SOAP request
 Message sendMessage(Message message)
          Sends a message to a Web service and returns the response.
 void setCall(org.apache.axis.client.Call call)
          Sets the Call object used to send the SOAP request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

call

private org.apache.axis.client.Call call
The call object used to send the SOAP request to the server


messageContext

private MessageContext messageContext
The MessageContext for this client


messageReader

private MessageReader messageReader
The MessageReader used to receive messages


messageWriter

private MessageWriter messageWriter
The MessageWriter used to send messages

Constructor Detail

MessageClient

public MessageClient(String address,
                     MessageContext messageContext,
                     MessageReader messageReader,
                     MessageWriter messageWriter)
              throws MessagingEngineException
Constructs a MessageClient object. Creates a SOAP Call used to send and receive messages from the server at the supplied address. In addition, if the supplied MessageContext has a reference to a User object then user headers will be sent with every messages to the server.

Parameters:
address - Endpoint address of the server specified as a URI.
messageContext - The MessageContext for this client.
messageReader - The MessageReader used to receive messages.
messageWriter - The MessageWriter used to send messages.
Throws:
MessagingEngineException - if there is an in creating the MessageClient
Method Detail

getCall

public org.apache.axis.client.Call getCall()
Returns the Call object used to send the SOAP request

Returns:
the Call object used to send the SOAP request

setCall

public void setCall(org.apache.axis.client.Call call)
Sets the Call object used to send the SOAP request

Parameters:
call - the Call object used to send the SOAP request

sendMessage

public Message sendMessage(Message message)
                    throws MessagingEngineException
Sends a message to a Web service and returns the response.

Parameters:
message - the message to be sent
Returns:
the Message received
Throws:
MessagingEngineException

addUserHeader

private void addUserHeader(User user)
                    throws MessagingEngineException
Adds a user header to each outgoing message we generate. Used for authentication purposes.

Parameters:
user - the User object to add to user header
Throws:
MessagingEngineException - if there is an in adding the header


Copyright 2003 Sapient Corporation. All Rights Reserved.