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 th <sp...@hotmail.com> on 2008/11/03 16:48:13 UTC

about receive different types of attachment

hi,
 i'm using axis 1.3 to deploy a service to get request soap message with attachment using mtom,but i found the service can only receive .txt file.if receive another type file,for example test.rar which is 2M ,the attachment is in SOAP message,but when i get the attachment from a element that contains the attachment,i can only get 1K data.i do not know why .hope some help. thanks. the code that get attachment is follow:
        OMText binaryNode = (OMText) content.getFirstOMChild();
        binaryNode.setOptimize(true);
        DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();
        FileOutputStream textOutStream = new FileOutputStream("c:\\th.txt");
        InputStream is = actualDH.getInputStream();
        textOutStream.write(IOUtils.getStreamAsByteArray(is));

RE: about receive different types of attachment

Posted by 谭煌 <sp...@hotmail.com>.
hi,the stack trace is follow:
OMException in getSOAPBuilderorg.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110) at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609) at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache
 .axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at com.chinacreator.test.SWAClient.transferFile(SWAClient.java:192) at com.chinacreator.test.SWAClient.main(SWAClient.java:89)Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661) at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153) ... 12 moreException in thread "main" org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axis2.AxisFault.makeFault(AxisFau
 lt.java:417) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:89) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at com.chinacreator.test.SWAClient.transferFile(SWAClient.java:192)- Remaining input stream :[] at com.chinacreator.test.SWAClient.main(SWAClient.java:89)Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161) at org.apache.axiom.soap.impl.builder.StAX
 SOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110) at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609) at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87) ... 6 moreCaused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661) at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153) ... 12 more
I have tested it.I thought if the problem happend in .net side?

Date: Thu, 6 Nov 2008 07:49:56 -0500From: csethil@gmail.comTo: axis-user@ws.apache.orgSubject: Re: about receive different types of attachmentHi,Posting the whole stack trace might help us to identify it... Also you can use a tcp sniffer like tcpmon (ws.apache.org/commons/tcpmon) to capture ur messages.. In that way you can see whether ur .net service returns the error or any other errornous response..AFAIKS wstxEOFException occurres in Axis2...thanks,Thilina
2008/11/3 th <sp...@hotmail.com>


i changed the axis to 1.4, and the problem was sovled,but another problem occrus.that is ,use axis 1.4 to send request soap message with a 10M attachment to a .net services ,there was a exception,as follow:
WstxEOFException: Unexpected EOF in prolog error
i wonder if the problem is happen in .net services or in the axis 1.4 client



 

----- Original Message ----- 
From: th 
To: axis-user@ws.apache.org 
Sent: Monday, November 03, 2008 11:48 PM
Subject: about receive different types of attachment


hi,
 i'm using axis 1.3 to deploy a service to get request soap message with attachment using mtom,but i found the service can only receive .txt file.if receive another type file,for example test.rar which is 2M ,the attachment is in SOAP message,but when i get the attachment from a element that contains the attachment,i can only get 1K data.i do not know why .hope some help. thanks. the code that get attachment is follow:
        OMText binaryNode = (OMText) content.getFirstOMChild();        binaryNode.setOptimize(true);
        DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();        FileOutputStream textOutStream = new FileOutputStream("c:\\th.txt");        InputStream is = actualDH.getInputStream();        textOutStream.write(IOUtils.getStreamAsByteArray(is));-- Thilina Gunarathne  - http://thilinag.blogspot.com
_________________________________________________________________
超炫人气榜给您所有偶像的最新资讯和排名,快来支持自己的偶像!
http://cnweb.search.live.com/xrank/results.aspx?q=%e5%91%a8%e6%9d%b0%e4%bc%a6&FORM=MSNH

RE: about receive different types of attachment

Posted by 谭煌 <sp...@hotmail.com>.
hi,the stack trace is follow:
OMException in getSOAPBuilderorg.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110) at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609) at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache
 .axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at com.chinacreator.test.SWAClient.transferFile(SWAClient.java:192) at com.chinacreator.test.SWAClient.main(SWAClient.java:89)Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661) at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153) ... 12 moreException in thread "main" org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axis2.AxisFault.makeFault(AxisFau
 lt.java:417) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:89) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:326) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at com.chinacreator.test.SWAClient.transferFile(SWAClient.java:192)- Remaining input stream :[] at com.chinacreator.test.SWAClient.main(SWAClient.java:89)Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:239) at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161) at org.apache.axiom.soap.impl.builder.StAX
 SOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110) at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:609) at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:178) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:111) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:87) ... 6 moreCaused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661) at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153) ... 12 more
