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 ndthuy <nd...@yahoo.com> on 2008/04/01 15:52:03 UTC

Re: Using SWA with ADB in axis2

Hi Thilina,

After taking a look at those articles, I am able to upload the file without
any problem. But when I download the file, I received this error:

Exception in thread "main" org.apache.axiom.om.OMException:
javax.mail.MessagingException: Error in input stream;
  nested exception is:
	java.io.IOException: Attempted read on closed stream.
	at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
	at
org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
	at
org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
	at
org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
	at
com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
	at
com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
	at
com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
Caused by: javax.mail.MessagingException: Error in input stream;
  nested exception is:
	java.io.IOException: Attempted read on closed stream.
	at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
	at javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
	at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
	at org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
	at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
	... 6 more


This is the soap message when I upload and download:

</soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
application/octet-streamContent-Transfer-Encoding: binaryContent-ID: 
      <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0

This is soap message when I download:

--MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
7e8

Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: 
      <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
Rogue class
38

--MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
2
--
0

Do you think it is because the way it prepares the SOAP message on server
side ?

Thanks.




Thilina Gunarathne wrote:
> 
> Hi,
> I would have a WSDL with a string return field (or a complex type
> containing a string element) and would assign the content-id to that
> string.
> 
> You can have a look at the following articles to figure out how to add
> the attachment in the service implementation class..
> http://wso2.org/library/1675
> http://wso2.org/library/1148
> 
> String contentId = messageContext.addAttachment(dataHandler);
> 
> thanks,
> Thilina
> 
> 
> On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>>
>>  Thanks Thilina,
>>
>>  I was able to modify according to your suggestion to upload the file
>> using
>>  ADB with SwA.
>>
>>  But for the dowload using ADB with SwA, how do we modify the SOAP
>> message to
>>  attach the binary data ?
>>  Do we have to modify in invokeBusinessLogic(...) function ?
>>
>>  Thanks.
>>
>>
>>
>>  Thilina Gunarathne wrote:
>>  >
>>  > Hi,
>>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
>>  > does not support SwA directly..
>>  >
>>  > What you can do in the server side is to have your method signature
>>  > take in an String which will be the content-id of the attachment, then
>>  > retrieve your attachment from the messageContext manually using it...
>>  > Have a look at [1] & [2]..
>>  >
>>  > Your following method will result in an MTOM WSDL, where dataHandler
>>  > will get bound to an base64Binary element.
>>  >
>>  >>  addContentFile(String userID, String password,
>>  >>                         String serviceID, DataHandler dataHandler,
>>  >>                         String relAddFilepathName, String
>> contentType,
>>  >> String source)
>>  >
>>  > thanks,
>>  > Thilina
>>  >
>>  > [1] Using SOAP with Attachments in Apache Axis2 -
>>  > http://wso2.org/library/1148
>>  > [2] Downloading a Binary File from a Web Service using Axis2 and SOAP
>>  > with Attachments - http://wso2.org/library/1675
>>  >
>>  >>
>>  >>  How do I write a wsdl for it so I can generate the client and server
>>  >> using
>>  >>  ADB.
>>  >>
>>  >>
>>  >>
>>  >>  Thanks
>>  >>  --
>>  >>  View this message in context:
>>  >>
>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>>  >>
>>  >>
>>  >> 
>> ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>  >>
>>  >>
>>  >
>>  >
>>  >
>>  > --
>>  > Thilina Gunarathne - http://thilinag.blogspot.com
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>>  >
>>  >
>>  >
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>>
>>
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 
> 
> -- 
> Thilina Gunarathne - http://thilinag.blogspot.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16418442.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Using SWA with ADB in axis2

Posted by ndthuy <nd...@yahoo.com>.
Detelin,

It is working. Thanks a lot Detelin.

Thanks.


