*
The moose likes Web Services and the fly likes Java class to WSDL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Java class to WSDL" Watch "Java class to WSDL" New topic
Author

Java class to WSDL

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Hi,

I want to map a java class to wsdl.
The problem is my java class use java.util.Map as function arguments.
I am wondering how to map/bind this java class to wsdl.

Here is the code:

Hi,

Can anyone tell me how to map the following java class to wsdl (in Eclispe)?



When executing bottom-up mapping in Eclipse, I got the following error:

....does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.

Any suggestion is highly appreciated.

Thanks
S
Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

Hi sam,

Try to convert it with Apache Axis2 tools. Using these tools you can convert WSDL to java and java to WSDL.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
It is generally a good idea not to use Java collection types, such as Map, List, Set etc, as parameter or return types of methods that are exposed as web service operations.
While it may be possible to make it work with some web service stack(s), there is a significant risk of lock-in.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Thank you very much for the suggestion.

How about using the following class, and convert it to wsdl?



In Eclipse, it generated the following wsdl using bottom-up approach (java2wsdl):




Is generated wsdl looks correct?

Thank you for your time.

Sam
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
You are aware that you are using a web service stack that was built five years ago?
Unless there is a very good reason for using this particular web service stack, I strongly suggest using something more recent.
A lot has happened in that time, for instance the WS-I Basic Profile and JAX-WS.
Best wishes!
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
Hi, thank you very much for your comment on my wsdl.

Do you know how to configure WSDL generator in Eclipse so that it generates more recent version of WSDL file?

From the About Eclipse page, it shows

Eclipse Java EE IDE for Web Developers.

Version: Helios Service Release 2
Build id: 20110218-0911


When I looked the generated wsdl file which was generated from Netbeans 7.0, it looks like as follow:



Is the version of WSDL generated by Netbeans 7.0 correct?

Thanks
Sam
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
In Eclipse, if you look in the Preferences, there is a section named Web Services.
Under that section there are subsections for CXF 2.x Preferences, JBossWS Preferences.
These two allow you to use at least Apache CXF and JBoss WS (these options may require installation of plugins).
It is very easy to write an Ant-file that, given annotated Java classes, generate a WSDL file and use this in Eclipse.
As you may suspect, the web service tooling in Eclipse is not as good as that in NetBeans.
Best wishes!
 
 
subject: Java class to WSDL
 
Similar Threads
Question in Generic Methods
Iterator in Generics
Problem using pollLastEntry() method from TreeMap
Map typeCasting
Problem regarding HashMap.