I have tested it.I thought if the problem happend in .net side?

Date: Thu, 6 Nov 2008 07:49:56 -0500From: csethil@gmail.comTo: axis-user@ws.apache.orgSubject: Re: about receive different types of attachmentHi,Posting the whole stack trace might help us to identify it... Also you can use a tcp sniffer like tcpmon (ws.apache.org/commons/tcpmon) to capture ur messages.. In that way you can see whether ur .net service returns the error or any other errornous response..AFAIKS wstxEOFException occurres in Axis2...thanks,Thilina
2008/11/3 th <sp...@hotmail.com>


i changed the axis to 1.4, and the problem was sovled,but another problem occrus.that is ,use axis 1.4 to send request soap message with a 10M attachment to a .net services ,there was a exception,as follow:
WstxEOFException: Unexpected EOF in prolog error
i wonder if the problem is happen in .net services or in the axis 1.4 client



 

----- Original Message ----- 
From: th 
To: axis-user@ws.apache.org 
Sent: Monday, November 03, 2008 11:48 PM
Subject: about receive different types of attachment


hi,
 i'm using axis 1.3 to deploy a service to get request soap message with attachment using mtom,but i found the service can only receive .txt file.if receive another type file,for example test.rar which is 2M ,the attachment is in SOAP message,but when i get the attachment from a element that contains the attachment,i can only get 1K data.i do not know why .hope some help. thanks. the code that get attachment is follow:
        OMText binaryNode = (OMText) content.getFirstOMChild();        binaryNode.setOptimize(true);
        DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();        FileOutputStream textOutStream = new FileOutputStream("c:\\th.txt");        InputStream is = actualDH.getInputStream();        textOutStream.write(IOUtils.getStreamAsByteArray(is));-- Thilina Gunarathne  - http://thilinag.blogspot.com
_________________________________________________________________
MSN热搜榜,每天最In的信息资讯和热点排行让您一览无余!
 http://top.msn.com.cn

Re: Axis2 SoapWithAttachement issue extra new line when attachment of specific size.

Posted by Andreas Veithen <an...@gmail.com>.
This looks like issue WSCOMMONS-328 [1] which has been fixed in Axiom
1.2.8. Newer versions of Axiom should still work with Axis 1.3, so you
might want to try to simply replace the Axiom JARs by the latest
version.

Andreas

[1] https://issues.apache.org/jira/browse/WSCOMMONS-328

2009/2/11 Yogesh.Dhake <Yo...@mizuhocbus.com>:
>
> Hi All
>
> I am using Axis 1.3    and seen a weird behavior with SWA   feature.  It look like when my size is of 849 bytes  a additional /r/n is added to message.
> If I send attachment of  848 bytes  I  do receive of exactly 848 bytes . But if I send attachment of 849 bytes. I receive 851 bytes.
>
>
> Way I receive Attachment
>
>
>                                 MessageContext msgCtx                    = MessageContext.getCurrentMessageContext();
>                                 Attachments    axiomAttachment           = msgCtx.getAttachmentMap();
>                                 DataHandler    fileAttachmentDataHandler = axiomAttachment.getDataHandler(SWAAttachmentId);
>                                 byteArrayOutputStream = new ByteArrayOutputStream();
>                                 fileAttachmentDataHandler.writeTo(byteArrayOutputStream);
>                                 logger.debug(" Data received length: " + data.length);
>
>
>
>
> My Question
>
> 1)  Is this a know issue in Axis?
> 2) Have any one seen this kind of behavior earlier.  Or it could be just me due to way I have done coding.
>
>
>
> Thanking you
>
> regards
> Yogesh Dhake
> ________________________________
>
> 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.
> If you have any questions, or if you no longer wish to receive e-mail in accordance with Japanese Act on Regulation of the Transmission of Specified Electronic Mail, please contact the sender of this e-mail.
> お問い合わせまたは特定電子メール法に 基づく送信停止のご要望等は、本電子メールの送信者にその旨ご連絡ください。

Axis2 SoapWithAttachement issue extra new line when attachment of specific size.

Posted by Yo...@mizuhocbus.com.
Hi All