ndthuy wrote:
> 
> Detelin,
> 
> You saved my day. I will test it tomorrow and let you know the result.
> 
> Thanks a lot.
> 
> Detelin Yordanov wrote:
>> 
>> Hello,
>>   I have experienced the same problem - the reason is that in your client
>> stub the message context is cleaned up
>> right after building the response object, e.g.:
>> 
>> _operationClient.execute(true);
>> ...
>> java.lang.Object object = fromOM( ...);
>> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
>> 
>> return XXX;
>> 
>> The cleanup closes the stream that the response has been read from, so
>> that
>> if you try to read the attachments later on (after returning from the
>> stub's
>> method) you will get the mentioned exception.
>> 
>> I do not know whether you can instruct ADB to read the attachments for
>> you,
>> the simplest workaround if you just have one stub
>> is to insert code that will read the attachments before the message
>> context
>> gets cleaned up.
>> 
>> Regards,
>>    Detelin
>> 
>> 
>> 
>> On Tue, Apr 1, 2008 at 4:52 PM, ndthuy <nd...@yahoo.com> wrote:
>> 
>>>
>>> Hi Thilina,
>>>
>>> After taking a look at those articles, I am able to upload the file
>>> without
>>> any problem. But when I download the file, I received this error:
>>>
>>> Exception in thread "main" org.apache.axiom.om.OMException:
>>> javax.mail.MessagingException: Error in input stream;
>>>  nested exception is:
>>>        java.io.IOException: Attempted read on closed stream.
>>>        at
>>> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
>>>        at
>>>
>>> org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
>>>        at
>>>
>>> org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
>>>        at
>>>
>>> org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
>>>        at
>>>
>>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
>>>        at
>>>
>>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
>>>        at
>>>
>>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
>>> Caused by: javax.mail.MessagingException: Error in input stream;
>>>  nested exception is:
>>>        java.io.IOException: Attempted read on closed stream.
>>>        at
>>> javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
>>>        at
>>> javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
>>>        at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
>>>        at
>>> org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
>>>        at
>>> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
>>>        ... 6 more
>>>
>>>
>>> This is the soap message when I upload and download:
>>>
>>>
>>> </soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
>>> application/octet-streamContent-Transfer-Encoding: binaryContent-ID:
>>>      <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
>>> Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
>>>
>>> This is soap message when I download:
>>>
>>> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>>> 7e8
>>>
>>> Content-Type: application/octet-stream
>>> Content-Transfer-Encoding: binary
>>> Content-ID:
>>>      <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
>>> Rogue class
>>> 38
>>>
>>> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>>> 2
>>> --
>>> 0
>>>
>>> Do you think it is because the way it prepares the SOAP message on
>>> server
>>> side ?
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>> Thilina Gunarathne wrote:
>>> >
>>> > Hi,
>>> > I would have a WSDL with a string return field (or a complex type
>>> > containing a string element) and would assign the content-id to that
>>> > string.
>>> >
>>> > You can have a look at the following articles to figure out how to add
>>> > the attachment in the service implementation class..
>>> > http://wso2.org/library/1675
>>> > http://wso2.org/library/1148
>>> >
>>> > String contentId = messageContext.addAttachment(dataHandler);
>>> >
>>> > thanks,
>>> > Thilina
>>> >
>>> >
>>> > On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>>> >>
>>> >>  Thanks Thilina,
>>> >>
>>> >>  I was able to modify according to your suggestion to upload the file
>>> >> using
>>> >>  ADB with SwA.
>>> >>
>>> >>  But for the dowload using ADB with SwA, how do we modify the SOAP
>>> >> message to
>>> >>  attach the binary data ?
>>> >>  Do we have to modify in invokeBusinessLogic(...) function ?
>>> >>
>>> >>  Thanks.
>>> >>
>>> >>
>>> >>
>>> >>  Thilina Gunarathne wrote:
>>> >>  >
>>> >>  > Hi,
>>> >>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>>> >>  > there isn't a standard way to mention SwA attachments in WSDL..
>>> ADB
>>> >>  > does not support SwA directly..
>>> >>  >
>>> >>  > What you can do in the server side is to have your method
>>> signature
>>> >>  > take in an String which will be the content-id of the attachment,
>>> then
>>> >>  > retrieve your attachment from the messageContext manually using
>>> it...
>>> >>  > Have a look at [1] & [2]..
>>> >>  >
>>> >>  > Your following method will result in an MTOM WSDL, where
>>> dataHandler
>>> >>  > will get bound to an base64Binary element.
>>> >>  >
>>> >>  >>  addContentFile(String userID, String password,
>>> >>  >>                         String serviceID, DataHandler
>>> dataHandler,
>>> >>  >>                         String relAddFilepathName, String
>>> >> contentType,
>>> >>  >> String source)
>>> >>  >
>>> >>  > thanks,
>>> >>  > Thilina
>>> >>  >
>>> >>  > [1] Using SOAP with Attachments in Apache Axis2 -
>>> >>  > http://wso2.org/library/1148
>>> >>  > [2] Downloading a Binary File from a Web Service using Axis2 and
>>> SOAP
>>> >>  > with Attachments - http://wso2.org/library/1675
>>> >>  >
>>> >>  >>
>>> >>  >>  How do I write a wsdl for it so I can generate the client and
>>> server
>>> >>  >> using
>>> >>  >>  ADB.
>>> >>  >>
>>> >>  >>
>>> >>  >>
>>> >>  >>  Thanks
>>> >>  >>  --
>>> >>  >>  View this message in context:
>>> >>  >>
>>> >>
>>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>>> >>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>>> >>  >>
>>> >>  >>
>>> >>  >>
>>> >> ---------------------------------------------------------------------
>>> >>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> >>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>> >>  >>
>>> >>  >>
>>> >>  >
>>> >>  >
>>> >>  >
>>> >>  > --
>>> >>  > Thilina Gunarathne - http://thilinag.blogspot.com
>>> >>  >
>>> >>  >
>>> ---------------------------------------------------------------------
>>> >>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> >>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>>> >>  >
>>> >>  >
>>> >>  >
>>> >>
>>> >>  --
>>> >>  View this message in context:
>>> >>
>>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>>> >>
>>> >>
>>> >> Sent from the Axis - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >> 
>>> ---------------------------------------------------------------------
>>> >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Thilina Gunarathne - http://thilinag.blogspot.com
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> > For additional commands, e-mail: axis-user-help@ws.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16418442.html
>>> Sent from the Axis - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16537440.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Using SWA with ADB in axis2

Posted by ndthuy <nd...@yahoo.com>.
Detelin,

You saved my day. I will test it tomorrow and let you know the result.

Thanks a lot.

Detelin Yordanov wrote:
> 
> Hello,
>   I have experienced the same problem - the reason is that in your client
> stub the message context is cleaned up
> right after building the response object, e.g.:
> 
> _operationClient.execute(true);
> ...
> java.lang.Object object = fromOM( ...);
> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
> 
> return XXX;
> 
> The cleanup closes the stream that the response has been read from, so
> that
> if you try to read the attachments later on (after returning from the
> stub's
> method) you will get the mentioned exception.
> 
> I do not know whether you can instruct ADB to read the attachments for
> you,
> the simplest workaround if you just have one stub
> is to insert code that will read the attachments before the message
> context
> gets cleaned up.
> 
> Regards,
>    Detelin
> 
> 
> 
> On Tue, Apr 1, 2008 at 4:52 PM, ndthuy <nd...@yahoo.com> wrote:
> 
>>
>> Hi Thilina,
>>
>> After taking a look at those articles, I am able to upload the file
>> without
>> any problem. But when I download the file, I received this error:
>>
>> Exception in thread "main" org.apache.axiom.om.OMException:
>> javax.mail.MessagingException: Error in input stream;
>>  nested exception is:
>>        java.io.IOException: Attempted read on closed stream.
>>        at
>> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
>>        at
>>
>> org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
>>        at
>>
>> org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
>>        at
>>
>> org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
>>        at
>>
>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
>>        at
>>
>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
>>        at
>>
>> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
>> Caused by: javax.mail.MessagingException: Error in input stream;
>>  nested exception is:
>>        java.io.IOException: Attempted read on closed stream.
>>        at
>> javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
>>        at
>> javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
>>        at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
>>        at
>> org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
>>        at
>> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
>>        ... 6 more
>>
>>
>> This is the soap message when I upload and download:
>>
>>
>> </soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
>> application/octet-streamContent-Transfer-Encoding: binaryContent-ID:
>>      <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
>> Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
>>
>> This is soap message when I download:
>>
>> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>> 7e8
>>
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>> Content-ID:
>>      <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
>> Rogue class
>> 38
>>
>> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>> 2
>> --
>> 0
>>
>> Do you think it is because the way it prepares the SOAP message on server
>> side ?
>>
>> Thanks.
>>
>>
>>
>>
>> Thilina Gunarathne wrote:
>> >
>> > Hi,
>> > I would have a WSDL with a string return field (or a complex type
>> > containing a string element) and would assign the content-id to that
>> > string.
>> >
>> > You can have a look at the following articles to figure out how to add
>> > the attachment in the service implementation class..
>> > http://wso2.org/library/1675
>> > http://wso2.org/library/1148
>> >
>> > String contentId = messageContext.addAttachment(dataHandler);
>> >
>> > thanks,
>> > Thilina
>> >
>> >
>> > On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>> >>
>> >>  Thanks Thilina,
>> >>
>> >>  I was able to modify according to your suggestion to upload the file
>> >> using
>> >>  ADB with SwA.
>> >>
>> >>  But for the dowload using ADB with SwA, how do we modify the SOAP
>> >> message to
>> >>  attach the binary data ?
>> >>  Do we have to modify in invokeBusinessLogic(...) function ?
>> >>
>> >>  Thanks.
>> >>
>> >>
>> >>
>> >>  Thilina Gunarathne wrote:
>> >>  >
>> >>  > Hi,
>> >>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>> >>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
>> >>  > does not support SwA directly..
>> >>  >
>> >>  > What you can do in the server side is to have your method signature
>> >>  > take in an String which will be the content-id of the attachment,
>> then
>> >>  > retrieve your attachment from the messageContext manually using
>> it...
>> >>  > Have a look at [1] & [2]..
>> >>  >
>> >>  > Your following method will result in an MTOM WSDL, where
>> dataHandler
>> >>  > will get bound to an base64Binary element.
>> >>  >
>> >>  >>  addContentFile(String userID, String password,
>> >>  >>                         String serviceID, DataHandler dataHandler,
>> >>  >>                         String relAddFilepathName, String
>> >> contentType,
>> >>  >> String source)
>> >>  >
>> >>  > thanks,
>> >>  > Thilina
>> >>  >
>> >>  > [1] Using SOAP with Attachments in Apache Axis2 -
>> >>  > http://wso2.org/library/1148
>> >>  > [2] Downloading a Binary File from a Web Service using Axis2 and
>> SOAP
>> >>  > with Attachments - http://wso2.org/library/1675
>> >>  >
>> >>  >>
>> >>  >>  How do I write a wsdl for it so I can generate the client and
>> server
>> >>  >> using
>> >>  >>  ADB.
>> >>  >>
>> >>  >>
>> >>  >>
>> >>  >>  Thanks
>> >>  >>  --
>> >>  >>  View this message in context:
>> >>  >>
>> >>
>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>> >>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>> >>  >>
>> >>  >>
>> >>  >>
>> >> ---------------------------------------------------------------------
>> >>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>  >>
>> >>  >>
>> >>  >
>> >>  >
>> >>  >
>> >>  > --
>> >>  > Thilina Gunarathne - http://thilinag.blogspot.com
>> >>  >
>> >>  >
>> ---------------------------------------------------------------------
>> >>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>  >
>> >>  >
>> >>  >
>> >>
>> >>  --
>> >>  View this message in context:
>> >>
>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>> >>
>> >>
>> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>  ---------------------------------------------------------------------
>> >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Thilina Gunarathne - http://thilinag.blogspot.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-user-help@ws.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16418442.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16463638.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Using SWA with ADB in axis2

