| Author |
accessing attribute value from response
|
Jomy George
Ranch Hand
Joined: Jan 13, 2011
Posts: 59
|
|
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">
<firstname>Anna</firstname>
<lastname>Smith</lastname>
</person>
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: 299
|
|
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();
request.setParameter(x);
etc...
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: 59
|
|
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: 59
|
|
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: 299
|
|
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?
|
 |
 |
|
|
subject: accessing attribute value from response
|
|
|