[SalesForce] Metadata Deploy – Package.xml Failure

I am currently receiving an error when doing a metadata deploy. I have the following zip file structure:

Zip (File)
  --> Classes (Folder)
      --> MyCustomWrapper.cls (Class File)
      --> MyCustomWrapper.cls-meta.xml (Class Metadata)
  --> package.xml (File)

My package.xml is structured as follows:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <name>ApexClass</name>
    <members>MyCustomWrapper</members>
  </types>
  <version>35.0</version>
</Package>

This is what I get when I deploy the file via the Metadata Deploy in Workbench:

Metadata API Failure

Why is the deploy looking for a package.xml in the classes folder? Shouldn't it expect the package.xml to be in the root of the zip file?

Best Answer

You should contain the package within a single folder of the ZIP file, like this:

+ Zip File
|-- src
  |-- package.xml
  +-- classes
    |-- MyCustomWrapper.cls
    |-- MyCustomWrapper.cls-meta.xml

The system saw a single folder in the ZIP file, and assumed that that was the wrapper folder.