public interface Exchange
Represents an exchange in a scripted environment. An exchange is one invocation of an operation. It may have a request and a reply or only a request based on its exchange pattern as described in the WSDL document. From an exchange you can get information about the call being made such as which service is being called, which operation, which binding is being used (if from an external client), and which endpoint is being called (if from an external client).
You can also get direct access to the input, output, and fault messages associated with the exchange at the moment however it is recommended that the message variables defined within the process should be used instead. In fact, the output and fault messages of the calling exchange of a process will not even be populated during process execution.
You can gain access to the calling exchange of a process as follows:
exchange = processContext.getCreatingExchange();
From there you can get information about the exchange as follows:
auditLog.debug("service is " + exchange.getServiceName()); auditLog.debug("operation is " + exchange.getOperationName()); auditLog.debug("endpoint is " + exchange.getEndpointName());
Exchanges can have properties associated with them. A property can be any type of Java object identified by a unique string name. These can be useful for passing context information to/from policy handlers that are used when processing the exchange. You can access an exchange's property as follows:
prop1 = exchange.getProperty("prop1");
You can create or change a property with:
exchange.setProperty("prop1", "myPropertyValue");
Modifier and Type | Method and Description |
---|---|
Message |
createFaultMessage()
Create a new
Message to be used as the fault for the exchange. |
Message |
createInMessage()
Create a new
Message to be used as the input to the exchange. |
Message |
createOutputMessage()
Create a new
Message to be used as the output from the exchange. |
java.lang.String |
getBinding()
Returns a URI identifying the type of binding used in the exchange.
|
java.lang.String |
getEndpointName()
Returns the name of the endpoint being called.
|
java.lang.String |
getExchangeID()
Returns a unique identifier for the exchange between the two parties.
|
Message |
getFaultMessage()
Returns the fault message that is part of the exchange (if any).
|
Message |
getInMessage()
Returns the in message that is part of the exchange (if any).
|
javax.xml.namespace.QName |
getInterfaceName()
Returns the name of the interface being called.
|
java.lang.String |
getOperationName()
Returns the name of the operation being invoked.
|
Message |
getOutMessage()
Returns the out message that is part of the exchange (if any).
|
java.lang.String |
getPattern()
Returns the message exchange pattern to be used.
|
java.lang.Object |
getProperty(java.lang.String name)
Returns the property with the given name.
|
java.util.Set |
getPropertyNames()
Returns the names of the properties associated with the context.
|
javax.xml.namespace.QName |
getServiceName()
Returns the name of the service being invoked.
|
int |
getStatus()
Returns the status of the exchange (0=ACTIVE, 1=DONE, 2=ERROR).
|
boolean |
isAsync()
Returns whether the exchange should be completed asynchronously or not.
|
void |
setEndpointName(java.lang.String name)
Changes the name of the endpoint to invoke.
|
void |
setFaultMessage(Message msg)
Changes the message used as a fault from the exchange.
|
void |
setInMessage(Message msg)
Changes the message used as input to the exchange.
|
void |
setInterfaceName(javax.xml.namespace.QName name)
Changes the name of the interface to call.
|
void |
setInterfaceName(java.lang.String name)
Changes the name of the interface to call.
|
void |
setOperationName(java.lang.String name)
Changes the name of the operation to invoke.
|
void |
setOutMessage(Message msg)
Changes the message used as output from the exchange.
|
void |
setProperty(java.lang.String name,
java.lang.Object property)
Adds or replaces a property.
|
void |
setServiceName(javax.xml.namespace.QName name)
Changes the name of the service to invoke.
|
void |
setServiceName(java.lang.String name)
Changes the name of the service to invoke.
|
java.lang.String getExchangeID()
java.lang.Object getProperty(java.lang.String name)
name
- Name of the property.void setProperty(java.lang.String name, java.lang.Object property)
name
- Name of the property.property
- Value of the property.java.util.Set getPropertyNames()
javax.xml.namespace.QName getServiceName()
java.lang.String getEndpointName()
java.lang.String getBinding()
javax.xml.namespace.QName getInterfaceName()
java.lang.String getOperationName()
int getStatus()
Message getInMessage()
Message getOutMessage()
Message getFaultMessage()
java.lang.String getPattern()
boolean isAsync()
void setServiceName(javax.xml.namespace.QName name)
name
- QName of the service to invoke.void setServiceName(java.lang.String name)
name
- String representation of the QName of the service to invoke.void setEndpointName(java.lang.String name)
name
- Name of the endpoint to invoke.void setInterfaceName(javax.xml.namespace.QName name)
name
- QName of the interface to call.void setInterfaceName(java.lang.String name)
name
- String representation of the QName of the interface to call.void setOperationName(java.lang.String name)
name
- Name of the operation to invoke.void setInMessage(Message msg) throws GException
msg
- Message
to be used as input.GException
- Thrown if unable to set the message, most likely
due to an input message already existing in the
exchange.void setOutMessage(Message msg) throws GException
msg
- Message
to be used as output.GException
- Thrown if unable to set the message, most likely
due to an output message already existing in the
exchange.void setFaultMessage(Message msg) throws GException
msg
- Message
to be used as a fault.GException
- Thrown if unable to set the message, most likely
due to a fault message already existing in the
exchange.Message createInMessage() throws GException
Message
to be used as the input to the exchange.Message
to be used as the input to the exchange.GException
- Thrown if unable to create a message, most likely
due to an input message already existing in the
exchange.Message createOutputMessage() throws GException
Message
to be used as the output from the exchange.Message
to be used as the output from the exchange.GException
- Thrown if unable to create a message, most likely
due to an output message already existing in the
exchange.Message createFaultMessage() throws GException
Message
to be used as the fault for the exchange.Message
to be used as the fault for the exchange.GException
- Thrown if unable to create a message, most likely
due to a fault message already existing in the
exchange.?? 2022 Perforce Software, All rights reserved
This software is the confidential and proprietary information of Perforce, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Perforce, Inc.