You need to sign in to do that
Don't have an account?
Fluffy
Hello, I am having a problem executing queries from my Java code. I have generated the SforceServiceStub.java from the wsdl file, and I am able to connect to the salesforce server successfully. Moreover, the describeGlobal()
function runs great, and returns all the object types. However, when executing
queries, I'm getting the error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java.lang.RuntimeException: Unsupported type urn:sobject.enterprise.soap.sforce.com Contact
at com.sforce.soap.enterprise.SforceServiceStub$ExtensionMapper.getTypeObject(SforceServiceStub.java:25165)
at com.sforce.soap.enterprise.SforceServiceStub$SObject$Factory.parse(SforceServiceStub.java:16678)
at com.sforce.soap.enterprise.SforceServiceStub$QueryResult$Factory.parse(SforceServiceStub.java:21263) at com.sforce.soap.enterprise.SforceServiceStub$QueryResponse$Factory.parse(SforceServiceStub.java:40935)
at com.sforce.soap.enterprise.SforceServiceStub.fromOM(SforceServiceStub.java:25016)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my code is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class SampleLogin {
public static void main(String args[]) {
SforceServiceStub stub = new SforceServiceStub();
Options options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
Login lg = new Login();
lg.setPassword("********");
lg.setUsername("*******");
LoginScopeHeader lsh = null;
LoginResponse response = stub.login(lg, lsh);
LoginResult lr = response.getResult();
SessionHeader sh = new SessionHeader();
sh.setSessionId(lr.getSessionId());
stub = new SforceServiceStub(lr.getServerUrl());
options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
QueryOptions qOptions = new QueryOptions();
qOptions.setBatchSize(200);
Query q = new Query();
q.setQueryString("select AccountId from Contact");
QueryResponse qResponse = stub.query(q, sh, qOptions, null);
QueryResult qr = qResponse.getResult();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Can anyone suggest what am I doing wrong, and point in the right direction ?
Thanks a bunch ahead,
:0)
--Fluffy
Problems Executing Queries with Web Services API
Hello, I am having a problem executing queries from my Java code. I have generated the SforceServiceStub.java from the wsdl file, and I am able to connect to the salesforce server successfully. Moreover, the describeGlobal()
function runs great, and returns all the object types. However, when executing
queries, I'm getting the error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java.lang.RuntimeException: Unsupported type urn:sobject.enterprise.soap.sforce.com Contact
at com.sforce.soap.enterprise.SforceServiceStub$ExtensionMapper.getTypeObject(SforceServiceStub.java:25165)
at com.sforce.soap.enterprise.SforceServiceStub$SObject$Factory.parse(SforceServiceStub.java:16678)
at com.sforce.soap.enterprise.SforceServiceStub$QueryResult$Factory.parse(SforceServiceStub.java:21263) at com.sforce.soap.enterprise.SforceServiceStub$QueryResponse$Factory.parse(SforceServiceStub.java:40935)
at com.sforce.soap.enterprise.SforceServiceStub.fromOM(SforceServiceStub.java:25016)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
my code is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class SampleLogin {
public static void main(String args[]) {
SforceServiceStub stub = new SforceServiceStub();
Options options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
Login lg = new Login();
lg.setPassword("********");
lg.setUsername("*******");
LoginScopeHeader lsh = null;
LoginResponse response = stub.login(lg, lsh);
LoginResult lr = response.getResult();
SessionHeader sh = new SessionHeader();
sh.setSessionId(lr.getSessionId());
stub = new SforceServiceStub(lr.getServerUrl());
options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
QueryOptions qOptions = new QueryOptions();
qOptions.setBatchSize(200);
Query q = new Query();
q.setQueryString("select AccountId from Contact");
QueryResponse qResponse = stub.query(q, sh, qOptions, null);
QueryResult qr = qResponse.getResult();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Can anyone suggest what am I doing wrong, and point in the right direction ?
Thanks a bunch ahead,
:0)
--Fluffy
Superfell
Which SOAP toolkit are you using ?