Posted by Detelin Yordanov <de...@gmail.com>.
Hello,
  I have experienced the same problem - the reason is that in your client
stub the message context is cleaned up
right after building the response object, e.g.:

_operationClient.execute(true);
...
java.lang.Object object = fromOM( ...);
_messageContext.getTransportOut().getSender().cleanup(_messageContext);

return XXX;

The cleanup closes the stream that the response has been read from, so that
if you try to read the attachments later on (after returning from the stub's
method) you will get the mentioned exception.

I do not know whether you can instruct ADB to read the attachments for you,
the simplest workaround if you just have one stub
is to insert code that will read the attachments before the message context
gets cleaned up.

Regards,
   Detelin



On Tue, Apr 1, 2008 at 4:52 PM, ndthuy <nd...@yahoo.com> wrote:

>
> Hi Thilina,
>
> After taking a look at those articles, I am able to upload the file
> without
> any problem. But when I download the file, I received this error:
>
> Exception in thread "main" org.apache.axiom.om.OMException:
> javax.mail.MessagingException: Error in input stream;
>  nested exception is:
>        java.io.IOException: Attempted read on closed stream.
>        at
> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
>        at
>
> org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
>        at
>
> org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
>        at
>
> org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
>        at
>
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
>        at
>
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
>        at
>
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
> Caused by: javax.mail.MessagingException: Error in input stream;
>  nested exception is:
>        java.io.IOException: Attempted read on closed stream.
>        at
> javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
>        at
> javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
>        at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
>        at
> org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
>        at
> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
>        ... 6 more
>
>
> This is the soap message when I upload and download:
>
>
> </soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
> application/octet-streamContent-Transfer-Encoding: binaryContent-ID:
>      <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
> Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
>
> This is soap message when I download:
>
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 7e8
>
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID:
>      <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
> Rogue class
> 38
>
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 2
> --
> 0
>
> Do you think it is because the way it prepares the SOAP message on server
> side ?
>
> Thanks.
>
>
>
>
> Thilina Gunarathne wrote:
> >
> > Hi,
> > I would have a WSDL with a string return field (or a complex type
> > containing a string element) and would assign the content-id to that
> > string.
> >
> > You can have a look at the following articles to figure out how to add
> > the attachment in the service implementation class..
> > http://wso2.org/library/1675
> > http://wso2.org/library/1148
> >
> > String contentId = messageContext.addAttachment(dataHandler);
> >
> > thanks,
> > Thilina
> >
> >
> > On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
> >>
> >>  Thanks Thilina,
> >>
> >>  I was able to modify according to your suggestion to upload the file
> >> using
> >>  ADB with SwA.
> >>
> >>  But for the dowload using ADB with SwA, how do we modify the SOAP
> >> message to
> >>  attach the binary data ?
> >>  Do we have to modify in invokeBusinessLogic(...) function ?
> >>
> >>  Thanks.
> >>
> >>
> >>
> >>  Thilina Gunarathne wrote:
> >>  >
> >>  > Hi,
> >>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
> >>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
> >>  > does not support SwA directly..
> >>  >
> >>  > What you can do in the server side is to have your method signature
> >>  > take in an String which will be the content-id of the attachment,
> then
> >>  > retrieve your attachment from the messageContext manually using
> it...
> >>  > Have a look at [1] & [2]..
> >>  >
> >>  > Your following method will result in an MTOM WSDL, where dataHandler
> >>  > will get bound to an base64Binary element.
> >>  >
> >>  >>  addContentFile(String userID, String password,
> >>  >>                         String serviceID, DataHandler dataHandler,
> >>  >>                         String relAddFilepathName, String
> >> contentType,
> >>  >> String source)
> >>  >
> >>  > thanks,
> >>  > Thilina
> >>  >
> >>  > [1] Using SOAP with Attachments in Apache Axis2 -
> >>  > http://wso2.org/library/1148
> >>  > [2] Downloading a Binary File from a Web Service using Axis2 and
> SOAP
> >>  > with Attachments - http://wso2.org/library/1675
> >>  >
> >>  >>
> >>  >>  How do I write a wsdl for it so I can generate the client and
> server
> >>  >> using
> >>  >>  ADB.
> >>  >>
> >>  >>
> >>  >>
> >>  >>  Thanks
> >>  >>  --
> >>  >>  View this message in context:
> >>  >>
> >>
> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
> >>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
> >>  >>
> >>  >>
> >>  >>
> >> ---------------------------------------------------------------------
> >>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
> >>  >>
> >>  >>
> >>  >
> >>  >
> >>  >
> >>  > --
> >>  > Thilina Gunarathne - http://thilinag.blogspot.com
> >>  >
> >>  >
> ---------------------------------------------------------------------
> >>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >>  > For additional commands, e-mail: axis-user-help@ws.apache.org
> >>  >
> >>  >
> >>  >
> >>
> >>  --
> >>  View this message in context:
> >>
> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
> >>
> >>
> >> Sent from the Axis - User mailing list archive at Nabble.com.
> >>
> >>
> >>  ---------------------------------------------------------------------
> >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >>  For additional commands, e-mail: axis-user-help@ws.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Thilina Gunarathne - http://thilinag.blogspot.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16418442.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Using SWA with ADB in axis2

