You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mark Mueller <ma...@yahoo.com> on 2003/01/23 19:27:29 UTC

Interoperative attachments

I've been following this list for weeks now and
concepts are slowly sinking in.  I'm still a bit
puzzled by attachments, though.

I'm developing a service that returns a file to the
client.  In the server code I return a DataHandler
object which Axis nicely turns into an attachment. My
concern is the wsdl which describes the type as:
type="apachesoap:DataHandler".  Will non-Java clients
handle this type correctly, or should I be rewriting
my service is some more generic way that avoids using
the DataHandler?

   Mark

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: Interoperative attachments

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Mark Mueller" <ma...@yahoo.com>
To: <ax...@xml.apache.org>
Sent: Tuesday, January 28, 2003 08:18
Subject: RE: Interoperative attachments


> Josh,
>
> Yes, I am trying to develop the service that is
> language and platform neutral, so I'm trying to find
> the "right" way to handle attachments.  Unfortunately
> I don't have other platforms to test on.

pocketsoap, MSSTK and .NET with the WSE all do attachments if you want to
cross-test

>
> The W3C WSDL 1.1 Note shows a MIME binding that
> supports attachments, but poking around on the
> Xmethods website, I didn't run across any WSDL that
> shows the MIME binding.  If vender interoperability
> for attachments just isn't there yet, that would be
> good to know.

all uses of attachments I've seen have attachments attached and removed
manually, with attachment details 'add three of them' in the service
specification.


RE: Interoperative attachments

Posted by Josh Kropf <jo...@slashdev.ca>.
Mark,

I have been working on a project were platform independance is my goal.
Microsoft .NET was my first non-java client that I figured I would be most
likely to run accross. For basic SOAP messages everything worked fine.
However, when implementing attachments I found that .NET Framework out of
the box doesn't support SOAP with Attachments. Soon after, Microsoft
released something called the WSE (Web Service Enhancment) 1.0 which comes
with implementations for SOAP w/ Attachments and some standards for security
and lookup. This "Enhancment" uses another standard Microsfot developed
called DIME which is supposed to be an alternative to MIME encoding. Axis
has support for this DIME encoding format, however Axis would crap out when
the WSE 1.0 client would send it's SOAP request message.

BEA Weblogic seemed accept the WSE 1.0 request message that Axis failed to
process. I found that when consuming my web service emitting from Weblogic,
the .NET client rejected the responce saying expected text/xml and found
multipart/related. After looking at the WSDL 1.1 specs and seeing that the
specs include MIME binding I am going to investigate this furthur to see if
there is infact a way to make a client aware of attachments via the WSDL.
WSE 1.0 apparently implements WSDL 1.1 so there might be something in the
framework to handle standard mime encoding after all.

FYI, my work around for the above problem, relivant or not, was to create a
handler for my web service in BEA Weblogic that encoded the message with
attachments as DIME if I requested such from the client. Not the most
eligant, but effective none the less :)

Keep me posted Mark on what you discover, I will do the same

Thanks,

Josh

-----Original Message-----
From: Mark Mueller [mailto:markcmueller@yahoo.com]
Sent: Tuesday, January 28, 2003 11:19 AM
To: axis-user@xml.apache.org
Subject: RE: Interoperative attachments


Josh,

Yes, I am trying to develop the service that is
language and platform neutral, so I'm trying to find
the "right" way to handle attachments.  Unfortunately
I don't have other platforms to test on.

The W3C WSDL 1.1 Note shows a MIME binding that
supports attachments, but poking around on the
Xmethods website, I didn't run across any WSDL that
shows the MIME binding.  If vender interoperability
for attachments just isn't there yet, that would be
good to know.

   Mark


