Creating classes where the return type is dynamic
Ok guys here is the deal. I am working with IBM webservices through Content Manager. Because it is web services I have to compile the WSDL file which then becomes a static document (each one is hard coded per item). My question is some of the classes that help the communictation return a object initialized by this WSDL dll, This becomes a problem if columns are added/deleted or if a new souce is initiated. Because the return type is declared in the DLL how can I make that dynamic so depending on when the itemtype is called the function still works. example problem
Code:
public test_Bills retrievePolicy(AuthenticationData authData, string pidURI)
{
// Create a RetrieveItemRequest to setup the request for retrieving policy
RetrieveItemRequest request = new RetrieveItemRequest();
// Set the authentication information for the request
request.AuthenticationData = authData;
// we want the metadata and the content as url for the policy
request.retrieveOption = RetrieveItemRequestRetrieveOption.CONTENT;
request.contentOption = RetrieveItemRequestContentOption.URL;
request.Item = new RetrieveItemRequestItem();
// RetrieveItemRequestItem has a URI field which needs to be set to the PID Uri of the policy we want to retrieve
request.Item.URI = pidURI;
// invoke the CM webservice with the RetrieveItem operation
RetrieveItemReply reply = webservice.RetrieveItem(request);
// check to see if operation was successful
if (reply.RequestStatus.success == true)
{
// there should be only a single item returned.
// return the XYZ_InsPolicy object retrieved from the CM server
return reply.Item.ItemXML.test_Bills;
}
else
{
Console.WriteLine("Retrieve Policy failed.");
displayErrorInfo(reply.RequestStatus.ErrorData);
return null;
}
}
Thanks