You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ji...@apache.org on 2004/04/03 17:42:57 UTC
[jira] Created: (AXIS-1283) can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/AXIS-1283
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXIS-1283
Summary: can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Type: Bug
Status: Unassigned
Priority: Major
Project: Axis
Components:
WSDL processing
Versions:
1.1
Assignee:
Reporter: Bill Bug
Created: Sat, 3 Apr 2004 7:41 AM
Updated: Sat, 3 Apr 2004 7:41 AM
Environment: Mac OS v10.3.3(Darwin v7.3), Tomcat v5.0.19
Description:
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
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 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 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 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="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.java:2084)
at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(SymbolTable.java:1860)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.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 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:
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.
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)
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Commented: (AXIS-1283) can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Posted by ji...@apache.org.
The following comment has been added to this issue:
Author: Davanum Srinivas
Created: Sat, 3 Apr 2004 10:22 AM
Body:
If you are looking for "valid" wsdl's for MIME and DIME that WSDL2Java understands...Here they are:
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/test/wsdl/interop4/groupG/mime/rpc/mime-rpc.wsdl
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/test/wsdl/interop4/groupG/mime/doc/mime-doc.wsdl
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/test/wsdl/interop4/groupG/dime/rpc/dime-rpc.wsdl
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/test/wsdl/interop4/groupG/dime/doc/dime-doc.wsdl
Note that the WSDL2Java does not generate code with DataHandlers...Which is a problem...
-- dims
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/AXIS-1283?page=comments#action_27936
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/AXIS-1283
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXIS-1283
Summary: can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Type: Bug
Status: Unassigned
Priority: Major
Project: Axis
Components:
WSDL processing
Versions:
1.1
Assignee:
Reporter: Bill Bug
Created: Sat, 3 Apr 2004 7:41 AM
Updated: Sat, 3 Apr 2004 10:22 AM
Environment: Mac OS v10.3.3(Darwin v7.3), Tomcat v5.0.19
Description:
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
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 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 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 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="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.java:2084)
at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(SymbolTable.java:1860)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.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 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:
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.
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)
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Commented: (AXIS-1283) can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Posted by "Rodrigo Ruiz (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1283?page=comments#action_12331383 ]
Rodrigo Ruiz commented on AXIS-1283:
------------------------------------
Hi, is there any plan to solve this problem? It has been a year and a half since it was reported! :-D
Ok, now seriously. I think the problem is at more than one place:
- WSDL2Java should generate stubs and skeletons using DataHandlers when processing the mentioned WSDL files
- Java2WSDL should generate these files when the service has attachments (I guess a flag for selecting DIME/MIME should be added to the command-line)
- The server should generate runtime "standard" WSDLs. I don't know if there is enough deployment data to choose the service "preferred" attachment format.
DataHandlers are ok if you stay in Axis Java, but they are not portable at all. I am having problems even with Axis C++, the only one I expected to support them ;-)
> can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
> --------------------------------------------------------------------------
>
> Key: AXIS-1283
> URL: http://issues.apache.org/jira/browse/AXIS-1283
> 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
> 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 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 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 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="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.java:2084)
> at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(SymbolTable.java:1860)
> at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.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 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:
> 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.
> 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:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (AXIS-1283) can't use mime:multipartRelated in wsdl:output element of a wsdl:operation
Posted by "Tom Jordahl (JIRA)" <ax...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/AXIS-1283?page=comments#action_12331389 ]
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: http://issues.apache.org/jira/browse/AXIS-1283
> 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
> 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 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 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 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="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.java:2084)
> at org.apache.axis.wsdl.symbolTable.SymbolTable.fillInBindingInfo(SymbolTable.java:1860)
> at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.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 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:
> 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.
> 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:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira