You need to sign in to do that
Don't have an account?
Fluffy
Need Help With DescribeGlobal()
Hello,
I'm using Java, and an axis 2 generated stub with xmlbeans option. I can perform most of
the operations from the API (like logging in, executing queries, etc). However, for some reason
I can't call the describeGlobal() function, and haven't been able to figure out why. My code is
as follows:
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
try{
SforceServiceStub stub = new SforceServiceStub();
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
LoginDocument ld = LoginDocument.Factory.newInstance();
Login l = Login.Factory.newInstance();
l.setUsername("abc@def.ghi.jk");
l.setPassword("xxxx");
ld.setLogin(l);
LoginScopeHeaderDocument lshd = LoginScopeHeaderDocument.Factory.newInstance();
LoginScopeHeader aLoginScopeHdr = LoginScopeHeader.Factory.newInstance();
lshd.setLoginScopeHeader(aLoginScopeHdr);
LoginResult lr = stub.login(ld, lshd).getLoginResponse().getResult();
stub = new SforceServiceStub(lr.getServerUrl());
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
SessionHeader sh = SessionHeader.Factory.newInstance();
sh.setSessionId(lr.getSessionId());
SessionHeaderDocument sd = SessionHeaderDocument.Factory.newInstance();
sd.setSessionHeader(sh);
DescribeGlobalDocument dgd = DescribeGlobalDocument.Factory.newInstance();
stub.describeGlobal(dgd, sd);
}
catch(Exception e)
{
e.printStackTrace();
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
The login is successful, however the describeGlobal() function throws me the following exception:
org.apache.axiom.om.OMException: java.lang.IllegalStateException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:211)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:127)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:328)
at com.sforce.soap.enterprise.SforceServiceStub.toOM(SforceServiceStub.java:6166)
at com.sforce.soap.enterprise.SforceServiceStub.toEnvelope(SforceServiceStub.java:6535)
at com.sforce.soap.enterprise.SforceServiceStub.describeGlobal(SforceServiceStub.java:1855)
Can anybody please suggest what I may be doing wrong here ? Should I be setting the session header
somehow differently ?
Thanks a lot for any suggestions,
regards,
-- Fluffy
I'm using Java, and an axis 2 generated stub with xmlbeans option. I can perform most of
the operations from the API (like logging in, executing queries, etc). However, for some reason
I can't call the describeGlobal() function, and haven't been able to figure out why. My code is
as follows:
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
try{
SforceServiceStub stub = new SforceServiceStub();
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
LoginDocument ld = LoginDocument.Factory.newInstance();
Login l = Login.Factory.newInstance();
l.setUsername("abc@def.ghi.jk");
l.setPassword("xxxx");
ld.setLogin(l);
LoginScopeHeaderDocument lshd = LoginScopeHeaderDocument.Factory.newInstance();
LoginScopeHeader aLoginScopeHdr = LoginScopeHeader.Factory.newInstance();
lshd.setLoginScopeHeader(aLoginScopeHdr);
LoginResult lr = stub.login(ld, lshd).getLoginResponse().getResult();
stub = new SforceServiceStub(lr.getServerUrl());
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
SessionHeader sh = SessionHeader.Factory.newInstance();
sh.setSessionId(lr.getSessionId());
SessionHeaderDocument sd = SessionHeaderDocument.Factory.newInstance();
sd.setSessionHeader(sh);
DescribeGlobalDocument dgd = DescribeGlobalDocument.Factory.newInstance();
stub.describeGlobal(dgd, sd);
}
catch(Exception e)
{
e.printStackTrace();
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
The login is successful, however the describeGlobal() function throws me the following exception:
org.apache.axiom.om.OMException: java.lang.IllegalStateException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:211)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:127)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:328)
at com.sforce.soap.enterprise.SforceServiceStub.toOM(SforceServiceStub.java:6166)
at com.sforce.soap.enterprise.SforceServiceStub.toEnvelope(SforceServiceStub.java:6535)
at com.sforce.soap.enterprise.SforceServiceStub.describeGlobal(SforceServiceStub.java:1855)
Can anybody please suggest what I may be doing wrong here ? Should I be setting the session header
somehow differently ?
Thanks a lot for any suggestions,
regards,
-- Fluffy