File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Is this wsdl somehow wrong? - Help please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Is this wsdl somehow wrong? - Help please!" Watch "Is this wsdl somehow wrong? - Help please!" New topic
Author

Is this wsdl somehow wrong? - Help please!

Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
Hello,

After almost a month studying about webservices and stuff, and trying to generate java code from a wsdl with axis, xfire, cxf etc. with no success, I started to think that maybe the wsdl that was given to me is wrong. Not a syntax error but a schema mistake or something. I really don�t understand a lot about wsdl... so that�s why I want your help to find out if there�s something wrong with this wsdl.

Note: The most common error is: "Rpc/encoded wsdls are not supported by jaxws 2.0"

And it�s not a framework problem, cos I was able to generate java classes from another wsdl.

Here it is:

Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Tiago Farias:
Note: The most common error is: "Rpc/encoded wsdls are not supported by jaxws 2.0"


That is the problem. The RPC/encoded messaging mode is not supported by the current generation of SOAP web service stacks because it turned out to be an interoperability nightmare.

Current best practices favor document/literal (the entire SOAP payload can be validated with XML Schema) to the point that even RPC/literal is replaced with the wrapped document/literal convention.

Example of converting an RPC/literal WSDL to Document/Literal and wrapped Document Literal.

Which style of WSDL should I use?
[ December 04, 2008: Message edited by: Peer Reynders ]
Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
Hi Peer!

Thanks for the tips! Well, I got the point. The problem is that I dont know how to do this change(like I said, I started studying recently) plus this wsdl was not designed by me. So, I tried to make some changes, it�s validating but I dont know if it fits...

would you mind to take a look??



Thank you very much again!
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Tiago Farias:
I started to think that maybe the wsdl that was given to me is wrong.


Where did you get this WSDL from? If it describes a web service that you want to access and the service is not under your control then there is little you can do (conversion of the WSDL only helps if you are publishing the web service).

Using Axis 1.x might help because it supports RPC/encoded.
WSDL2Java
WSDL2Java: Building stubs, skeletons, and data types from WSDL
Creating Web Services with Apache Axis: 6. Client: Write a Client That Uses the Generated Stubs to Easily Access the Web Service
Just don't get your hopes up because RPC/encoded has a lot of interoperability problems.

Using SSL with Axis
[ December 05, 2008: Message edited by: Peer Reynders ]
Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
Thanks for your answer Peer! Ok. I�m not trying to change it anymore. I just got the rpc/encoded style all over again and am trying to generate it with axis 1.4. Using the command: java org.apache.axis.wsdl.WSDL2Java habita.wsdl I get: NoClassDefFound Error. Any ideas?

Thanks again!
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
The following class archives have to be in your class path

axis/lib/axis.jar
axis/lib/commons-discovery-0.2.jar
axis/lib/commons-logging-1.0.4.jar
axis/lib/jaxrpc.jar
axis/lib/saaj.jar
axis/lib/log4j-1.2.8.jar
axis/lib/mailapi.jar
Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
Well, I added these jars in my project�s dependencies. But when I get to the prompt and then to my project�s root, and enter java org.apache.axis.wsdl.WSDL2Java habita.wsdl I still get the "NoClassDefFound Error". Arh, it�s very frustrating... The strange thing is, I added the jars that you mentioned in my project! The WSDL2Java.class is there! Well, you got the picture... help please! =]

Thanks!
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Well, org.apache.axis.wsdl.WSDL2Java.class is in axis.jar



Does the "NoClassDefFound" specify which class isn't found? What does your command line and following error output look like?

Verify that you have set up all the axis environment variables (AXIS_HOME, AXIS_LIB, AXISCLASSPATH) correctly - ClassPath setup.

And then use the axis class path directly:

java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java -o . -d Request -p habita.ws habita.wsdl

or

java -cp "$AXISCLASSPATH" org.apache.axis.wsdl.WSDL2Java -o . -d Request -p habita.ws habita.wsdl
Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
I made a bat file and executed. The file:

set AXIS_HOME=D:\tiago.silva\axis
set AXIS_LIB =%AXIS_HOME%\lib\axis-1.4.jar;
set AXIS_LIB =%AXIS_HOME%\lib\axis-jaxrpc-1.4.jar;
set AXIS_LIB =%AXIS_HOME%\lib\axis-saaj-1.4.jar;
set AXIS_LIB =%AXIS_HOME%\lib\axis-wsdl4j-1.5.1.jar;
set AXIS_LIB =%AXIS_HOME%\lib\commons-discovery-0.2.jar;
set AXIS_LIB =%AXIS_HOME%\lib\commons-logging-1.1.jar;

java -classpath org.apache.axis.wsdl.WSDL2Java habita.wsdl

The .bat file is in the "axis" folder. The habita.wsdl is there too. But now he doesn�t complain: "NoClassDefFound Error: WSDL2Java", but "NoClassDefFound Error: habita/wsdl" and "ClassNotFoundException: habita.wsdl" that�s is so odd. Like it�s not finding the file or something...
Hope you can help.

And thank you very much! =D
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
It should be:


... provided those are the locations and names of your JAR files.
Tiago Farias
Greenhorn

Joined: Nov 06, 2008
Posts: 17
Thank you very much Peer! I got it! You saved the day =]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this wsdl somehow wrong? - Help please!