3

I solved my metadata connection problem so now have hit the next obstacle, trying to create a com.sforce.soap.metadata.Folder object using

com.sforce.soap.metadata.Folder  aFolderObj = new com.sforce.soap.metadata.Folder();
aFolderObj.setFullName("MikeOwesMeABeer");
aFolderObj.setFolderShares( folderShare_arry);

Metadata[] meta_arry = new Metadata[1];
meta_arry[0] = (Metadata) aFolderObj;   

AsyncResult[] ar_arry = theApp.sfConnectionSandboxMetadata.create( meta_arry);

this last line throws error:

Must specify a {http://www.w3.org/2001/XMLSchema-instance}type attribute value for the {http://soap.sforce.com/2006/04/metadata}metadata element

There are references to how create() has problems with custom objects but Folder is not custom. How must I adjust my create() to get this working?

TIA,

Still-learning Steve

1
  • Hi Steve, how did you create the above classes around the Metadata API, it looks like your in Java yes? The error message relates to the xsi:type attribute missing, which tells Salesforce the type of Metadata component. This is normally added by the Web Service stack your using, hence the question. Apr 1, 2014 at 18:12

1 Answer 1

1

I figured it out: 1-> needed to connect with an authEndPoint of 28 instead of 24 2-> metadataConnection.create() wants to see a more-explicit class of Folder, like ReportFolder.

To wit:

com.sforce.soap.metadata.Folder aFolderObj = new com.sforce.soap.metadata.Folder();
aFolderObj.setName("RameshOwesMeBeer");
aFolderObj.setFullName("RameshOwesMeSeveralBeers");
aFolderObj.setAccessType(FolderAccessTypes.Shared);
aFolderObj.setFolderShares( folderShare_arry);

Metadata[] metadataObj_arry = new Metadata[1];
metadataObj_arry[0] = (Metadata) aFolderObj;    

AsyncResult[] ar_arry = theApp.sfConnectionSandboxMetadata.create( metadataObj_arry);

does not work whereas

com.sforce.soap.metadata.ReportFolder aRepFolderObj = new com.sforce.soap.metadata.ReportFolder();
aRepFolderObj.setName("RameshOwesMeBeer");
aRepFolderObj.setFullName("RameshOwesMeSeveralBeers");
aRepFolderObj.setAccessType(FolderAccessTypes.Shared);
aRepFolderObj.setFolderShares( folderShare_arry);

Metadata[] metadataObj_arry = new Metadata[1];
metadataObj_arry[0] = (Metadata) aRepFolderObj; 

AsyncResult[] ar_arry = theApp.sfConnectionSandboxMetadata.create( metadataObj_arry);

does

Thanks to all to read

CASE CLOSED

Still-learning Steve

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .