I am sending a series of SOAP messages to a server and capturing the results of the SOAP transaction. The issue that I am having is that I need to perform five SOAP calls, and each call requires some data from the previous call. This has led me to create a Data Class that holds Strings accessible with Getters and Setters that gets modified after each call. This code seems "smelly" to me, there is a lot of state change going on in the class and I'm just wondering if there is a better way to go about this.
Here is what's going on, I have the following method in an abstract class:
protected SoapBodyParameters soapBodyParameters;
public void release(String primaryConfigurationIdentifier) throws ReleaseManagerException {
this.soapBodyParameters.setPrimaryConfigurationItemIdentifier(primaryConfigurationIdentifier);
// Implemented by child - Will throw an exception if bad configuration
verify();
// Get user full name and append soapBodyParameters
String userFullName = sendGetUserInfoSoapMessage(this.soapBodyParameters);
this.soapBodyParameters.setUserFullName(userFullName);
// Create a release package on the server - no return needed
sendCreateReleasePackageFromLocalFilesSoapMessage(this.soapBodyParameters);
// Find the release package ID we just made and append soapBodyParameters
String releasePackageSystemId = sendGetReleasePackagesSoapMessage(this.soapBodyParameters);
this.soapBodyParameters.setReleasePackageSystemId(releasePackageSystemId);
// Open the release package and find the task model information
TaskModel taskModel = sendOpenReleasePackageSoapMessage(this.soapBodyParameters);
this.soapBodyParameter.setTaskModelFile(taskModel.getIARTaskModel());
this.soapBodyParameters.setTaskModelId(taskModel.getTaskModelId());
// Implemented by child - Update the task model with required info
updateLocalTaskModel(this.soapBodyParameters);
// Save the task model to the release package on the server
sendSaveTaskModelSoapMessage(this.soapBodyParameters);
}
So with each of these calls modifying soapBodyParameters and each following call relying on the previous call to modify soapBodyParameters.... I don't know, it just feels smelly. Like I am faking a global parameter in the class.
Is there a better way to do this? I'm trying to get better at recognizing when and where a design pattern would be more appropriate.