2

I am trying to make this sample code work, http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_deploy.htm.

It is just a one class java project. When I run it I have deploy.zip, which contains:

  • SimpleClass.cls

  • package.xml - WHICH contains:


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

The program says success, but the class is not changed in the org. The Deployment status says success: "Deploy Components 0/0".

Why it doesn't recognize the class in the package?

Did anyone make such a thing before successfully? What the content of deploy.zip should be like?

1
  • I use Partner WSDL, if that of any help. And I get a success message in the java code and in the Org I deploy to. I didn't do any changes to the example code stated in the SF documentation, except login details. Please help, this is urgent for me. Thanks. Jun 5 '14 at 8:56
1

The zip file should have "package.xml" at its root and the class file called "SimpleClass.cls" plus its meta-data file "SimpleClass-meta.xml" should be in a folder called "classes".

This information is somewhat hidden, but see "Declarative Metadata File Suffix and Directory Location" on page 94 of the Metadata API Developer’s Guide.

The Force.com IDE presents the files in the same layout that is required for this API.


This is the right contents of the .zip for your case.

unpackaged\
       package.xml
       classes\
               SimpleClass.cls
               SimpleClass.cls-meta.xml
5
  • Thanks for your answer. I did that, it said that there should be a package.xml in the classes folder. I put the a default package.xml, with no <types> section. It said "SUCCESS", but the result is the same that I had previously, the file is not updated. I then put the same package.xml as in the root of the zip. It now asks for the .cls file)). Did you try to use it yourself? It is very easy if you already have an Org. Since the Java example is one class project. Jun 5 '14 at 9:21
  • I've written some Ant tasks that use this API but that was a couple of years ago. I suggest you run the RetrieveSample that is in the PDF and see what the format is in that zip file.
    – Keith C
    Jun 5 '14 at 9:31
  • Keith C, your idea to retrieve first ruled! See my answer below. Thanks. Jun 5 '14 at 10:35
  • Yuk "unpackaged" - who would have guessed that. (I can't see mention of that in the Metadata API Developer’s Guide.)
    – Keith C
    Jun 5 '14 at 10:52
  • Yeah, you have no idea how many things/combinations I tried before)). I put the answer to my question above. Jun 5 '14 at 10:57

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.