--- Josh Kropf <jo...@slashdev.ca> wrote:
> Mark,
>
> As far as I know, WSDL does not have any sort of
> mechanism for describing
> attachments... hence each vendors slightly different
> implementation of an
> attachments interface. Your client (or server for
> that matter) will have to
> be aware that an attachment is present and attempt
> to extract it from the
> attachment parts.
>
> BTW... I am assuming you are attempting to make your
> web service work with
> multiple platforms? Are you attempting to use
> non-Java clients with axis at
> any point?
>
> -----Original Message-----
> From: Mark Mueller [mailto:markcmueller@yahoo.com]
> Sent: Monday, January 27, 2003 4:32 PM
> To: axis-user@xml.apache.org
> Subject: RE: Interoperative attachments
>
>
> Josh,
>
> This was very helpful -- thanks a lot!  I've
> implemented my service this way, and I return the
> URL
> of the attachment content-id as the return-value of
> the call.
>
> I have another question.  The WSDL created by
> Java2WSDL doesn't mention the file that I return as
> an
> attachment.  Should I revise the WSDL by hand
> so that the binding includes something like this:
>
> <mime:multipartRelated>
>   <mime:part>
>      <soap:body parts="body" use="literal"/>
>   </mime:part>
>   <mime:part>
>      <mime:content part="file" type="audio/x-wav"/>
>   <mime:part>
>
> Do I need some sort of mime stuff in the binding
> section for my server to work with a variety of
> clients?
>
>    Mark
>
> --- Josh Kropf <jo...@slashdev.ca> wrote:
> > Mark,
> >
> > After working with Axis for a while then migrating
> > to BEA Weblogic, I have
> > found that the best way to attach files is to do
> it
> > through handlers.
> > However it's equaly as viable to do it in your Web
> > Service for example:
> >
> > Message message =
> >
>
MessageContext.getCurrentContext().getResponseMessage();
> > javax.xml.soap.AttachmentPart ap =
> > message.createAttachmentPart();
> > ap.setContent(new
> > FileInputStream("/home/jkropf/Calc.asmx"),
> > "text/plain");
> > message.addAttachmentPart( ap );
> >
> > However if you choose to do the above in a
> handler,
> > a MessageContext object
> > will be passed through the invoke method (see
> sample
> > 4 in axis for handler
> > implementation). You can then simply call
> > msgContext.getCurrentMessage()
> > with this object to get the message and start
> adding
> > AttachmentPart's to it.
> >
> > Hope this helps
> >
> > -----Original Message-----
> > From: Mark Mueller [mailto:markcmueller@yahoo.com]
> > Sent: Thursday, January 23, 2003 1:27 PM
> > To: axis-user@xml.apache.org
> > Subject: Interoperative attachments
> >
> >
> > I've been following this list for weeks now and
> > concepts are slowly sinking in.  I'm still a bit
> > puzzled by attachments, though.
> >
> > I'm developing a service that returns a file to
> the
> > client.  In the server code I return a DataHandler
> > object which Axis nicely turns into an attachment.
> > My
> > concern is the wsdl which describes the type as:
> > type="apachesoap:DataHandler".  Will non-Java
> > clients
> > handle this type correctly, or should I be
> rewriting
> > my service is some more generic way that avoids
> > using
> > the DataHandler?
> >
> >    Mark
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > http://mailplus.yahoo.com
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


RE: Interoperative attachments

Posted by Mark Mueller <ma...@yahoo.com>.
Josh,

Yes, I am trying to develop the service that is
language and platform neutral, so I'm trying to find
the "right" way to handle attachments.  Unfortunately
I don't have other platforms to test on.  

The W3C WSDL 1.1 Note shows a MIME binding that
supports attachments, but poking around on the
Xmethods website, I didn't run across any WSDL that
shows the MIME binding.  If vender interoperability
for attachments just isn't there yet, that would be
good to know. 

   Mark


