You need to sign in to do that
Don't have an account?
David Bailey 16
Force.com WSC Metadata API Java Sample Syntax Errors
In the original Salesforce article "Introduction to the Force.com Web Services Connector" by Jeff Douglas, Developer Advocate, everything works just fine code-wise, until one gets to the WCS Metadata API Java code sample. That sample code generates two syntax errors ...
Line 54: AsyncResult[] ars = metadataConnection.create(new CustomObject[] { co });
- The method create(CustomObject[]) is undefined for the type MetadataConnection
Line 72: arsStatus = metadataConnection.checkStatus(ids);
- The method checkStatus(String[]) is undefined for the type MetadataConnection
This currently occurs using the "force-wsc-38.0.0-uber.jar" jar file. Can you kindly tell me what I need to do to fix these errors? Cheers,
David
Line 54: AsyncResult[] ars = metadataConnection.create(new CustomObject[] { co });
- The method create(CustomObject[]) is undefined for the type MetadataConnection
Line 72: arsStatus = metadataConnection.checkStatus(ids);
- The method checkStatus(String[]) is undefined for the type MetadataConnection
This currently occurs using the "force-wsc-38.0.0-uber.jar" jar file. Can you kindly tell me what I need to do to fix these errors? Cheers,
David
Uh, replacing the create() method with the createMetadata() method eliminated the "The method create(CustomObject[]) is undefined for the type MetadataConnection" error, but created the "Type mismatch: cannot convert from SaveResult[] to AsyncResult[]" error. Likewise, replacing the checkStatus() method with checkRetrieveStatus() method, eliminated the "The method checkStatus(String[]) is undefined for the type MetadataConnection" error, but created the "The method checkRetrieveStatus(String, boolean) in the type MetadataConnection is not applicable for the arguments (String[])" error. So, it seems like making these arbitrary substutitions without understanding what the methods are actually supposed to do will start a game of "whack a mole", which could go on indefinitely.
So, here's my question, where is the documentation for the WSC Metadata API classes kept, so I can try to figure out what's going on? It's been a long time since I've programmed in Java, so I'm way, way rusty. So, if there are any SFDC Java "heavies" out there reading this, please steer me to where the WSC Metaata API Java docs live, and toss me a hint about what should be done to replace the create() and checkStatus() methods.
I'm pretty sure that SFDC doesn't want errant code hanging around in examples that are supposed to be teaching new developers stuff. But I can't seem to get in touch with the author of this code, Jeff Douglas. Hey, maybe he'll see this discussion and "step up". Or, maybe one of his "homies" will see it and pass it along to him.
Thanks,
David
All Answers
• Jeff Douglas' Introduction to the Force.com Web Services Connector article link:
- https://developer.salesforce.com/page/Introduction_to_the_Force.com_Web_Services_Connector
And, here's the WSC Metadata API Sample Java Code from the article (that contains the two syntax errors on lines 54 and 72) ...
Uh, the metadataConnection class does not contain a create() method (line 54) and a checkStatus() method (line 72).
Uh, replacing the create() method with the createMetadata() method eliminated the "The method create(CustomObject[]) is undefined for the type MetadataConnection" error, but created the "Type mismatch: cannot convert from SaveResult[] to AsyncResult[]" error. Likewise, replacing the checkStatus() method with checkRetrieveStatus() method, eliminated the "The method checkStatus(String[]) is undefined for the type MetadataConnection" error, but created the "The method checkRetrieveStatus(String, boolean) in the type MetadataConnection is not applicable for the arguments (String[])" error. So, it seems like making these arbitrary substutitions without understanding what the methods are actually supposed to do will start a game of "whack a mole", which could go on indefinitely.
So, here's my question, where is the documentation for the WSC Metadata API classes kept, so I can try to figure out what's going on? It's been a long time since I've programmed in Java, so I'm way, way rusty. So, if there are any SFDC Java "heavies" out there reading this, please steer me to where the WSC Metaata API Java docs live, and toss me a hint about what should be done to replace the create() and checkStatus() methods.
I'm pretty sure that SFDC doesn't want errant code hanging around in examples that are supposed to be teaching new developers stuff. But I can't seem to get in touch with the author of this code, Jeff Douglas. Hey, maybe he'll see this discussion and "step up". Or, maybe one of his "homies" will see it and pass it along to him.
Thanks,
David