IT_Bus::PartManager Class Reference

#include <it_bus_pdk/part_manager.h>

List of all members.


Detailed Description

Class that creates parts and populates input and output messages of an operation.

The PartManager is a factory for making parts at runtime that were unknown at compile time. It uses the in-memory representation of a message, the WSDLOperation object, to determine what parts to create. The WSDLOperation object is provided as an parameter to the constructor.

Use the PartManager when writing client or servant code, as the ClientOperation or ServerOperation objects are not fully initialized and do not contain their respective part lists. Once instantiated, the PartManager can add the message parts to the ClientOperation or ServerOperation objects.

For example, the following code fragment illustrates how a client application would use the PartManager to initialize a ClientOperation object.

 // Initialize the bus
 Bus_var bus = IT_Bus::init(argc, argv);

 // Create a client proxy and operation.
 ClientProxyBase client(wsdl_url, service_name, port_name);
 // The operation object allows you to construct an operation call
 // without using generated stubs.
 // The IT_AutoPtr<ClientOperation> class provides automatic
 // memory management.
 IT_AutoPtr<ClientOperation>
     operation(client.create_operation(operation_name));

 // Get the WSDL model of the operation's definition
 // The PartManager manager is a convenience class that creates
 // parts corresponding to the WSDL definition.
 const IT_WSDL::WSDLOperation& wsdl_op =
     operation->get_wsdl_operation();
 PartManager part_manager(*bus, wsdl_op);
 cout << "Calling operation " << operation_name << endl;

 // Access the input parts.
 PartList& inputs = part_manager.get_inputs();
 // Assign values to the input parts. (Not shown.)

 // Add the input and output parts to the operation so that
 // invoking the operation will send the input part values and
 // update the output parts with the return values.
 part_manager.add_parts(*operation);
 operation->invoke();

 // Access the output parts
 PartList& outputs = part_manager.get_outputs();
 // Use the return values. (Not shown.)
 

The created parts are held by the PartManager and are destroyed by its destructor.

The PartManager also throws exceptions from a client operation.

Definition at line 95 of file part_manager.h.

Public Member Functions

 PartManager (AnyTypeFactory *factory, const IT_WSDL::WSDLOperation &operation, bool do_unwrap=false) IT_THROW_DECL((UnknownTypeException))
 Constructor.
 PartManager (Bus &bus, const IT_WSDL::WSDLOperation &operation, bool do_unwrap=false) IT_THROW_DECL((UnknownTypeException))
 Constructor.
virtual ~PartManager () IT_THROW_DECL(())
 Destructor.
void add_output_parts (ReadableMessage &message) IT_THROW_DECL((UnknownTypeException))
 Add output parts to a readable message.
void add_output_parts (WritableMessage &message) IT_THROW_DECL((UnknownTypeException))
 Add output parts to a writable message.
void add_parts (ClientOperation &operation) IT_THROW_DECL((UnknownTypeException))
 Add parts to the both the input and output messages of the specified operation.
void add_parts (ServerOperation &operation) IT_THROW_DECL((UnknownTypeException))
 Add parts to the both the input and output messages of the specified operation.
PartListget_inputs ()
 Get the input parts.
PartListget_outputs ()
 Get the output parts.
void throw_if_exception (ClientOperation &operation) IT_THROW_DECL((UnknownTypeException
 If operation has an exception, read and throw it; otherwise do nothing.
const AnyTypeFactoryget_any_type_factory () const
 Get the factory used to create parts.

Public Attributes

void UserFaultException

Private Attributes

const IT_WSDL::WSDLOperationm_wsdl_operation
AnyTypeFactorym_factory
PartList m_inputs
PartList m_outputs
IT_Bus::QName m_input_wrapper_element_qname
IT_Bus::QName m_output_wrapper_element_qname
bool m_do_unwrap
bool m_is_initialized


Constructor & Destructor Documentation

IT_Bus::PartManager::PartManager ( AnyTypeFactory factory,
const IT_WSDL::WSDLOperation operation,
bool  do_unwrap = false 
)

Constructor.

Create parts for an operation.

Parts are used for subsequent calls to add_*_parts. Parts are destroyed when the PartManager is destroyed.

Parameters:
AnyTypeFactory used to create the AnyTypes for parts.
IT_WSDL::WSDLOperation that describes the parts.
Exceptions:
UnknownTypeException if parts cannot be created.

IT_Bus::PartManager::PartManager ( Bus bus,
const IT_WSDL::WSDLOperation operation,
bool  do_unwrap = false 
)

Constructor.

Create parts for an operation.

Parts are used for subsequent calls to add_*_parts. Parts are destroyed when the PartManager is destroyed. This constructor uses the AnyTypeFactory that is already associated with the bus.

Parameters:
Bus. 
IT_WSDL::WSDLOperation that describes the parts.


Member Function Documentation

void IT_Bus::PartManager::add_output_parts ( WritableMessage message  ) 

Add output parts to a writable message.

Parameters:
A reference to the WritableMessage to which to add the output parts.

void IT_Bus::PartManager::add_output_parts ( ReadableMessage message  ) 

Add output parts to a readable message.

Parameters:
A reference to the ReadableMessage to which to add the output parts.

void IT_Bus::PartManager::add_parts ( ServerOperation operation  ) 

Add parts to the both the input and output messages of the specified operation.

Parameters:
A reference to the ServerOperation to which to add the input and output parts.

void IT_Bus::PartManager::add_parts ( ClientOperation operation  ) 

Add parts to the both the input and output messages of the specified operation.

Parameters:
A reference to the ClientOperation to which to add the input and output parts.

const AnyTypeFactory& IT_Bus::PartManager::get_any_type_factory (  )  const

Get the factory used to create parts.

Returns:
A reference to the IT_Bus::AnyTypeFactory associated with the PartManager.

PartList& IT_Bus::PartManager::get_inputs (  ) 

Get the input parts.

The parts were defined in the IT_WSDL::WSDLOperation instance referenced in the constructor.

PartList& IT_Bus::PartManager::get_outputs (  ) 

Get the output parts.

The parts were defined in the IT_WSDL::WSDLOperation instance referenced in the constructor.

void IT_Bus::PartManager::throw_if_exception ( ClientOperation operation  ) 

If operation has an exception, read and throw it; otherwise do nothing.

Parameters:
A reference to the ClientOperation to check for an exception. Use this message after invoking the operation represented by the ClientOperation object.
Exceptions:
UnknownTypeException 
UserFaultException 


Generated on Thu Sep 7 11:40:21 2006 for Artix by  doxygen 1.4.7