Posted by Thilina Gunarathne <cs...@gmail.com>.
Detelin, Good observation... I was lost in this question :)..

ndthuy,
Try inserting the following line before the call to
....cleanup(_messageContext) in the stub...
_messageContext.getEnvelope().buildWithAttachments();


thanks,
Thilina

On Wed, Apr 2, 2008 at 10:04 AM, ndthuy <nd...@yahoo.com> wrote:
>
>  I were trying the same method call when I tried to download the file then I
>  received the exception. I was able to see the attachment but I couldn't
>  retrieve it.
>
>  Thanks.
>
>
>
>  ndthuy wrote:
>  >
>  > Hi Thilina,
>  >
>  > After taking a look at those articles, I am able to upload the file
>  > without any problem. But when I download the file, I received this error:
>  >
>  > Exception in thread "main" org.apache.axiom.om.OMException:
>  > javax.mail.MessagingException: Error in input stream;
>  >   nested exception is:
>  >       java.io.IOException: Attempted read on closed stream.
>  >       at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
>  >       at
>  > org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
>  >       at
>  > org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
>  >       at
>  > org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
>  >       at
>  > com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
>  >       at
>  > com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
>  >       at
>  > com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
>  > Caused by: javax.mail.MessagingException: Error in input stream;
>  >   nested exception is:
>  >       java.io.IOException: Attempted read on closed stream.
>  >       at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
>  >       at javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
>  >       at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
>  >       at org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
>  >       at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
>  >       ... 6 more
>  >
>  >
>  > This is the soap message when I upload and download:
>  >
>  > </soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
>  > application/octet-streamContent-Transfer-Encoding: binaryContent-ID:
>  >       <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
>  > Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
>  >
>  > This is soap message when I download:
>  >
>  > --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>  > 7e8
>  >
>  > Content-Type: application/octet-stream
>  > Content-Transfer-Encoding: binary
>  > Content-ID:
>  >       <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
>  > Rogue class
>  > 38
>  >
>  > --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
>  > 2
>  > --
>  > 0
>  >
>  > Do you think it is because the way it prepares the SOAP message on server
>  > side ? Thanks for your help.
>
>
> >
>  > Thanks.
>  >
>  >
>  >
>  >
>  > Thilina Gunarathne wrote:
>  >>
>  >> Hi,
>  >> I would have a WSDL with a string return field (or a complex type
>  >> containing a string element) and would assign the content-id to that
>  >> string.
>  >>
>  >> You can have a look at the following articles to figure out how to add
>  >> the attachment in the service implementation class..
>  >> http://wso2.org/library/1675
>  >> http://wso2.org/library/1148
>  >>
>  >> String contentId = messageContext.addAttachment(dataHandler);
>  >>
>  >> thanks,
>  >> Thilina
>  >>
>  >>
>  >> On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>  >>>
>  >>>  Thanks Thilina,
>  >>>
>  >>>  I was able to modify according to your suggestion to upload the file
>  >>> using
>  >>>  ADB with SwA.
>  >>>
>  >>>  But for the dowload using ADB with SwA, how do we modify the SOAP
>  >>> message to
>  >>>  attach the binary data ?
>  >>>  Do we have to modify in invokeBusinessLogic(...) function ?
>  >>>
>  >>>  Thanks.
>  >>>
>  >>>
>  >>>
>  >>>  Thilina Gunarathne wrote:
>  >>>  >
>  >>>  > Hi,
>  >>>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>  >>>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
>  >>>  > does not support SwA directly..
>  >>>  >
>  >>>  > What you can do in the server side is to have your method signature
>  >>>  > take in an String which will be the content-id of the attachment,
>  >>> then
>  >>>  > retrieve your attachment from the messageContext manually using it...
>  >>>  > Have a look at [1] & [2]..
>  >>>  >
>  >>>  > Your following method will result in an MTOM WSDL, where dataHandler
>  >>>  > will get bound to an base64Binary element.
>  >>>  >
>  >>>  >>  addContentFile(String userID, String password,
>  >>>  >>                         String serviceID, DataHandler dataHandler,
>  >>>  >>                         String relAddFilepathName, String
>  >>> contentType,
>  >>>  >> String source)
>  >>>  >
>  >>>  > thanks,
>  >>>  > Thilina
>  >>>  >
>  >>>  > [1] Using SOAP with Attachments in Apache Axis2 -
>  >>>  > http://wso2.org/library/1148
>  >>>  > [2] Downloading a Binary File from a Web Service using Axis2 and SOAP
>  >>>  > with Attachments - http://wso2.org/library/1675
>  >>>  >
>  >>>  >>
>  >>>  >>  How do I write a wsdl for it so I can generate the client and
>  >>> server
>  >>>  >> using
>  >>>  >>  ADB.
>  >>>  >>
>  >>>  >>
>  >>>  >>
>  >>>  >>  Thanks
>  >>>  >>  --
>  >>>  >>  View this message in context:
>  >>>  >>
>  >>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>  >>>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>  >>>  >>
>  >>>  >>
>  >>>  >>
>  >>> ---------------------------------------------------------------------
>  >>>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>  >>>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>  >>>  >>
>  >>>  >>
>  >>>  >
>  >>>  >
>  >>>  >
>  >>>  > --
>  >>>  > Thilina Gunarathne - http://thilinag.blogspot.com
>  >>>  >
>  >>>  > ---------------------------------------------------------------------
>  >>>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>  >>>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>  >>>  >
>  >>>  >
>  >>>  >
>  >>>
>  >>>  --
>  >>>  View this message in context:
>  >>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>  >>>
>  >>>
>  >>> Sent from the Axis - User mailing list archive at Nabble.com.
>  >>>
>  >>>
>  >>>  ---------------------------------------------------------------------
>  >>>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>  >>>  For additional commands, e-mail: axis-user-help@ws.apache.org
>  >>>
>  >>>
>  >>
>  >>
>  >>
>  >> --
>  >> Thilina Gunarathne - http://thilinag.blogspot.com
>  >>
>  >> ---------------------------------------------------------------------
>  >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>  >> For additional commands, e-mail: axis-user-help@ws.apache.org
>  >>
>  >>
>  >>
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16447064.html
>
>
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>  For additional commands, e-mail: axis-user-help@ws.apache.org
>
>



