• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Help! Wsdl2Java Can't parse a Coldfusion WSDL?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm relatively new to Web services, but I've managed to get several service clients half-generated using Axis2 <codegen> task in ANT.

Now I'm trying to use this same technique on a WSDL file that was "auto-generated" by ColdFusion. I don't know anything about ColdFusion, other than how to spell it. Short story: It's not working. CodeGen barfs, and I can't figure out why. Can anyone help? Is this a problem with my Axis2 config? Classpath? ColdFusion?

Here's the WSDL:


Here's the console output from ANT, while attempting to run the Codegen task:


Thanks for any help!
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Goddamn smilies. LEt me try again. Here's the WSDL:

 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Modern SOAP Web Service stacks do not support the RPC/encoded messaging mode because it caused too many interoperability problems.

Try Axis 1.x - you might get lucky.

See also Is this wsdl somehow wrong? - Help please!
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peer,

Turns out the CodeGen task was simply pointing at the wrong directory on disk (couldn't find the WSDL file). The "wsdlfilename" attribute doesn't take into account the ANT basedir for the build, while the "output" attribute DOES.

Anyway, once I figured that one out, I started getting a different error (invocationTargetException).

To try a simple example, I tried to run the CodeGen task against the Google Search WSDL. Here's the ANT build file:



When I run this, here's stdout:



As you can see, I'm still getting an InvocationTargetException. These error messages are pretty uninformative. No stack trace, no information.

Is this still an RPC interop issue? OR something else?
[ December 13, 2008: Message edited by: Philippe Desrosiers ]
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Philippe Desrosiers:
Is this still an RPC interop issue? OR something else?



The simple fact is that neither Axis2, JAX-WS 2.x RI or Apache CXF 2.x support the of consuming of SOAP web services that use the RPC/encoded messaging mode because it was a losing battle trying to get it to work in their predecessors (Axis 1.x, JAX-RPC 1.1 (JWSDP), and Codehaus XFire 1.x respectively). Current generation web service stacks support RPC/literal, prefer document/literal and enable the wrapped document/literal convention ("document/literal faking RPC").

Axis2 just doesn't explicitly tell you that it is choking on that particular WSDL characteristic (JAX-WS RI does).

So Axis 1.x is still your best bet - whether or not it will work is an entirely different matter.

The Google Search WSDL also uses the RPC/encoded messaging mode - notice that Google has stopped the proliferation of its use by stopping to issue API keys back in Dec 5, 2006. They want you to use the Google AJAX Search API which has nothing to do with SOAP.
[ December 13, 2008: Message edited by: Peer Reynders ]
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peer,

How can I tell if a particular WSDL file uses RPC/Encoded messages? Can you point me in the direction of a resource that explains what all these terms actually mean? (RPC/Encoded, RPC/Literal, document/literal, and wrapped document/literal). I don't actually have any idea what we're talking about here.

So if I want to consume, say, the Google Search service described above (Link), I have to use something other than Axis2? OR else somehow convince Google not to use the RPC/Encoded messages?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Philippe Desrosiers:
How can I tell if a particular WSDL file uses RPC/Encoded messages?



See here.

Originally posted by Philippe Desrosiers:
So if I want to consume, say, the Google Search service described above (Link), I have to use something other than Axis2? OR else somehow convince Google not to use the RPC/Encoded messages?



As I already mentioned - you won't be able to use the Google SOAP API unless you already have an API key from over two years ago (i.e. while the SOAP API is still running it really isn't supported anymore - it could go away at anytime). If you have a key then you have to use something like Axis 1.x to access it from Java. And its them trying to convince you to use the Google AJAX Search API.

Using Google's AJAX Search API with Java (2008-Jun-10)

Now this example uses the standard java.net.URLConnection - which is a pain to work with. If you need to use this web API I would strongly recommend that you use the Jarkarta Commons HttpClient instead - it will be worth it in the long run. Also Codehaus Jettison could be useful for producing/consuming JSON in Java.
[ December 13, 2008: Message edited by: Peer Reynders ]
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent! Thank a lot, Peer!

Actually, I wanted to use the Google WSDL as a sort of "simple" example, to try and get Axis2 Codegen to work on, well, anything at all, really...

Anyway, I've given up on that, and now I'm trying with JAX-WS <wsimport> task instead. At least it gives more informative error messages.

Thanks again for the education! :-)
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Philippe Desrosiers:
and now I'm trying with JAX-WS <wsimport> task instead. At least it gives more informative error messages.



I did mention in my above post that JAX-WS doesn't support RPC/encoded either ...

JAX-WS does tell you that RPC/encoded is the problem which Axis2 doesn't. Sorry if my phrasing caused some confusion...
[ December 13, 2008: Message edited by: Peer Reynders ]
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
New problem (but somewhat related). I'm still trying to use the Axis 2 ANT <codegen> task, on a different web service (without, as far as I can tell, RPC-encoded style), and still getting InvocationTargetException.

If anyone can help, I'd really appreciate it

Here's the WSDL:


Here's the ANT target:


And here's the results. Very uninformative:


Is there something in the WSDL file that could be causing this?

