AnsweredAssumed Answered

Help With Invoking Query Webservice using Java

Question asked by diwakar.pathak on Oct 8, 2010
Latest reply on Aug 16, 2012 by divyang_agrawal
Hi,

I am trying to invoke a web service using Java for Clarity on a SaaS environment. I have used axis with -W option to generate
client stub classes. I am getting SAX exception. Below are the high level steps followed for invoking the Query webservice along with error.

// Create a service locator instance.
QueryQueryService_ServiceLocator service = new QueryQueryService_ServiceLocator();

QueryQueryPort port = service.getQueryQueryService();
Login in = new Login(strUserName,pwd);

// Login and save the session id
SessionId = port.login(in);

// Create an Authorization class instance
Auth header = new Auth(strUserName,pwd,SessionId);

// Create filter class instance
QueryFilter BBQF = new QueryFilter();

// Create Query class instance using query code
QueryQuery BBQ = new QueryQuery("BB_Login_Query",null);

//Set Filter.
BBQ.setFilter(BBQF);

// Create instance to store the result.
QueryQueryResult QueryResult = new QueryQueryResult();

//Set the end point address as the xog address
service.setQueryQueryServiceEndpointAddress("https://<serverip>/niku/xog"); // <--- Please note ours is a "https" ip address.

//****************************************
// Execute query using webservice
QueryResult = port.query(BBQ, header); //<--------- Getting an error here
//****************************************

// Instantiate Logout class
Logout out = new Logout(SessionId);

// Logout
port.logout(out);

Following is the stack trace of the error:

org.xml.sax.SAXException: Invalid element in com.niku.www.wsdl.query.QueryQueryResult - Status
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.niku.www.wsdl.query.QueryQuerySoapBindingStub.query(QueryQuerySoapBindingStub.java:230)
at com.niku.www.wsdl.query.AccessWebServiceLogin.main(AccessWebServiceLogin.java:58)

Any ideas to resolve the same?

Your help is highly appreciated.

Regards,
Nitin Gupta

Outcomes