-- 
Thilina Gunarathne - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Using SWA with ADB in axis2

Posted by Yo...@mizuhocbus.com.
Can you place TCPMON inbetween and  show us what kind of request you send 
and receive.
regards
Yogesh



ndthuy <nd...@yahoo.com> 
04/02/2008 10:05 AM
Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org
cc

Subject
Re: Using SWA with ADB in axis2







I were trying the same method call when I tried to download the file then 
I
received the exception. I was able to see the attachment but I couldn't
retrieve it. 

Thanks.

ndthuy wrote:
> 
> Hi Thilina,
> 
> After taking a look at those articles, I am able to upload the file
> without any problem. But when I download the file, I received this 
error: 
> 
> Exception in thread "main" org.apache.axiom.om.OMException:
> javax.mail.MessagingException: Error in input stream;
>   nested exception is:
>                java.io.IOException: Attempted read on closed stream.
>                at 
org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
>                at
> 
org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
>                at
> 
org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
>                at
> 
org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
>                at
> 
com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
>                at
> 
com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
>                at
> 
com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
> Caused by: javax.mail.MessagingException: Error in input stream;
>   nested exception is:
>                java.io.IOException: Attempted read on closed stream.
>                at 
javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
>                at 
javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
>                at 
javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
>                at 
org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
>                at 
org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
>                ... 6 more
> 
> 
> This is the soap message when I upload and download:
> 
> 
</soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
> application/octet-streamContent-Transfer-Encoding: binaryContent-ID: 
>       <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
> Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
> 
> This is soap message when I download:
> 
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 7e8
> 
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID: 
>       <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
> Rogue class
> 38
> 
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 2
> --
> 0
> 
> Do you think it is because the way it prepares the SOAP message on 
server
> side ? Thanks for your help.
> 
> Thanks.
> 
> 
> 
> 
> Thilina Gunarathne wrote:
>> 
>> Hi,
>> I would have a WSDL with a string return field (or a complex type
>> containing a string element) and would assign the content-id to that
>> string.
>> 
>> You can have a look at the following articles to figure out how to add
>> the attachment in the service implementation class..
>> http://wso2.org/library/1675
>> http://wso2.org/library/1148
>> 
>> String contentId = messageContext.addAttachment(dataHandler);
>> 
>> thanks,
>> Thilina
>> 
>> 
>> On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>>>
>>>  Thanks Thilina,
>>>
>>>  I was able to modify according to your suggestion to upload the file
>>> using
>>>  ADB with SwA.
>>>
>>>  But for the dowload using ADB with SwA, how do we modify the SOAP
>>> message to
>>>  attach the binary data ?
>>>  Do we have to modify in invokeBusinessLogic(...) function ?
>>>
>>>  Thanks.
>>>
>>>
>>>
>>>  Thilina Gunarathne wrote:
>>>  >
>>>  > Hi,
>>>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>>>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
>>>  > does not support SwA directly..
>>>  >
>>>  > What you can do in the server side is to have your method signature
>>>  > take in an String which will be the content-id of the attachment,
>>> then
>>>  > retrieve your attachment from the messageContext manually using 
it...
>>>  > Have a look at [1] & [2]..
>>>  >
>>>  > Your following method will result in an MTOM WSDL, where 
dataHandler
>>>  > will get bound to an base64Binary element.
>>>  >
>>>  >>  addContentFile(String userID, String password,
>>>  >>                         String serviceID, DataHandler dataHandler,
>>>  >>                         String relAddFilepathName, String
>>> contentType,
>>>  >> String source)
>>>  >
>>>  > thanks,
>>>  > Thilina
>>>  >
>>>  > [1] Using SOAP with Attachments in Apache Axis2 -
>>>  > http://wso2.org/library/1148
>>>  > [2] Downloading a Binary File from a Web Service using Axis2 and 
SOAP
>>>  > with Attachments - http://wso2.org/library/1675
>>>  >
>>>  >>
>>>  >>  How do I write a wsdl for it so I can generate the client and
>>> server
>>>  >> using
>>>  >>  ADB.
>>>  >>
>>>  >>
>>>  >>
>>>  >>  Thanks
>>>  >>  --
>>>  >>  View this message in context:
>>>  >>
>>> 
http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>>>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>>>  >>
>>>  >>
>>>  >> 
>>> ---------------------------------------------------------------------
>>>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>>  >>
>>>  >>
>>>  >
>>>  >
>>>  >
>>>  > --
>>>  > Thilina Gunarathne - http://thilinag.blogspot.com
>>>  >
>>>  > 
---------------------------------------------------------------------
>>>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>>>  >
>>>  >
>>>  >
>>>
>>>  --
>>>  View this message in context:
>>> 
http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>>>
>>>
>>> Sent from the Axis - User mailing list archive at Nabble.com.
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Thilina Gunarathne - http://thilinag.blogspot.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16447064.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



