axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shalab Goel" <Shalab_G...@hyperion.com>
Subject RE: [Axis2] Streaming dynamically generated large sized content
Date Tue, 26 Jun 2007 21:05:44 GMT
Hi Dims,

Thank you much for your response and the pointers. I understand your
reservation against use of Piped[In/Out]Stream, and I will explore
making appropriate change. But should this work? The SOAP response that
is coming back from server has SOAP fault in it:

<faultcode>soapenv:Client</faultcode>
<faultstring>Error while writing to the OutputStream.</faultstring>
<detail />



Full SOAP Response:


HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761;
type="text/xml";
start="<0.urn:uuid:DFCA23517587D8F2141182450081762@apache.org>";charset=
UTF-8Transfer-Encoding: chunkedDate: Thu, 21 Jun 2007 18:21:21
GMT29a--MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761Content-Type
: text/xml; charset=UTF-8Content-Transfer-Encoding: 8bitContent-ID: 

   <0.urn:uuid:DFCA23517587D8F2141182450081762@apache.org>

      <?xml version='1.0' encoding='UTF-8'?>

         <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

            <soapenv:Body>

               <ns:echoStringResponse
xmlns:ns="http://service.soapwithattachments.sample/xsd">

                  <ns:return>

                     <swa:echoStringResponse
xmlns:swa="http://service.soapwithattachments.sample/xsd">

                        <swa:attchmentID
href="cid:urn:uuid:DFCA23517587D8F2141182450081744" />

                     </swa:echoStringResponse>

                  </ns:return>

               </ns:echoStringResponse>

            </soapenv:Body>

         </soapenv:Envelope>

38

 

--MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761

1fa

--MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450082013

Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: 8bit

Content-ID: 

         <0.urn:uuid:DFCA23517587D8F2141182450082014@apache.org>

            <?xml version='1.0' encoding='UTF-8'?>

               <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

                  <soapenv:Body>

                     <soapenv:Fault>

                        <faultcode>soapenv:Client</faultcode>

                        <faultstring>Error while writing to the
OutputStream.</faultstring>

                        <detail />

                     </soapenv:Fault>

                  </soapenv:Body>

               </soapenv:Envelope>

38

 

--MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450082013

2

--

0



-----Original Message-----
From: Davanum Srinivas [mailto:davanum@gmail.com] 
Sent: Monday, June 25, 2007 6:37 PM
To: axis-user@ws.apache.org
Subject: Re: [Axis2] Streaming dynamically generated large sized content

Shalab,

Firstly, check the API usage for the attachment streams here:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/mod
ules/axiom-tests/src/test/java/org/apache/axiom/attachments/IncomingAtta
chmentInputTest.java

You actually have to read the bytes before getting the next stream.

Second, i don't recommend using the PipedOutputStream/PipedInputStream
the way you have set it up. You will end up consuming huge memory and
will not be able to handle many connections. Please come up with a
concrete implementation of javax.activation.DataSource and use that to
create your DataHandler. The DataSource implkementation can have a
dynamically generated input stream. A quick google search brought up
this sample.

http://xqzone.marklogic.com/pubs/3.2/javadoc/com/marklogic/xcc/examples/
doc-files/DynamicContentStream.java.txt

Thanks,
dims