Help!!!
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a more detailed version of theANT output (as if this post wasn't verbose enough):
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem with Axis2 1.4.1 and JDK 1.6 Build 11 and
call %axis2_home%/bin/wsdl2java.bat -uri UserWs.wsdl -ss -sd -d adb

I have to wonder if your version of the tool is getting confused by the non-SOAP bindings. It may be worth "cooking" a local version of the WSDL to see if this alleviates the problem.

i.e. here is everything stripped down to the SOAP 1.1 binding:
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peer!

I tried with the WSDL you so kindly provided. No dice (same error). Maybe I'm missing a dependency for the Axis ANT tools? Hard to tell, since Axis2 ships with about a sixty JAR files and no dependency information . Here's what I've got in the ANT classpath:

axiom-api-1.2.7.jar
axiom-dom-1.2.7.jar
axiom-impl-1.2.7.jar
axis2-adb-codegen-1.4.1.jar
axis2-ant-plugin-1.4.1.jar
axis2-codegen-1.4.1.jar
axis2-kernel-1.4.1.jar
backport-util-concurrent-3.1.jar
commons-logging-1.1.1.jar
neethi-2.0.4.jar
wsdl4j-1.6.2.jar
XmlSchema-1.4.2.jar


Adding every jar that ships with Axis, the ANT build runs, and works perfectly (even with all that extra, non-SOAP stuff in the WSDL). Unfortunately, I can't effectively commit sixty extraneous JARs to my code repository (my team lead would have a fit). Can you tell me (or point me to a resource) which of the following is REQUIRED for the Ant codegen tasks to work?

activation-1.1.jar
annogen-0.1.0.jar
axiom-api-1.2.7.jar
axiom-dom-1.2.7.jar
axiom-impl-1.2.7.jar
axis2-adb-1.4.1.jar
axis2-adb-codegen-1.4.1.jar
axis2-ant-plugin-1.4.1.jar
axis2-clustering-1.4.1.jar
axis2-codegen-1.4.1.jar
axis2-corba-1.4.1.jar
axis2-fastinfoset-1.4.1.jar
axis2-java2wsdl-1.4.1.jar
axis2-jaxbri-1.4.1.jar
axis2-jaxws-1.4.1.jar
axis2-jaxws-api-1.4.1.jar
axis2-jibx-1.4.1.jar
axis2-json-1.4.1.jar
axis2-jws-api-1.4.1.jar
axis2-kernel-1.4.1.jar
axis2-metadata-1.4.1.jar
axis2-mtompolicy-1.4.1.jar
axis2-saaj-1.4.1.jar
axis2-saaj-api-1.4.1.jar
axis2-spring-1.4.1.jar
axis2-xmlbeans-1.4.1.jar
backport-util-concurrent-3.1.jar
commons-codec-1.3.jar
commons-fileupload-1.2.jar
commons-httpclient-3.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
geronimo-annotation_1.0_spec-1.1.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
httpcore-4.0-beta1.jar
httpcore-nio-4.0-beta1.jar
jalopy-1.5rc3.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.6.jar
jaxb-xjc-2.1.6.jar
jaxen-1.1.1.jar
jettison-1.0-RC2.jar
jibx-bind-1.1.5.jar
jibx-run-1.1.5.jar
log4j-1.2.15.jar
mail-1.4.jar
mex-1.4.1.jar
neethi-2.0.4.jar
soapmonitor-1.4.1.jar
woden-api-1.0M8.jar
woden-impl-dom-1.0M8.jar
wsdl4j-1.6.2.jar
wstx-asl-3.2.4.jar
xalan-2.7.0.jar
xercesImpl-2.8.1.jar
xml-apis-1.3.04.jar
xmlbeans-2.3.0.jar
xml-resolver-1.2.jar
XmlSchema-1.4.2.jar

The wsdl2java task also appears to:

- create a "src" folder at the outputPath that I specify, rather than putting the generated Java source where I tell it. (eg: Instead of putting the source in src/gensrc/axis, it will put it in src/gensrc/axis/src).
- generate an ANT build.xml file, for some reason (at src/gensrc/axis). This appears to be a script to build and deploy a web services client based on the generated source.

Any idea how I can configure it to not do that?

Thanks again for all your help...
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Philippe Desrosiers wrote:Can you tell me (or point me to a resource) which of the following is REQUIRED for the Ant codegen tasks to work?



No. The wsdl2java script adds them all.
set AXIS2_CLASS_PATH=%AXIS2_HOME%
FOR %%c in ("%AXIS2_HOME%\lib\*.jar") DO set AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c

So basically use a shell script/batch file that has the complete list of jar archives and then eliminate them one at a time - whenever something goes wrong, add the last one back.

Philippe Desrosiers wrote:Any idea how I can configure it to not do that?


You may want to re-think whether you want to use the WSDL-to-Code Ant-Task at all as part of the normal build process.

The code generator creates the starting point for your service consumer - nothing more.

You may even want to create a wrapper class (possibly expanding it to a façade) around the com.foo.www.services.UserWSStub. The interface of com.foo.www.services.UserWSStub is directly coupled to the web services contract (WSDL). So if the web services contract has a non-compatible change, the dependencies on the old com.foo.www.services.UserWSStub interface will likely break, leading to even more necessary re-work on the consumer façade/code.

So it makes a certain amount of sense to keep the WSDL-to-Java code generation out of the normal build process as the generation of the proxy source is an exceptional build target. If you want to capture the generation process in the Ant script as an exceptional build target, simply have the script do it in an entirely unrelated directory and have the script move the generated code to the correct location (entirely replacing the old proxy source) while deleting any of the unnecessary remnants.

As you probably know, the WSDL2Java options are listed in the Apache Axis2 Reference Guide: WSDL2Java Reference.

Again, for me "-S src/gensrc/axis" places the generated code in "src/gensrc/axis", not "src/gensrc/axis/src".
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic