I'm updating MetadataService.cls form a older version for v29 to the current version v32 and found some members maybe missing:
- MetadataPort.checkStatus(String[] asyncProcessId)
- MetadataPort.checkDeployStatus(String asyncProcessId)
- MetadataService.checkStatus_element
- checkStatusResponse_element
In the earlier version the use case (which now results in an error ) was to e.g. retrieve metadata like this
public PageReference checkAsyncRequestRetrieve() {
errors = 0;
// Check the status of the retrieve request
MetadataService.MetadataPort
service = createService();
MetadataService.AsyncResult[]
aysncResults = service.checkStatus(new String[] { AsyncResultRetrieve.Id });
if(aysncResults[0].done) {
if(aysncResults[0].state == 'Error') { // async errors:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, aysncResults[0].message));
AsyncResultRetrieve = null;
} else { // async no errors:
MetadataService.RetrieveResult // Place Base64 encoded zip data onto the page for the JSZip library to handle
retrieveResult = service.checkRetrieveStatus(AsyncResultRetrieve.id);
if(retrieveResult.messages != null) {
xt.msg('Error '+retrieveResult.messages[0].problem ,'error');
errors = 1;
} else {
xt.msg('Retrieved '+MetaDataItem,'confirm');
}
MetaDataRetrieveZip = retrieveResult.zipFile;
MetadataFiles = new List<MetadataFile>();
AsyncResultRetrieve = null;
Retrieving = false;
}
}
return null;
}
However I found that all works like before by simply copying those members back to the new MetadataService.cls for v32
public class MetadataPort { // around line 9120
// ....
public MetadataService.AsyncResult[] checkStatus(String[] asyncProcessId) {
MetadataService.checkStatus_element request_x = new MetadataService.checkStatus_element();
MetadataService.checkStatusResponse_element response_x;
request_x.asyncProcessId = asyncProcessId;
Map<String, MetadataService.checkStatusResponse_element> response_map_x = new Map<String, MetadataService.checkStatusResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://soap.sforce.com/2006/04/metadata',
'checkStatus',
'http://soap.sforce.com/2006/04/metadata',
'checkStatusResponse',
'MetadataService.checkStatusResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.result;
}
public MetadataService.DeployResult checkDeployStatus(String asyncProcessId) {
MetadataService.checkDeployStatus_element request_x = new MetadataService.checkDeployStatus_element();
MetadataService.checkDeployStatusResponse_element response_x;
request_x.asyncProcessId = asyncProcessId;
request_x.includeDetails = true;
Map<String, MetadataService.checkDeployStatusResponse_element> response_map_x = new Map<String, MetadataService.checkDeployStatusResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://soap.sforce.com/2006/04/metadata',
'checkDeployStatus',
'http://soap.sforce.com/2006/04/metadata',
'checkDeployStatusResponse',
'MetadataService.checkDeployStatusResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.result;
}
// ...
}
and also
public class MetadataService {
public class checkStatus_element {
public String[] asyncProcessId;
private String[] asyncProcessId_type_info = new String[]{'asyncProcessId','http://soap.sforce.com/2006/04/metadata','ID','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'asyncProcessId'};
}
public class checkStatusResponse_element {
public MetadataService.AsyncResult[] result;
private String[] result_type_info = new String[]{'result','http://soap.sforce.com/2006/04/metadata','AsyncResult','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'result'};
}
}
So my questions are:
- are those members being removed on purpose or are the simply missing?
- UPDATE: this answered by @gaiser
- if they are removed on purpose, is there now a new pattern to handle the retrieve and deploy as described in the use case above?