======================================================================================================
This transmittal and any attachments may contain confidential, privileged or sensitive information and is solely for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that you have received this transmittal and any attachments in error and any review, dissemination, distribution or copying thereof is strictly prohibited. If you have received this transmittal and any attachments in error please notify the sender and immediately destroy the message and all its attachments. Any opinions herein expressed may be those of the author and not necessarily of Mizuho Corporate Bank, Ltd., Mizuho Corporate Bank (USA), Mizuho Securities USA Inc. or any other affiliates of Mizuho Financial Group (”Mizuho”). Mizuho accepts no responsibility for the accuracy or completeness of any information herein contained.
E-Mail received by or sent from officer of Mizuho Securities USA Inc. (which is a registered U.S. broker-dealer and the entity through which Mizuho generally conducts its investment banking, capital markets, and securities business in the United States) is electronically archived and recorded and is subject to review and monitoring by and/or disclosure to persons other than the recipient, including (but not limited to) Mizuho Securities USA Inc. supervisory personnel.  Such communications may be produced to regulatory authorities or others with legal rights to the information.

Re: Using SWA with ADB in axis2

Posted by ndthuy <nd...@yahoo.com>.
I were trying the same method call when I tried to download the file then I
received the exception. I was able to see the attachment but I couldn't
retrieve it. 

Thanks.

