This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Axis2 POJO web service - wsdl generating xs:anyType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis2 POJO web service - wsdl generating xs:anyType" Watch "Axis2 POJO web service - wsdl generating xs:anyType" New topic
Author

Axis2 POJO web service - wsdl generating xs:anyType

Flo Hum
Greenhorn

Joined: Sep 01, 2010
Posts: 3
Hi there.
I can't figure out how to get my a simple Axis2 v1.5 POJO web service to work (Tomcat 6).
Included is some simplified code below to see the "nested classes" - they are not internal classes.
I'm not returning an Object anywhere, the Classes are defined. I initially had List members
instead of using arrays thinking that may have been the problem - didn't make a difference.
Is Axis2 just incapable of returning a class object that has a member that is an array of another class type?
I know that WSDL first is preferred but that learning curve is a bit too steep at the moment.
Any help is appreciated.

public class MyWebService {
public getMyData (String filter) {
/* This one doesn't work. Looking at the wsdl, the response is a generated defined type
<xs:element minOccurs="0" name="return" nillable="true" type="ax24:MyData"/>
However, the wsdl doesn't define the MyData type properly.
xs:complexType name="MyData">
<xs:sequence>
<xs:element minOccurs="0" name="areagroup" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
*/

MyData result;
blah, blah....
return result;
}

public PointDef[] getPointDef(String filter) {
// This works. The wsdl has the complexType defined correctly for the PointDef class type.
PointDef[] result;
blah, blah....
return result
}

public Areagroup[] (String filter) {
/* This one doesn't work either. The wsdl defines the Areagroup type, but once again the array
of Area classes ends up as xs:anyType. Though the Precision class type ends up being defined properly.
*/

MyData result;
blah, blah....
return result.aryAreagroup;
}
}

public class MyData {
protected Areagroup[] aryAreagroup;
}

public class Areagroup {
protected int areagroupId;
protected String areagroupName;
protected Precision precision;
protected Area[] aryArea;
}

public class Precision {
protected int precisionCd;
protected String precisionDesc;
}

public class Area {
protected int areaId;
protected String areaName;
protected PointDef[] aryPointDef;
}

public class PointDef {
protected int ordinal;
protected double latitude;
protected double longitude;
}
Amit ChaudhariC
Ranch Hand

Joined: Aug 06, 2009
Posts: 33
Can you please post the wsdl that is getting generated.

Regards,
Amit
Flo Hum
Greenhorn

Joined: Sep 01, 2010
Posts: 3
Hi Amit, thanks for willing to take a look.
The java class for the web service only has 2 public methods to simplify things. The {PolygonDataType} would correspond to the {MyData} class in the original post.

Amit ChaudhariC
Ranch Hand

Joined: Aug 06, 2009
Posts: 33
Hi Flo,

There seems to be an issue with the wsdl that you provided.
How are you generating the wsdl ?
I could generate the wsdl based on the source code provided in your first comment .
After that i generated the server side classes. I am pasting the sample below as i think this is what you are expecting.


I am pasting the relevant wsdl part for your reference which will help you.


Please check if that helps .

Please let me know if it works.

Regards,
Amit
Flo Hum
Greenhorn

Joined: Sep 01, 2010
Posts: 3
Thanks Amit.
The WSDL I posted was generated by Axis2. I was merely trying to return the PolygonDataType POJO. I had tried to expand that WSDL and define the complex types as I recognized that was the problem, but when I set the useOriginalwsdl parameter to true in the services.xml, the web service completely broke.

I'll give it a another shot. Perhaps when using your own WDSL, instead of letting Axis2 auto-generate on the fly, the PolygonDataType must implement org.apache.axis2.databinding.ADBBean???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis2 POJO web service - wsdl generating xs:anyType
 
Similar Threads
How to make Axis2 bottom-up webservice make minOccurs="1" nillable="false"
XMLSpy won't work with our AXIS2 WSDL but our system works with it fine
XmlException on calling WSDL2Java
complextype with Axis2
REST client with POST verb - some help needed