I have created deploy folder with all correct metadata definitions. If I compress the folder using java program and try to deploy it using DeploySample java code, get success in console but no metadata gets deployed to the org.

However if I compress the same folder manually (right click -->send to --> compressed folder) and run DeploySample, it successfully deploys the metadata.

  • The Metadata API is sensitive to folder structure. If you unzip the two archives, are they 100% identical, including how many levels of folders are nested at the root? – David Reed Jul 6 '18 at 13:38
  • @DavidReed - Folder structure is correct and working fine when compressed manually. Also it maintains same structure after compressing using my java code. I suspect the problem is with zip encoding. – Ashish Naware Jul 6 '18 at 13:48

If, upon opening the ZIP file, the package.xml file is in the root, make sure you set singlePackage in the deployOptions parameter to true. If the root is just another folder that then contains package.xml, set singlePackage to false instead. You can read more about it in the deploy() documentation. Please note that ZIP files do not have an "encoding"; it is a standard documented file format, so assuming the files and folder structure are correct, there should be no difference between how they're created. There's no such thing as a "encoding" for a ZIP file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.