public class WSExecuteOperation extends BaseUpdateOperation
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 overriding createRequest(java.io.InputStream)
to alter
the input data (e.g. adding custom webservice headers) and overriding handleResponse(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 and Description |
---|
WSExecuteOperation(WSConnection<OperationContext> conn) |
Modifier and Type | Method and 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 to
WebServiceExecutor.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.
|
execute
getContext
public WSExecuteOperation(WSConnection<OperationContext> conn)
public WSOperationConnection getConnection()
ContextualOperation
getConnection
in class ContextualOperation
protected void executeUpdate(UpdateRequest request, OperationResponse response)
Default implementation gets the operation name from getOperationName()
, creates a WebServiceExecutor via
the WSConnection#createExecutor
and calls
executeUpdate(ObjectData,WebServiceExecutor,OperationResponse)
for each input object.
executeUpdate
in class BaseUpdateOperation
request
- request given to BaseUpdateOperation.execute(com.boomi.connector.api.OperationRequest, com.boomi.connector.api.OperationResponse)
, downcast to the correct typeresponse
- response given to BaseUpdateOperation.execute(com.boomi.connector.api.OperationRequest, com.boomi.connector.api.OperationResponse)
protected String getOperationName()
Default implementation returns getContext().getObjectTypeId()
.
protected com.boomi.webservices.WebServiceRequest createRequest(InputStream reqStream) throws Exception
WebServiceExecutor.execute(org.w3c.dom.Document)
. Called by
executeUpdate(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.
reqStream
- the InputStream from the the input ObjectDataException
protected void executeUpdate(ObjectData execData, com.boomi.webservices.WebServiceExecutor executor, OperationResponse response) throws Exception
Default implementation executes the webservice operation using the input returned by createRequest(java.io.InputStream)
and
processes the results by calling handleResponse(com.boomi.connector.api.ObjectData, com.boomi.webservices.WebServiceResponse, com.boomi.connector.api.OperationResponse)
.
execData
- the input data to the webservice operationexecutor
- the configured WebServiceExecutor for executing the webservice operationresponse
- SDK context for returning resultsException
protected void handleResponse(ObjectData execData, com.boomi.webservices.WebServiceResponse wsResponse, OperationResponse response) throws Exception
executeUpdate(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 to WSConnection.isApplicationFault(com.boomi.webservices.WebServiceResponse)
.
Exception
protected void addResult(ObjectData execData, OperationResponse response, OperationStatus status, String statusCode, String statusMessage, Payload payload)
handleResponse(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