ndthuy wrote:
> 
> Hi Thilina,
> 
> After taking a look at those articles, I am able to upload the file
> without any problem. But when I download the file, I received this error: 
> 
> Exception in thread "main" org.apache.axiom.om.OMException:
> javax.mail.MessagingException: Error in input stream;
>   nested exception is:
> 	java.io.IOException: Attempted read on closed stream.
> 	at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
> 	at
> org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
> 	at
> org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
> 	at
> org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
> 	at
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
> 	at
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
> 	at
> com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
> Caused by: javax.mail.MessagingException: Error in input stream;
>   nested exception is:
> 	java.io.IOException: Attempted read on closed stream.
> 	at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
> 	at javax.mail.internet.InternetHeaders.<init>(InternetHeaders.java:93)
> 	at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:124)
> 	at org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
> 	at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
> 	... 6 more
> 
> 
> This is the soap message when I upload and download:
> 
> </soapenv:Envelope>--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
> application/octet-streamContent-Transfer-Encoding: binaryContent-ID: 
>       <urn:uuid:1ADD9EC725995A3FD11206998814743>/*    Pogue.cs - Custom
> Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0
> 
> This is soap message when I download:
> 
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 7e8
> 
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
> Content-ID: 
>       <urn:uuid:5042108D598DCCE8AE1206999117974>/*    Pogue.cs - Custom
> Rogue class
> 38
> 
> --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
> 2
> --
> 0
> 
> Do you think it is because the way it prepares the SOAP message on server
> side ? Thanks for your help.
> 
> Thanks.
> 
> 
> 
> 
> Thilina Gunarathne wrote:
>> 
>> Hi,
>> I would have a WSDL with a string return field (or a complex type
>> containing a string element) and would assign the content-id to that
>> string.
>> 
>> You can have a look at the following articles to figure out how to add
>> the attachment in the service implementation class..
>> http://wso2.org/library/1675
>> http://wso2.org/library/1148
>> 
>> String contentId = messageContext.addAttachment(dataHandler);
>> 
>> thanks,
>> Thilina
>> 
>> 
>> On Mon, Mar 31, 2008 at 11:14 AM, ndthuy <nd...@yahoo.com> wrote:
>>>
>>>  Thanks Thilina,
>>>
>>>  I was able to modify according to your suggestion to upload the file
>>> using
>>>  ADB with SwA.
>>>
>>>  But for the dowload using ADB with SwA, how do we modify the SOAP
>>> message to
>>>  attach the binary data ?
>>>  Do we have to modify in invokeBusinessLogic(...) function ?
>>>
>>>  Thanks.
>>>
>>>
>>>
>>>  Thilina Gunarathne wrote:
>>>  >
>>>  > Hi,
>>>  > You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
>>>  > there isn't a standard way to mention SwA attachments in WSDL.. ADB
>>>  > does not support SwA directly..
>>>  >
>>>  > What you can do in the server side is to have your method signature
>>>  > take in an String which will be the content-id of the attachment,
>>> then
>>>  > retrieve your attachment from the messageContext manually using it...
>>>  > Have a look at [1] & [2]..
>>>  >
>>>  > Your following method will result in an MTOM WSDL, where dataHandler
>>>  > will get bound to an base64Binary element.
>>>  >
>>>  >>  addContentFile(String userID, String password,
>>>  >>                         String serviceID, DataHandler dataHandler,
>>>  >>                         String relAddFilepathName, String
>>> contentType,
>>>  >> String source)
>>>  >
>>>  > thanks,
>>>  > Thilina
>>>  >
>>>  > [1] Using SOAP with Attachments in Apache Axis2 -
>>>  > http://wso2.org/library/1148
>>>  > [2] Downloading a Binary File from a Web Service using Axis2 and SOAP
>>>  > with Attachments - http://wso2.org/library/1675
>>>  >
>>>  >>
>>>  >>  How do I write a wsdl for it so I can generate the client and
>>> server
>>>  >> using
>>>  >>  ADB.
>>>  >>
>>>  >>
>>>  >>
>>>  >>  Thanks
>>>  >>  --
>>>  >>  View this message in context:
>>>  >>
>>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16335414.html
>>>  >>  Sent from the Axis - User mailing list archive at Nabble.com.
>>>  >>
>>>  >>
>>>  >> 
>>> ---------------------------------------------------------------------
>>>  >>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  >>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>>  >>
>>>  >>
>>>  >
>>>  >
>>>  >
>>>  > --
>>>  > Thilina Gunarathne - http://thilinag.blogspot.com
>>>  >
>>>  > ---------------------------------------------------------------------
>>>  > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  > For additional commands, e-mail: axis-user-help@ws.apache.org
>>>  >
>>>  >
>>>  >
>>>
>>>  --
>>>  View this message in context:
>>> http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16396897.html
>>>
>>>
>>> Sent from the Axis - User mailing list archive at Nabble.com.
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>  For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Thilina Gunarathne - http://thilinag.blogspot.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-SWA-with-ADB-in-axis2-tp16335414p16447064.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org