3

We haven't had to build a new version of the partner wsdl jar for SOAP API work since version 12 and things have changed a bit. I'm trying to work with v43.0, but I'm doing something wrong. I've tried following the quickstart guide, but I can't seem to get a SObject class generated that has the get_any method our codebase and examples documents should be there.

All dependency jars are local:

java -classpath force-wsc-43.0.0.jar:ST-4.0.8.jar:axis-1.4.jar com.sforce.ws.tools.wsdlc production.partner.wsdl.xml sf-api-43.partner.jar

I understand that axis somehow provides this to the sObject, but I've not uncovered how or what I'm doing wrong here.

Should I be seeing a get_any method on the SObject class in the resulting jar? (or anywhere in that jar?)

  • What did this method do? – Adrian Larson May 19 '19 at 14:18
  • SObject.get_any() returns an array of MessageElement objects. All the samples that use the Partner WSDL show it being used to iterate over the fields present on the SObject. – Chad Hill May 19 '19 at 18:22
  • Do you have a link which demonstrates that somewhere? I did a quick search and didn't find anything promising. – Adrian Larson May 19 '19 at 18:26
  • I find samples on other sites, but now that I'm realizing the samples for v43 api don't show field iteration. I wonder if the lack of results from developer.salesforce.com docs is indicating it's been fully removed from the newer versions of the API in favor of something else. – Chad Hill May 19 '19 at 19:17
0

Answering my own question after putting this problem down and returning to it over the holiday. Hope this saves the next person to hit this wall.

When using Axis 1.4, as the get_any method is no longer provided by the sObject class from the force-wsc project, you must use getChildren (defined on the super class of sObject, XmlObject). It will return an Iterator of XmlObjects.

Get the name of a field via getName().getLocalPart() on each XmlObject. The value via getValue().

public static String toString(SObject sObject) {
    StringBuilder buf = new StringBuilder();

    buf.append(sObject.getType()).append(" ").append(sObject.getId()).append("\n");

    Iterator<XmlObject> fields = sObject.getChildren();
    while(fields.hasNext()) {
        XmlObject field = fields.next();
        buf.append("\t").append(field.getName().getLocalPart()).append("=").append(field.getValue()).append("\n");
    }

    return buf.toString();
}

Note its different with Axis 2. I did not explore upgrading my Axis.

|improve this answer|||||

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.