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 Automatically generated WSDL file of attachment sample fully interoperable? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Automatically generated WSDL file of attachment sample fully interoperable?" Watch "Automatically generated WSDL file of attachment sample fully interoperable?" New topic
Author

Automatically generated WSDL file of attachment sample fully interoperable?

Bernhard Pauler
Greenhorn

Joined: Jun 04, 2005
Posts: 16
Hi!

I want/need to develop a web service that accepts a file.

After I got a little familiar with Axis I searched for articles about passing files to web services.
I stumbled across the following IBM developerWorks article:

"Web services programming tips and tricks: SOAP attachments with JAX-RPC"
http://www.ibm.com/developerworks/webservices/library/ws-tip-soapjax.html

After that I checked out the EchoAttachment sample of the latest Axis release (1.4).
After deploying it I looked at the automatically generated WSDL file and was a little bit irritated...

The type of the parameter of the echo function is declared as DataHandler in the WSDL file. There is nothing to be found in the WSDL file about MIME like in the mentioned IBM article.
It looks to me like DataHandler will constrain the use of the web service to Java users because DataHandler is only known in the Java space - or am I missing something here?

Cheers,

Bernhard Pauler
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Bernhard Pauler:
After deploying it I looked at the automatically generated WSDL file and was a little bit irritated
... - or am I missing something here?


The article that you quoted starts with a WSDL and generates the needed Java (WSDL2Java). The use of javax.activation.DataHandler is simply the Java-centric way of dealing with MIME types.

You apparently did the opposite. You started with the Java-implementation and expected to "automatically" be able generate an interoperable WSDL (Java2WSDL).

When is comes to designing SOAP web service interfaces WSDL is the lingua franca - not an interface specification in some platform specific programming language. So WSDL2Java should be the primary tool. Java2WSDL is merely a convenience that may have the tendency to produce Java-centric WSDL. Apparently it wasn't worth while in Java2WSDL to detect that the use of a DataHandler probably meant that an exchange of SOAP attachments is taking place. Furthermore the Java code may not contain enough information to exactly describe the MIME types that need to be mentioned in the WSDL - so Java2WSDL did the best it could.

Between the article and your own experiments you should have enough information to cobble together your own SOAP Attachment WSDL that WSDL2Java will translate into the Java interface that you are looking for.


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Bernhard Pauler
Greenhorn

Joined: Jun 04, 2005
Posts: 16
Thank you for your very fast and meaty reply.

I am surprised because this is the WSDL file created from the "official" Axis example for attachments (accessible under http://localhost:8080/axis/services/urn:EchoAttachmentsService?wsdl). :roll:

Bernhard
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Automatically generated WSDL file of attachment sample fully interoperable?
 
Similar Threads
difference between web services clients results in one error(AXIS) in one success(JAXWS)
Your suggestions for getting started with webservices
Java2WSDL and SOAP attachments
JAX-WS - WSDLS - Where are they?
Design patterns for Web Services