--- Josh Kropf <jo...@slashdev.ca> wrote:
> Mark,
> 
> As far as I know, WSDL does not have any sort of
> mechanism for describing
> attachments... hence each vendors slightly different
> implementation of an
> attachments interface. Your client (or server for
> that matter) will have to
> be aware that an attachment is present and attempt
> to extract it from the
> attachment parts.
> 
> BTW... I am assuming you are attempting to make your
> web service work with
> multiple platforms? Are you attempting to use
> non-Java clients with axis at
> any point?
> 
> -----Original Message-----
> From: Mark Mueller [mailto:markcmueller@yahoo.com]
> Sent: Monday, January 27, 2003 4:32 PM
> To: axis-user@xml.apache.org
> Subject: RE: Interoperative attachments
> 
> 
> Josh,
> 
> This was very helpful -- thanks a lot!  I've
> implemented my service this way, and I return the
> URL
> of the attachment content-id as the return-value of
> the call.
> 
> I have another question.  The WSDL created by
> Java2WSDL doesn't mention the file that I return as
> an
> attachment.  Should I revise the WSDL by hand
> so that the binding includes something like this:
> 
> <mime:multipartRelated>
>   <mime:part>
>      <soap:body parts="body" use="literal"/>
>   </mime:part>
>   <mime:part>
>      <mime:content part="file" type="audio/x-wav"/>
>   <mime:part>
> 
> Do I need some sort of mime stuff in the binding
> section for my server to work with a variety of
> clients?
> 
>    Mark
> 
> --- Josh Kropf <jo...@slashdev.ca> wrote:
> > Mark,
> >
> > After working with Axis for a while then migrating
> > to BEA Weblogic, I have
> > found that the best way to attach files is to do
> it
> > through handlers.
> > However it's equaly as viable to do it in your Web
> > Service for example:
> >
> > Message message =
> >
>
MessageContext.getCurrentContext().getResponseMessage();
> > javax.xml.soap.AttachmentPart ap =
> > message.createAttachmentPart();
> > ap.setContent(new
> > FileInputStream("/home/jkropf/Calc.asmx"),
> > "text/plain");
> > message.addAttachmentPart( ap );
> >
> > However if you choose to do the above in a
> handler,
> > a MessageContext object
> > will be passed through the invoke method (see
> sample
> > 4 in axis for handler
> > implementation). You can then simply call
> > msgContext.getCurrentMessage()
> > with this object to get the message and start
> adding
> > AttachmentPart's to it.
> >
> > Hope this helps
> >
> > -----Original Message-----
> > From: Mark Mueller [mailto:markcmueller@yahoo.com]
> > Sent: Thursday, January 23, 2003 1:27 PM
> > To: axis-user@xml.apache.org
> > Subject: Interoperative attachments
> >
> >
> > I've been following this list for weeks now and
> > concepts are slowly sinking in.  I'm still a bit
> > puzzled by attachments, though.
> >
> > I'm developing a service that returns a file to
> the
> > client.  In the server code I return a DataHandler
> > object which Axis nicely turns into an attachment.
> > My
> > concern is the wsdl which describes the type as:
> > type="apachesoap:DataHandler".  Will non-Java
> > clients
> > handle this type correctly, or should I be
> rewriting
> > my service is some more generic way that avoids
> > using
> > the DataHandler?
> >
> >    Mark
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > http://mailplus.yahoo.com
> >
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

RE: Interoperative attachments

Posted by Josh Kropf <jo...@slashdev.ca>.
Mark,

As far as I know, WSDL does not have any sort of mechanism for describing
attachments... hence each vendors slightly different implementation of an
attachments interface. Your client (or server for that matter) will have to
be aware that an attachment is present and attempt to extract it from the
attachment parts.

BTW... I am assuming you are attempting to make your web service work with
multiple platforms? Are you attempting to use non-Java clients with axis at
any point?

-----Original Message-----
From: Mark Mueller [mailto:markcmueller@yahoo.com]
Sent: Monday, January 27, 2003 4:32 PM
To: axis-user@xml.apache.org
Subject: RE: Interoperative attachments


Josh,

This was very helpful -- thanks a lot!  I've
implemented my service this way, and I return the URL
of the attachment content-id as the return-value of
the call.

I have another question.  The WSDL created by
Java2WSDL doesn't mention the file that I return as an
attachment.  Should I revise the WSDL by hand
so that the binding includes something like this:

<mime:multipartRelated>
  <mime:part>
     <soap:body parts="body" use="literal"/>
  </mime:part>
  <mime:part>
     <mime:content part="file" type="audio/x-wav"/>
  <mime:part>

Do I need some sort of mime stuff in the binding
section for my server to work with a variety of
clients?

   Mark

--- Josh Kropf <jo...@slashdev.ca> wrote:
> Mark,
>
> After working with Axis for a while then migrating
> to BEA Weblogic, I have
> found that the best way to attach files is to do it
> through handlers.
> However it's equaly as viable to do it in your Web
> Service for example:
>
> Message message =
>
MessageContext.getCurrentContext().getResponseMessage();
> javax.xml.soap.AttachmentPart ap =
> message.createAttachmentPart();
> ap.setContent(new
> FileInputStream("/home/jkropf/Calc.asmx"),
> "text/plain");
> message.addAttachmentPart( ap );
>
> However if you choose to do the above in a handler,
> a MessageContext object
> will be passed through the invoke method (see sample
> 4 in axis for handler
> implementation). You can then simply call
> msgContext.getCurrentMessage()
> with this object to get the message and start adding
> AttachmentPart's to it.
>
> Hope this helps
>
> -----Original Message-----
> From: Mark Mueller [mailto:markcmueller@yahoo.com]
> Sent: Thursday, January 23, 2003 1:27 PM
> To: axis-user@xml.apache.org
> Subject: Interoperative attachments
>
>
> I've been following this list for weeks now and
> concepts are slowly sinking in.  I'm still a bit
> puzzled by attachments, though.
>
> I'm developing a service that returns a file to the
> client.  In the server code I return a DataHandler
> object which Axis nicely turns into an attachment.
> My
> concern is the wsdl which describes the type as:
> type="apachesoap:DataHandler".  Will non-Java
> clients
> handle this type correctly, or should I be rewriting
> my service is some more generic way that avoids
> using
> the DataHandler?
>
>    Mark
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


