I have a method
import com.sforce.soap.enterprise.*; import com.sforce.soap.enterprise.sobject.*; .... public static EnterpriseConnection connectToSalesforce() throws ConnectionException { EnterpriseConnection connection = null; String username = "myname"; String password = "mysecret"; String securityToken = "bigstring"; String authEndPoint = "https://test.salesforce.com/services/Soap/c/24.0/"; ConnectorConfig connConfig = new ConnectorConfig(); connConfig.setUsername(username); connConfig.setPassword(password + securityToken); connConfig.setAuthEndpoint(authEndPoint); connection = new EnterpriseConnection(connConfig); return connection; }
that works great. Now I need to experiment with Metadata API so I copied the above with a few tweaks
import com.sforce.soap.enterprise.*; import com.sforce.soap.enterprise.sobject.*; import com.sforce.soap.metadata.*; .... public static MetadataConnection connectToSalesforceMetadata() throws ConnectionException { MetadataConnection connection = null; String username = "myname"; String password = "mysecret"; String securityToken = "bigstring"; String authEndPoint = "https://test.salesforce.com/services/Soap/c/24.0/"; ConnectorConfig connConfig = new ConnectorConfig(); connConfig.setUsername(username); connConfig.setPassword(password + securityToken); connConfig.setAuthEndpoint(authEndPoint); connection = new MetadataConnection(connConfig); return connection; }
But connectToSalesforceMetadata() fails with a MalformedURLException. What's up with that?
Follow-on question: the Metadata API makes reference to a createMetadata() method that returns a SaveResult[] . But I don't have visibility to that method from neither an instance of EnterpriseConnection nor MetadataConnection . Am I missing an import ?
TIA,
Still-learning Steve