Hi All,

I'm having trouble creating an appropriate WSDL file to create a service that returns a large set of binary attachments.

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
http://www-106.ibm.com/developerworks/webservices/library/ws-tip- soapjax.html


So far, I've not been successful.

I've got an original implementation in 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 above.

I created a very simple Interface that I ran through Java2WSDL to create my WSDL file.

The Interface is as follows:

<snippet>
import java.io.File;
import java.rmi.Remote;
import java.rmi.RemoteException;

/**
*
* @author billbug
*/
public interface IRepositoryAccess extends Remote {
public File[] getImages(Boolean returnZip, String imageSet) throws RemoteException;
}
</snippet>


I assumed extrapolating from the article above that I could have a return type of File[] 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="http://schemas.xmlsoap.org/soap/encoding/"; 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="http://schemas.xmlsoap.org/wsdl/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(SymbolTable.ja va:2084)
at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(SymbolTab le.java:1860)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTabl e.java:1795)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java: 577)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:421)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java: 408)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java: 393)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:245)
at java.lang.Thread.run(Thread.java:552)


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) i.next();
List elems = part.getExtensibilityElements();
Iterator j = elems.iterator();
while (j.hasNext()) {
Object obj = j.next();
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'm pretty certain is wrong is the line:

<mime:content part="output" type="application/octetstream"/>

I think the 'part="output" is 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:
http://www.w3.org/TR/2003/WD-wsdl12-bindings-20030611/#_mime
There's really nothing here that goes much beyond the original article I site above.


Can anyone suggest how to get this working?

Many thanks ahead of time for any assistance you can offer.

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)



Reply via email to