Class WSExecuteOperation
- java.lang.Object
-
- com.boomi.connector.util.ContextualOperation
-
- com.boomi.connector.util.BaseOperation
-
- com.boomi.connector.util.BaseUpdateOperation
-
- com.boomi.connector.ws.WSExecuteOperation
-
- All Implemented Interfaces:
Operation
public class WSExecuteOperation extends BaseUpdateOperation
Implementation of the EXECUTE operation for invoking arbitrary webservice methods.Customization of the actual webservice call is typically done in one of two places, either in this class or in the
WSConnection
class. Typical customization in this class will be overridingcreateRequest(java.io.InputStream)
to alter the input data (e.g. adding custom webservice headers) and overridinghandleResponse(com.boomi.connector.api.ObjectData, com.boomi.webservices.WebServiceResponse, com.boomi.connector.api.OperationResponse)
to handle things like paged output (e.g. making additional calls to get all of the results).
-
-
Constructor Summary
Constructors Constructor Description WSExecuteOperation(WSConnection<OperationContext> conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addResult(ObjectData execData, OperationResponse response, OperationStatus status, String statusCode, String statusMessage, Payload payload)
Handles adding result to the operation response after webservice execution.protected com.boomi.webservices.WebServiceRequest
createRequest(InputStream reqStream)
Creates a WebServiceRequest for a call toWebServiceExecutor.execute(org.w3c.dom.Document)
.protected void
executeUpdate(ObjectData execData, com.boomi.webservices.WebServiceExecutor executor, OperationResponse response)
Executes the configured webservice operation with the given input ObjectData using the given WebServiceExecutor.protected void
executeUpdate(UpdateRequest request, OperationResponse response)
Actual implementation of this CREATE, UPDATE, or UPSERT Operation.WSOperationConnection
getConnection()
Returns the base connection that was either provided or created when this instance was created.protected String
getOperationName()
Returns the operation name for this operation.protected void
handleResponse(ObjectData execData, com.boomi.webservices.WebServiceResponse wsResponse, OperationResponse response)
Handles the response data from a webservice execution.-
Methods inherited from class com.boomi.connector.util.BaseUpdateOperation
execute
-
Methods inherited from class com.boomi.connector.util.ContextualOperation
getContext
-
-
-
-
Constructor Detail
-
WSExecuteOperation
public WSExecuteOperation(WSConnection<OperationContext> conn)
-
-
Method Detail
-
getConnection
public WSOperationConnection getConnection()
Description copied from class:ContextualOperation
Returns the base connection that was either provided or created when this instance was created.- Overrides:
getConnection
in classContextualOperation
- Returns:
- the base connection
-
executeUpdate
protected void executeUpdate(UpdateRequest request, OperationResponse response)
Actual implementation of this CREATE, UPDATE, or UPSERT Operation.Default implementation gets the operation name from
getOperationName()
, creates a WebServiceExecutor via theWSOperationConnection.createExecutor(java.lang.String)
and callsexecuteUpdate(ObjectData,WebServiceExecutor,OperationResponse)
for each input object.- Specified by:
executeUpdate
in classBaseUpdateOperation
- Parameters:
request
- request given toBaseUpdateOperation.execute(com.boomi.connector.api.OperationRequest, com.boomi.connector.api.OperationResponse)
, downcast to the correct typeresponse
- response given toBaseUpdateOperation.execute(com.boomi.connector.api.OperationRequest, com.boomi.connector.api.OperationResponse)
-
getOperationName
protected String getOperationName()
Returns the operation name for this operation.Default implementation returns
getContext().getObjectTypeId()
.
-
createRequest
protected com.boomi.webservices.WebServiceRequest createRequest(InputStream reqStream) throws Exception
Creates a WebServiceRequest for a call toWebServiceExecutor.execute(org.w3c.dom.Document)
. Called byexecuteUpdate(ObjectData,WebServiceExecutor,OperationResponse)
.Default implementation instantiates a WebServiceRequest with the given InputStream.
Subclasses may wish to override this to alter the input data to the execute call. Customization may be as simple as adding extra headers or may involve more complex manipulations to the input data itself.
- Parameters:
reqStream
- the InputStream from the the input ObjectData- Returns:
- a WebServiceRequest for executing the currently configured webservice operation
- Throws:
Exception
-
executeUpdate
protected void executeUpdate(ObjectData execData, com.boomi.webservices.WebServiceExecutor executor, OperationResponse response) throws Exception
Executes the configured webservice operation with the given input ObjectData using the given WebServiceExecutor.Default implementation executes the webservice operation using the input returned by
createRequest(java.io.InputStream)
and processes the results by callinghandleResponse(com.boomi.connector.api.ObjectData, com.boomi.webservices.WebServiceResponse, com.boomi.connector.api.OperationResponse)
.- Parameters:
execData
- the input data to the webservice operationexecutor
- the configured WebServiceExecutor for executing the webservice operationresponse
- SDK context for returning results- Throws:
Exception
-
handleResponse
protected void handleResponse(ObjectData execData, com.boomi.webservices.WebServiceResponse wsResponse, OperationResponse response) throws Exception
Handles the response data from a webservice execution. Called byexecuteUpdate(ObjectData,WebServiceExecutor,OperationResponse)
with the response data from a webservice execute call for the given input data.Default implementation pushes the response data unchanged into the OperationResponse with help of
addResult(ObjectData, OperationResponse, OperationStatus, String, String, Payload)
if no webservice fault was returned. Otherwise, an empty failure is added to the OperationResponse as either an APPLICATION_ERROR or FAILURE based on the return from a call toWSConnection.isApplicationFault(com.boomi.webservices.WebServiceResponse)
.- Throws:
Exception
-
addResult
protected void addResult(ObjectData execData, OperationResponse response, OperationStatus status, String statusCode, String statusMessage, Payload payload)
Handles adding result to the operation response after webservice execution. Called byhandleResponse(ObjectData, WebServiceResponse, OperationResponse)
with the response data from a webservice execute call for the given input data.It is useful to override when combining multiple web service execution data by adding partial results to the response
-
-