alexis
alexis

Reputation: 1211

java web service wsdl: Getting data out of a responce variable

Very new to web services (as you can tell from the Q) so i am pretty sure this is a basic question.

I am sending the request of to the server

ExecuteSQLQueryReq sqlParams = new ExecuteSQLQueryReq();
sqlParams.setSql(sqlState.getNoDevInDP("LIV_Phones_DP"));

and getting the response i expect:

ExecuteSQLQueryRes getSqlResult = axlPort.executeSQLQuery(sqlParams);

i can see all the data is there in the object from the eclipse debugging enter image description here

but from the object "getSqlResult" i dont know how to pull the data out. The response is in the following format: enter image description here

Any help would be great

Thanks Alexis

EDIT: Screen shot of "ExecuteSQLQueryRes". The only methods i see is to return a list of Objects, which i do and that the screenshot of the variables in eclipse you mention. Its the next step .... how to get from a generic Object the data out..

enter image description here

Upvotes: 0

Views: 380

Answers (1)

McDowell
McDowell

Reputation: 108909

From the type signatures, I'd say you would invoke the service like so:

List<Object> rows = axlPort.executeSQLQuery(sqlParams)
                           .getReturn()
                           .getRow();
for(Object row : rows) {
    Element rowElement = (Element) row;
    // utilize DOM API
}

As far as I can tell from the information posted you're getting a List of Elements. In XML:

<row>?</row>
<row>?</row>
<row>?</row>

Since row is anyType nothing specific can be inferred about its structure. In the specific case, the first entry looks like this assuming a single child (text) node:

<row>339</row>

You can use the Java DOM APIs to access the data.

From the name onwards, this service looks like it just exposes the underlying database implementation. Consider adhering to stricter SOA principles if you have any influence over the service design.

Upvotes: 1

Related Questions