You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sidharth Kuruvila <si...@gmail.com> on 2006/08/30 21:58:54 UTC

[Axis2]java.lang.IllegalStateException when calling salesforce.com api methods

Following the advice on
http://www.pocketsoap.com/weblog/2006/05/1623.htmlon getting the
salesforce.com apis to work with axis2

I generated the source using
WSDL2Java.bat -uri enterprise.wsdl  -d xmlbeans

The method for Logging in works fine but when it comes to executing any
other method

I get an IllegalStateException

org.apache.axiom.om.OMException: java.lang.IllegalStateException
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(
StAXOMBuilder.java:206)
        at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement
(OMDocumentImpl.java:144)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement
(StAXOMBuilder.java:322)
        at org.apache.axis2.SforceServiceStub.toOM(SforceServiceStub.java
:5258)
        at org.apache.axis2.SforceServiceStub.toEnvelope(
SforceServiceStub.java:5269)
        at org.apache.axis2.SforceServiceStub.describeGlobal(
SforceServiceStub.java:3295)
        at SforceDataReader.main(SforceDataReader.java:46)
Caused by: java.lang.IllegalStateException
        at
org.apache.xmlbeans.impl.store.Jsr173$XMLStreamReaderForString.next(
Jsr173.java:1110)
        at org.apache.xmlbeans.impl.store.Jsr173$SyncedJsr173.next(
Jsr173.java:1138)
        at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(
StAXOMBuilder.java:123)
        ... 6 more

Looking at the source for xmlbeans Jsr173$XMLStreamReaderForString.next will
always throw the exception.


-- 
I am but a man.

Re: [Axis2]java.lang.IllegalStateException when calling salesforce.com api methods

Posted by Sidharth Kuruvila <si...@gmail.com>.
Thanks Ajith,

Instantiating the object inside the Document object fixed the problem.

On 31-Aug-06, at 6:12 AM, Ajith Ranabahu wrote:

> Hi,
> I've added the solution to the Jira already. It seems that your code
> is missing a crucial assignment statement. If you can post the code
> (atleast a piece of it) I'll be happy to correct it for you.
> Just to give you an Idea where things might go wrong here is the code
> that was listed in the Jira
>
> CreateDocument createDoc = CreateDocument.Factory.newInstance();
> Create create = Create.Factory.newInstance();
> Account acc = Account.Factory.newInstance();
> acc.setName("Axis 2.0/Enterprise");
> acc.setAccountNumber("Acc9999");
> create.setSObjectsArray(new SObject [] {acc});
> SaveResult sr = stub.create(createDoc, sd,
> ard).getCreateResponse().getResultArray(0);
>
> This code is missing a crucial statement!
> The corrected code is as follows
>
> CreateDocument createDoc = CreateDocument.Factory.newInstance();
> Create create = Create.Factory.newInstance();
> Account acc = Account.Factory.newInstance();
> acc.setName("Axis 2.0/Enterprise");
> acc.setAccountNumber("Acc9999");
> create.setSObjectsArray(new SObject [] {acc});
> *createDoc.setCreate(create);*  <------ the missing assignment
> SaveResult sr = stub.create(createDoc, sd,
> ard).getCreateResponse().getResultArray(0);
>
> unfortunately XMLBeans does not provide a very meaningful error
> message in this case
>
> HTH
> Ajith
>
>
> On 8/30/06, Sidharth Kuruvila <si...@gmail.com> wrote:
>> I missed this before, someone has already filed a bug report on  
>> this one.
>>
>> http://issues.apache.org/jira/browse/AXIS2-266
>>
>> The issue seems to be marked as resolved as this is a XMLBeans  
>> bug. Some
>> clarification might be helpful here.
>>
>
>
>
> -- 
> Ajith Ranabahu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2]java.lang.IllegalStateException when calling salesforce.com api methods

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,
I've added the solution to the Jira already. It seems that your code
is missing a crucial assignment statement. If you can post the code
(atleast a piece of it) I'll be happy to correct it for you.
Just to give you an Idea where things might go wrong here is the code
that was listed in the Jira

CreateDocument createDoc = CreateDocument.Factory.newInstance();
Create create = Create.Factory.newInstance();
Account acc = Account.Factory.newInstance();
acc.setName("Axis 2.0/Enterprise");
acc.setAccountNumber("Acc9999");
create.setSObjectsArray(new SObject [] {acc});
SaveResult sr = stub.create(createDoc, sd,
ard).getCreateResponse().getResultArray(0);

This code is missing a crucial statement!
The corrected code is as follows

CreateDocument createDoc = CreateDocument.Factory.newInstance();
Create create = Create.Factory.newInstance();
Account acc = Account.Factory.newInstance();
acc.setName("Axis 2.0/Enterprise");
acc.setAccountNumber("Acc9999");
create.setSObjectsArray(new SObject [] {acc});
*createDoc.setCreate(create);*  <------ the missing assignment
SaveResult sr = stub.create(createDoc, sd,
ard).getCreateResponse().getResultArray(0);