RE: Interoperative attachments

Posted by Mark Mueller <ma...@yahoo.com>.
Josh,

This was very helpful -- thanks a lot!  I've
implemented my service this way, and I return the URL
of the attachment content-id as the return-value of
the call.  

I have another question.  The WSDL created by
Java2WSDL doesn't mention the file that I return as an
attachment.  Should I revise the WSDL by hand
so that the binding includes something like this:

<mime:multipartRelated>
  <mime:part>
     <soap:body parts="body" use="literal"/>
  </mime:part>
  <mime:part>
     <mime:content part="file" type="audio/x-wav"/>
  <mime:part>

Do I need some sort of mime stuff in the binding
section for my server to work with a variety of
clients?

   Mark

--- Josh Kropf <jo...@slashdev.ca> wrote:
> Mark,
> 
> After working with Axis for a while then migrating
> to BEA Weblogic, I have
> found that the best way to attach files is to do it
> through handlers.
> However it's equaly as viable to do it in your Web
> Service for example:
> 
> Message message =
>
MessageContext.getCurrentContext().getResponseMessage();
> javax.xml.soap.AttachmentPart ap =
> message.createAttachmentPart();
> ap.setContent(new
> FileInputStream("/home/jkropf/Calc.asmx"),
> "text/plain");
> message.addAttachmentPart( ap );
> 
> However if you choose to do the above in a handler,
> a MessageContext object
> will be passed through the invoke method (see sample
> 4 in axis for handler
> implementation). You can then simply call
> msgContext.getCurrentMessage()
> with this object to get the message and start adding
> AttachmentPart's to it.
> 
> Hope this helps
> 
> -----Original Message-----
> From: Mark Mueller [mailto:markcmueller@yahoo.com]
> Sent: Thursday, January 23, 2003 1:27 PM
> To: axis-user@xml.apache.org
> Subject: Interoperative attachments
> 
> 
> I've been following this list for weeks now and
> concepts are slowly sinking in.  I'm still a bit
> puzzled by attachments, though.
> 
> I'm developing a service that returns a file to the
> client.  In the server code I return a DataHandler
> object which Axis nicely turns into an attachment.
> My
> concern is the wsdl which describes the type as:
> type="apachesoap:DataHandler".  Will non-Java
> clients
> handle this type correctly, or should I be rewriting
> my service is some more generic way that avoids
> using
> the DataHandler?
> 
>    Mark
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

RE: Interoperative attachments

Posted by Josh Kropf <jo...@slashdev.ca>.
Mark,

After working with Axis for a while then migrating to BEA Weblogic, I have
found that the best way to attach files is to do it through handlers.
However it's equaly as viable to do it in your Web Service for example:

Message message = MessageContext.getCurrentContext().getResponseMessage();
javax.xml.soap.AttachmentPart ap = message.createAttachmentPart();
ap.setContent(new FileInputStream("/home/jkropf/Calc.asmx"), "text/plain");
message.addAttachmentPart( ap );

However if you choose to do the above in a handler, a MessageContext object
will be passed through the invoke method (see sample 4 in axis for handler
implementation). You can then simply call msgContext.getCurrentMessage()
with this object to get the message and start adding AttachmentPart's to it.

Hope this helps

-----Original Message-----
From: Mark Mueller [mailto:markcmueller@yahoo.com]
Sent: Thursday, January 23, 2003 1:27 PM
To: axis-user@xml.apache.org
Subject: Interoperative attachments


I've been following this list for weeks now and
concepts are slowly sinking in.  I'm still a bit
puzzled by attachments, though.

I'm developing a service that returns a file to the
client.  In the server code I return a DataHandler
object which Axis nicely turns into an attachment. My
concern is the wsdl which describes the type as:
type="apachesoap:DataHandler".  Will non-Java clients
handle this type correctly, or should I be rewriting
my service is some more generic way that avoids using
the DataHandler?

   Mark

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com