axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Jordahl (JIRA)" <>
Subject [jira] Commented: (AXIS-1283) can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Date Wed, 05 Oct 2005 14:50:51 GMT
    [ ] 

Tom Jordahl commented on AXIS-1283:

Clearly no one is working on this.  Patches and tests are welcome.

> can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
> --------------------------------------------------------------------------
>          Key: AXIS-1283
>          URL:
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.1
>  Environment: Mac OS v10.3.3(Darwin v7.3), Tomcat v5.0.19
>     Reporter: Bill Bug

> I'm having trouble creating an appropriate WSDL file to make a service returning a large
set of binary attachments.
> Neither Java2WSDL nor WSDL2Java appear to be ready to process with the markup for MIME
attachments that should reside within the wsdl:output element of a wsdl:operation in the wsdl:binding
section of a WSDL file.
> I've been trying to combine what I could pull from the documentation on WSDL2Java with
the info in the very useful article:
> Web services programming tips and tricks: SOAP attachments with JAX-RPC
> So far, I've not been successful.
> I've got an original implementation using SAAJ that works, but the code is much more
complicated than it would be had I used JAX-RPC attachments as described in the article listed
> I created a very simple Interface that I ran through Java2WSDL to create my WSDL file.
> The Interface is as follows:
> <snippet>
> import;
> import java.rmi.Remote;
> import java.rmi.RemoteException;
> /**
>  *
>  * @author  billbug
>  */
> public interface IRepositoryAccess extends Remote  {
>         public DataHandler[] getImages(Boolean returnZip, String imageSet) throws RemoteException;
> }
> </snippet>
> I assumed extrapolating from the article above that I could have a return type of DataHandler[]
to return a collection of attached files.
> The WSDL generated from this interface is all exactly as I'd expect it to be - except
in the wsdl:output element created within the wsdl:operation element for my function call
within the wsdl:binding section of the WSDL.
> Unfortunately, all I get is:
> <snippet>
> 	 <wsdl:output name="getImagesResponse">
> 		<wsdlsoap:body namespace="urn:RepositoryAccessService" use="encoded"/>
>          </wsdl:output>
> </snippet>
> According to the article, it should look something like this:
> <snippet>
>          <wsdl:output name="getImagesResponse">
>         		<mime:multipartRelated>
>         			<mime:part name="part1">
>           			<wsdlsoap:body encodingStyle=""
namespace="urn:RepositoryAccessService" use="encoded"/>
>           		</mime:part>
>           		<mime:part name="part2">
>           			<mime:content part="output" type="application/octetstream"/>
>             		</mime:part>
>           	</mime:multipartRelated>
>          </wsdl:output>
> </snippet>
> with:
> 	xmlns:mime=""
> included in the wsdl:definitions element at the top of the WSDL.
> Basically, it's a multipart MIME message, where the first part is the body of the SOAP
response message, the the additional part(s) are the attached binary files.
> If I add in the mime:multipartRelated as given above into the wsdl:output element, then
try to run WSDL2Java, I get the following error:
> java org.apache.axis.wsdl.WSDL2Java --output "gen" --deployScope "Application" --server-side
--skeletonDeploy --verbose RepositoryAcess.wsdl
> java.lang.NullPointerException
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.addMIMETypes(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.add(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(
>         at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(
>         at org.apache.axis.wsdl.gen.Parser$
>         at
> I peaked into the source for org.apache.axis.wsdl.symbolTable.SymbolTable.  At line 2084
where it's hitting a NullPointerException, it is in the function addMIMETypes as indicated
above.  Here's a snippet from that function:
> <snippet>
>     /**
>      * Add the parts that are really MIME types as MIME types.
>      * A side effect is to return the body Type of the given
>      * MIMEMultipartRelated object.
>      */
>     private Use addMIMETypes(BindingEntry bEntry, MIMEMultipartRelated mpr,
>             Operation op) throws IOException {
>         Use bodyType = Use.ENCODED;
>         List parts = mpr.getMIMEParts();
>         Iterator i = parts.iterator();
>         while (i.hasNext()) {
>             MIMEPart part = (MIMEPart);
>             List elems = part.getExtensibilityElements();
>             Iterator j = elems.iterator();
>             while (j.hasNext()) {
>                 Object obj =;
>                 if (obj instanceof MIMEContent) {
>                     MIMEContent content = (MIMEContent) obj;
>                     TypeEntry typeEntry = findPart(op, content.getPart());
> line:2084-->String dims = typeEntry.getDimensions();
>                     if(dims.length() <=0 && typeEntry.getRefType() != null)
>                         Node node = typeEntry.getRefType().getNode();
>                         if(getInnerCollectionComponentQName(node)!=null)
>                             dims += "[]";
>                     }
>                     String type = content.getType();
>                     if(type == null || type.length() == 0)
>                         type = "text/plain";
>                     bEntry.setMIMEInfo(op.getName(), content.getPart(), type, dims);
> </snippet>
> As best I figure from this code, the typeEntry object is null, probably because content.getPart()
returns null or an invalid value.
> I'm pretty certain I've got the wsdl:output MIME syntax in the WSDL very close.  The
part I think is wrong is the line:
> 	<mime:content part="output" type="application/octetstream"/>
> The 'part="output" is probably the offending piece.  The article I'm using as my example
describes how to create a WSDL for a function that accepts an attachment as an input parameter,
not one that returns an attachment.  I'm also trying to attach several files, not just a single
file.  It seems I ought to have to specify I'm returning an array of attachments somewhere
in the mime:content element.
> I've been to the World-Wide Web consortium site to look over the WSDL v1.2 specification.
 There's very little info contained in the section on MIME multi-part messages:
> There's really nothing here that goes much beyond the original article I site above.
> It would be really a big leap forward if Java2WSDL & WSDL2Java could handle MIME
attachments as deftly as it does almost every other aspect of a JAX-RPC payload.
> Cheers,
> Bill Bug
> Bill Bug
> Senior Analyst/Ontological Engineer
> Laboratory for Bioimaging  & Anatomical Informatics
> Department of Neurobiology & Anatomy
> Drexel University College of Medicine
> 2900 Queen Lane
> Philadelphia, PA	19129
> 215 991 8430 (ph)

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message