I am using Axis 1.3    and seen a weird behavior with SWA   feature.  It 
look like when my size is of 849 bytes  a additional /r/n is added to 
message.
If I send attachment of  848 bytes  I  do receive of exactly 848 bytes . 
But if I send attachment of 849 bytes. I receive 851 bytes.


Way I receive Attachment 


                                MessageContext msgCtx                    = 
MessageContext.getCurrentMessageContext();
                                Attachments    axiomAttachment           = 
msgCtx.getAttachmentMap(); 
                                DataHandler    fileAttachmentDataHandler = 
axiomAttachment.getDataHandler(SWAAttachmentId); 
                                byteArrayOutputStream = new 
ByteArrayOutputStream(); 
 fileAttachmentDataHandler.writeTo(byteArrayOutputStream);  
                                logger.debug(" Data received length: " + 
data.length);




My Question 

1)  Is this a know issue in Axis?
2) Have any one seen this kind of behavior earlier.  Or it could be just 
me due to way I have done coding.



Thanking you

regards
Yogesh Dhake 
======================================================================================================
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.
If you have any questions, or if you no longer wish to receive e-mail in accordance with Japanese Act on Regulation of the Transmission of Specified Electronic Mail, please contact the sender of this e-mail.
お問い合わせまたは特定電子メール法に 基づく送信停止のご要望等は、本電子メールの送信者にその旨ご連絡ください。



Re: about receive different types of attachment

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
Posting the whole stack trace might help us to identify it...

Also you can use a tcp sniffer like tcpmon (ws.apache.org/commons/tcpmon) to
capture ur messages.. In that way you can see whether ur .net service
returns the error or any other errornous response..

AFAIKS wstxEOFException occurres in Axis2...

thanks,
Thilina

2008/11/3 th <sp...@hotmail.com>

>  i changed the axis to 1.4, and the problem was sovled,but another problem
> occrus.that is ,use axis 1.4 to send request soap message with a 10M
> attachment to a .net services ,there was a exception,as follow:
> WstxEOFException: Unexpected EOF in prolog error
> i wonder if the problem is happen in .net services or in the axis 1.4
> client
>
>
> ----- Original Message -----
> *From:* th <sp...@hotmail.com>
> *To:* axis-user@ws.apache.org
> *Sent:* Monday, November 03, 2008 11:48 PM
> *Subject:* about receive different types of attachment
>
>  hi,
>  i'm using axis 1.3 to deploy a service to get request soap message with
> attachment using mtom,but i found the service can only receive .txt file.if
> receive another type file,for example test.rar which is 2M ,the attachment
> is in SOAP message,but when i get the attachment from a element that
> contains the attachment,i can only get 1K data.i do not know why .hope some
> help. thanks. the code that get attachment is follow:
>         OMText binaryNode = (OMText) content.getFirstOMChild();
>         binaryNode.setOptimize(true);
>         DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();
>         FileOutputStream textOutStream = new
> FileOutputStream("c:\\th.txt");
>         InputStream is = actualDH.getInputStream();
>         textOutStream.write(IOUtils.getStreamAsByteArray(is));
>
>


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

Re: about receive different types of attachment

Posted by th <sp...@hotmail.com>.
i changed the axis to 1.4, and the problem was sovled,but another problem occrus.that is ,use axis 1.4 to send request soap message with a 10M attachment to a .net services ,there was a exception,as follow:
WstxEOFException: Unexpected EOF in prolog error
i wonder if the problem is happen in .net services or in the axis 1.4 client

  ----- Original Message ----- 
  From: th 
  To: axis-user@ws.apache.org 
  Sent: Monday, November 03, 2008 11:48 PM
  Subject: about receive different types of attachment


  hi,
   i'm using axis 1.3 to deploy a service to get request soap message with attachment using mtom,but i found the service can only receive .txt file.if receive another type file,for example test.rar which is 2M ,the attachment is in SOAP message,but when i get the attachment from a element that contains the attachment,i can only get 1K data.i do not know why .hope some help. thanks. the code that get attachment is follow:
          OMText binaryNode = (OMText) content.getFirstOMChild();
          binaryNode.setOptimize(true);
          DataHandler actualDH = (DataHandler) binaryNode.getDataHandler();
          FileOutputStream textOutStream = new FileOutputStream("c:\\th.txt");
          InputStream is = actualDH.getInputStream();
          textOutStream.write(IOUtils.getStreamAsByteArray(is));