On 6/25/07, Shalab Goel <Shalab_Goel@hyperion.com> wrote:
>
>
>
>
>
>
> Resending my query on sending dynamically generated content as a
stream in
> SOAP attachment, hoping it will catch an eye that can comment on
whether
> this is expected to work in Axis, and if not, if there are there
suggestions
> on trying something alternate.
>
>
>
> Thanks
>
> Shalab
>
>  ________________________________
>
>
> From: Shalab Goel
>  Sent: Thursday, June 21, 2007 11:54 AM
>  To: axis-user@ws.apache.org
>  Subject: [Axis2] Streaming dynamically generated large sized content
>
>
>
> Hello Everyone,
>
>
>
> I am looking for some assistance with streaming large sized
dynamically
> generated content.
>
>
>
> I have defined an 'echoString' operation, which takes two request
arguments
> a string to repeat, and count of number of times to repeat. This is a
> service which replicates somewhat the requirement I am working on - to
be
> able to stream dynamically generated content (size in order of 50 to
200
> MBs).
>
>
>
>             public OMElement echoString (String echo, String count)
throws
> Exception
>
>             {
>
>                         PipedInputStream inStream = new
PipedInputStream();
>
>                         PipedOutputStream outStream = new
> PipedOutputStream(inStream);
>
>
>
>                         DataHandler dh = new DataHandler(inStream,
> "text/plain");
>
>
>
>                         MessageContext inCtx =
> MessageContext.getCurrentMessageContext();
>
>                        OperationContext operationContext =
> inCtx.getOperationContext();
>
>                        MessageContext outCtx = operationContext
>
>
> .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>
>
>
>                         String attachmentID =
outCtx.addAttachment(dh);
>
>
>
>                         OMFactory fac =
OMAbstractFactory.getOMFactory();
>
>                         OMNamespace omNs = fac.createOMNamespace(
>
>
> "http://service.soapwithattachments.sample/xsd", "swa");
>
>                         OMElement echoStringOp =
> fac.createOMElement("echoStringResponse", omNs);
>
>                         OMElement idEle =
fac.createOMElement("attchmentID",
> omNs);
>
>                         idEle.addAttribute("href",
> "cid:"+attachmentID,null);
>
>                         echoStringOp.addChild(idEle);
>
>
>
>                         byte bytes[] = strArg.getBytes();
>
>                         try
>
>                         {
>
>                               for (int i=0; i < cntArg; i++)
>
>
> outStream.write(bytes);
>
>                               outStream.flush();
>
>                               outStream.close();
>
>                         }
>
>                         catch (Exception e) {};
>
>
>
>                         return echoStringOp;
>
>             }
>
>
>
> In the services.xml, I have added parameter for enabling SWA
>
>
>
>          <parameter name="enableSwA">true</parameter>
>
>
>
>
>
> When I run my client code, I get the following exception trace:
>
>
>
> contentID
> <0.urn:uuid:DFCA23517587D8F2141182450082014@apache.org>
>
> Exception in thread "main" java.io.IOException: eosBeforeMarker
>
>       at
>
org.apache.axiom.attachments.BoundaryDelimitedStream.read(BoundaryDelimi
tedStream.java:300)
>
>       at
>
org.apache.axiom.attachments.IncomingAttachmentInputStream.read(Incoming
AttachmentInputStream.java:121)
>
>       at
>
sample.soapwithattachments.client.SWAClient.callEchoManyTimes(SWAClient.
java:212)
>
>       at
> sample.soapwithattachments.client.SWAClient.main(SWAClient.java:59)
>
>
>
>
>
> Following is how the attachment is being accessed in client code:
>
>
>
>                         MessageContext response = mepClient
>
>
> .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
>                         Attachments attachments =
> response.getAttachmentMap();
>
>                         IncomingAttachmentStreams streams =
> attachments.getIncomingAttachmentStreams();
>
>                         IncomingAttachmentInputStream inStream = null;
>
>                         if (streams != null)
>
>                         {
>
>                                     inStream =
streams.getNextStream();
>
>                                     System.out.println("contentID " +
> inStream.getContentId());
>
>                         }
>
>
>
> Following is the SOAP request (in TCPMonitor):
>
> ---------------------------------------------------------------------
>
>
>
>
> POST /axis2/services/SWASampleService HTTP/1.1
>
> Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_C2F2DEF18072BF88741182450074533;
> type="text/xml";
> start="<0.urn:uuid:C2F2DEF18072BF88741182450074534@apache.org>";
> charset=UTF-8
>
> SOAPAction: "urn:echoString"
>
> User-Agent: Axis2
>
> Host: 127.0.0.1:8081
>
> Transfer-Encoding: chunked
>
>
>
> 231
>
> --MIMEBoundaryurn_uuid_C2F2DEF18072BF88741182450074533
>
> Content-Type: text/xml; charset=UTF-8
>
> Content-Transfer-Encoding: 8bit
>
> Content-ID:
> <0.urn:uuid:C2F2DEF18072BF88741182450074534@apache.org>
>
>    <?xml version='1.0' encoding='UTF-8'?>
>
>       <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>
>          <soapenv:Body>
>
>             <swa:echoString
> xmlns:swa="http://service.soapwithattachments.sample/xsd">
>
>                <swa:echo>howdy</swa:echo>
>
>                <swa:count>45</swa:count>
>
>             </swa:echoString>
>
>          </soapenv:Body>
>
>
>
</soapenv:Envelope>--MIMEBoundaryurn_uuid_C2F2DEF18072BF8874118245007453
3-0
>
>
>
>
>
> Following is the SOAP response (showing Fault)
>
> ----------------------------------------------------------------------
>
>
>
>
> HTTP/1.1 200 OK
>
> Server: Apache-Coyote/1.1
>
> Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761;
> type="text/xml";
>
start="<0.urn:uuid:DFCA23517587D8F2141182450081762@apache.org>";charset=
UTF-8Transfer-Encoding:
> chunkedDate: Thu, 21 Jun 2007 18:21:21
>
GMT29a--MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761Content-Type
:
> text/xml; charset=UTF-8Content-Transfer-Encoding:
> 8bitContent-ID:
>
>    <0.urn:uuid:DFCA23517587D8F2141182450081762@apache.org>
>
>       <?xml version='1.0' encoding='UTF-8'?>
>
>          <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>
>             <soapenv:Body>
>
>                <ns:echoStringResponse
> xmlns:ns="http://service.soapwithattachments.sample/xsd">
>
>                   <ns:return>
>
>                      <swa:echoStringResponse
> xmlns:swa="http://service.soapwithattachments.sample/xsd">
>
>                         <swa:attchmentID
> href="cid:urn:uuid:DFCA23517587D8F2141182450081744" />
>
>                      </swa:echoStringResponse>
>
>                   </ns:return>
>
>                </ns:echoStringResponse>
>
>             </soapenv:Body>
>
>          </soapenv:Envelope>
>
> 38
>
>
>
> --MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450081761
>
> 1fa
>
> --MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450082013
>
> Content-Type: text/xml; charset=UTF-8
>
> Content-Transfer-Encoding: 8bit
>
> Content-ID:
>
>
> <0.urn:uuid:DFCA23517587D8F2141182450082014@apache.org>
>
>             <?xml version='1.0' encoding='UTF-8'?>
>
>                <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>
>                   <soapenv:Body>
>
>                      <soapenv:Fault>
>
>
> <faultcode>soapenv:Client</faultcode>
>
>                         <faultstring>Error while writing to the
> OutputStream.</faultstring>
>
>                         <detail />
>
>                      </soapenv:Fault>
>
>                   </soapenv:Body>
>
>                </soapenv:Envelope>
>
> 38
>
>
>
> --MIMEBoundaryurn_uuid_DFCA23517587D8F2141182450082013
>
> 2
>
> --
>
> 0
>
>
>
>
>
>
>
>
>
>
>
>  ________________________________
>
>
> From: Shalab Goel
>  Sent: Wednesday, June 20, 2007 1:59 PM
>  To: 'axis-user@ws.apache.org'
>  Subject: Sample application demo-ing attachments functionality
>
>
>
> Hello,
>
>
>
> Thanks in advance if this already is available and you can point to
the
> proper location.
>
>
>
> I am looking for a sample web service that would take a file path on
server
> as request, and respond with contents of the file as a SOAP
attachment. Any
> pointers on anything similar will be appreciated.
>
>
>
> Is streaming of the file contents possible, as the file in my case is
> expected to be plus 100 MB potentially?
>
>
>
> In the samples/userguide directory of the distribution, I see a little
> different variation, where client sends the file contents in
attachment, and
> web service consumes it.
>
>
>
>
>  If you have received this e-mail in error, please delete it and
notify the
> sender as soon as possible. The contents of this e-mail may be
confidential
> and the unauthorized use, copying, or dissemination of it and any
> attachments to it, is prohibited. Internet communications are not
secure and
> Hyperion does not, therefore, accept legal responsibility for the
contents
> of this message nor for any damage caused by viruses. The views
expressed
> here do not necessarily represent those of Hyperion. For more
information
> about Hyperion, please visit our Web site at: www.hyperion.com


-- 
Davanum Srinivas :: http://davanum.wordpress.com

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



If you have received this e-mail in error, please delete it and notify the sender as soon
as possible. The contents of this e-mail may be confidential and the unauthorized use, copying,
or dissemination of it and any attachments to it, is prohibited. Internet communications are
not secure and Hyperion does not, therefore, accept legal responsibility for the contents
of this message nor for any damage caused by viruses. The views expressed here do not necessarily
represent those of Hyperion. For more information about Hyperion, please visit our Web site
at: www.hyperion.com



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


Mime
View raw message