unfortunately XMLBeans does not provide a very meaningful error
message in this case

HTH
Ajith


On 8/30/06, Sidharth Kuruvila <si...@gmail.com> wrote:
> I missed this before, someone has already filed a bug report on this one.
>
> http://issues.apache.org/jira/browse/AXIS2-266
>
> The issue seems to be marked as resolved as this is a XMLBeans bug. Some
> clarification might be helpful here.
>



-- 
Ajith Ranabahu

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2]java.lang.IllegalStateException when calling salesforce.com api methods

Posted by Sidharth Kuruvila <si...@gmail.com>.
I missed this before, someone has already filed a bug report on this one.

http://issues.apache.org/jira/browse/AXIS2-266

The issue seems to be marked as resolved as this is a XMLBeans bug. Some
clarification might be helpful here.

On 8/31/06, robert lazarski <ro...@gmail.com> wrote:
>
> There was some bugs with xmlbeans in the 1.0 that have been fixed
> already. Can you try a nightly and if you have problems still, file a
> jira and upload you wsdl?
>
> http://people.apache.org/dist/axis2/nightly/
>
> HTH,
> Robert
> http://www.braziloutsource.com/
>
> On 8/30/06, Sidharth Kuruvila <si...@gmail.com> wrote:
> > Following the advice on
> > http://www.pocketsoap.com/weblog/2006/05/1623.html on
> > getting the salesforce.com apis to work with axis2
> >
> > I generated the source using
> > WSDL2Java.bat -uri enterprise.wsdl  -d xmlbeans
> >
> > The method for Logging in works fine but when it comes to executing any
> > other method
> >
> > I get an IllegalStateException
> >
> > org.apache.axiom.om.OMException: java.lang.IllegalStateException
> >         at
> > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java
> :206)
> >         at
> > org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement
> > (OMDocumentImpl.java:144)
> >         at
> > org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(
> StAXOMBuilder.java:322)
> >         at
> > org.apache.axis2.SforceServiceStub.toOM(SforceServiceStub.java:5258)
> >         at
> > org.apache.axis2.SforceServiceStub.toEnvelope(SforceServiceStub.java
> :5269)
> >         at
> > org.apache.axis2.SforceServiceStub.describeGlobal(SforceServiceStub.java
> :3295)
> >         at SforceDataReader.main(SforceDataReader.java :46)
> > Caused by: java.lang.IllegalStateException
> >         at
> > org.apache.xmlbeans.impl.store.Jsr173$XMLStreamReaderForString.next(
> Jsr173.java:1110)
> >         at
> > org.apache.xmlbeans.impl.store.Jsr173$SyncedJsr173.next(
> > Jsr173.java:1138)
> >         at
> > org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
> >         at
> > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java
> :123)
> >         ... 6 more
> >
> > Looking at the source for xmlbeans
> > Jsr173$XMLStreamReaderForString.next will always throw the
> > exception.
> >
> >
> > --
> > I am but a man.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
I am but a man.

Re: [Axis2]java.lang.IllegalStateException when calling salesforce.com api methods

Posted by robert lazarski <ro...@gmail.com>.
There was some bugs with xmlbeans in the 1.0 that have been fixed
already. Can you try a nightly and if you have problems still, file a
jira and upload you wsdl?

http://people.apache.org/dist/axis2/nightly/

HTH,
Robert
http://www.braziloutsource.com/

On 8/30/06, Sidharth Kuruvila <si...@gmail.com> wrote:
> Following the advice on
> http://www.pocketsoap.com/weblog/2006/05/1623.html on
> getting the salesforce.com apis to work with axis2
>
> I generated the source using
> WSDL2Java.bat -uri enterprise.wsdl  -d xmlbeans
>
> The method for Logging in works fine but when it comes to executing any
> other method
>
> I get an IllegalStateException
>
> org.apache.axiom.om.OMException: java.lang.IllegalStateException
>         at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:206)
>         at
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement
> (OMDocumentImpl.java:144)
>         at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:322)
>         at
> org.apache.axis2.SforceServiceStub.toOM(SforceServiceStub.java:5258)
>         at
> org.apache.axis2.SforceServiceStub.toEnvelope(SforceServiceStub.java:5269)
>         at
> org.apache.axis2.SforceServiceStub.describeGlobal(SforceServiceStub.java:3295)
>         at SforceDataReader.main(SforceDataReader.java :46)
> Caused by: java.lang.IllegalStateException
>         at
> org.apache.xmlbeans.impl.store.Jsr173$XMLStreamReaderForString.next(Jsr173.java:1110)
>         at
> org.apache.xmlbeans.impl.store.Jsr173$SyncedJsr173.next(
> Jsr173.java:1138)
>         at
> org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
>         at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:123)
>         ... 6 more
>
> Looking at the source for xmlbeans
> Jsr173$XMLStreamReaderForString.next will always throw the
> exception.
>
>
> --
> I am but a man.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org