wood burning stoves*
The moose likes Web Services and the fly likes accessing attribute value from response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "accessing attribute value from response" Watch "accessing attribute value from response" New topic

accessing attribute value from response

Jomy George
Ranch Hand

Joined: Jan 13, 2011
Posts: 65
Hi friends,

I am using wsdl2Java for generating java class from WSDL.
when running this WSDL in soapUI i can see some attributes.
But in generated class i can't see variables, getter, and setters for these attributes.

for example if i can see like this in soapUI
<person sex="female">

in WSDL2Java produced java code, i couldnt find a variable named sex, but firstname, lastname are there.
Any solution for solving it?

Thanks in advance.....
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
0. Just Search for the text 'person' among the java and/or xml files generated. You probably see it.

1. if wsdl2java is running fine, then you should have client artifacts/code generated to call the web service provider.
(what is your soap engine? AXIS1, AXIS2, CXF etc...)

2. Pseudo-code/basic idea, for example:
RequestClass request=new RequestClass();

ResponseClass response = webservice.call (request);

then the response object will have the value for its property/fields defined.

3. Just code the point 2 and use the IDE debugger to see/examine response object. I used Eclipse IDE. Good luck.

Jomy George
Ranch Hand

Joined: Jan 13, 2011
Posts: 65
Thanks Paul,

In my file it looks like this.

and i tried to add sex like this. also added variable, getter and setter for sex.
but on accessing that variable i am getting null.
Jomy George
Ranch Hand

Joined: Jan 13, 2011
Posts: 65
on searching in Google i found some links

https://issues.apache.org/jira/browse/AXIS-2391. it says WSDL2Java ignore attibutes for complex types.

any idea?
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
1. Here is a test wsdl

2. I generated client code using AXIS1 WSDL2JAVA
3. I used it

4. I just wonder why don't you use the Locator class generated as the starting point for invoking the service provider.
5. If possible, can you list the file names generated by the wsdl2java?
Was there any error during the wsdl2java process?

wood burning stoves
subject: accessing attribute value from response
Similar Threads
order of request parameters causing unexpected subelement exception
Separating the Fraim from Menu
Java in XSLT
java bean vs. taglib: who should do the work?
Constructor that returns self