axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michele Amoretti" <michele.amore...@unipr.it>
Subject Re: using MTOM in a AXIOM-based WS
Date Fri, 20 Apr 2007 08:02:45 GMT
No, I tried this but the problem persists: only 24KB of the file are
transferred from the service to the client. :(

Michele

On 4/19/07, Masin, Valerie <VJMasin@docharbor.com> wrote:
>
> A colleague had this problem (when using Sun's webserver) and fixed it by
> setting this on the client.
>             stub._getServiceClient().getOptions().setProperty(
>                                 HTTPConstants.CHUNKED,
> Constants.VALUE_FALSE);
>
> I don't know if there is a way to say the same thing from the server, or
> if it is even necessary. The reason had something to do with whether the
> length was being passed. Sorry I am vague but this didn't happen directly to
> me so I don't know the exact particulars.
>
> -----Original Message-----
> From: michele.amoretti@gmail.com [mailto:michele.amoretti@gmail.com] On
> Behalf Of Michele Amoretti
> Sent: Thursday, April 19, 2007 8:50 AM
> To: axis-user@ws.apache.org
> Subject: Re: using MTOM in a AXIOM-based WS
>
> Ok, it is setProperty()
>
> Now I managed to transfer a file from the service to the client, but if I
> try to transfer a file > 23963 Bytes, the file is cut.
>
> Should I make some adjustments in axis2.xml, or in Tomcat configuration?
>
> I tried to enable caching both at the server side and at the client side,
> as explained in the tutorial:
>            options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS,
> Constants.VALUE_TRUE);
> options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,
> "C://axisTemp");
> options.setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD, "40000");
>
> but with these lines, the client blocks immediately when trying to invoke
> any operation of the service (not only the one involving the file
> transfer..).
>
> Any idea?
>
> Thanks
>
>
> On 4/18/07, Masin, Valerie <VJMasin@docharbor.com> wrote:
> > I believe it is setProperty(), not set() on the options object
> >
> > -----Original Message-----
> > From: Michele Amoretti [mailto:michele.amoretti@gmail.com]
> > Sent: Wednesday, April 18, 2007 1:24 PM
> > To: axis-user@ws.apache.org
> > Subject: using MTOM in a AXIOM-based WS
> >
> > Hello,
> >
> > I am trying to create a new version of the "quickstartaxiom" sample,
> with the StockQuoteService providing a getPriceFile operation which returns
> a file using MTOM.
> >
> > In the MTOM tutorial unfortunately there are only parts of code (I
> cannot find a complete example in axis2-1.1.1 - the mtom sample is not
> based on AXIOM) thus I had to write the other parts, but since I have some
> problems in invoking the service I think I have made a mistake somewhere.
> >
> >
> > My new ***AXIOMClient*** should set
> >
> > options.set(Constants.Configuration.ENABLE_MTOM,
> > Constants.VALUE_TRUE);
> >
> > as explained in the tutorial, but the Options class has no "set"
> > method and I cannot find the right one..
> >
> > Btw, I added to the client the following method:
> >
> >    public static OMElement getPriceFilePayload(String priceFileName) {
> >         OMFactory fac = OMAbstractFactory.getOMFactory();
> >         OMNamespace omNs = fac.createOMNamespace(
> >
> > "http://quickstart.samples/xsd", "tns");
> >
> >         OMElement method = fac.createOMElement("getPriceFile", omNs);
> >         OMElement value = fac.createOMElement("priceFileName", omNs);
> >         value.addChild(fac.createOMText(value, priceFileName));
> >         method.addChild(value);
> >         return method;
> >     }
> >
> > and in the main() method of the client I added the following part, for
> getFilePrice invocation:
> >
> >             OMElement getPriceFilePayload = getPriceFilePayload("
> prova.txt"); .......
> >             result = sender.sendReceive(getPriceFilePayload);
> >             OMElement ele = result.getFirstElement();
> >             OMText binaryNode = (OMText) ele.getFirstOMChild();
> >             DataHandler actualDH = (DataHandler)
> binaryNode.getDataHandler();
> >             File file = new File("prova.txt");
> >             FileOutputStream fileOutputStream = new
> FileOutputStream(file);
> >             actualDH.writeTo(fileOutputStream);
> >             fileOutputStream.flush();
> >             fileOutputStream.close();
> >
> >
> >
> > In the ***StockQuoteService*** the getPriceFile method is implemented as
> follows:
> >
> >
> >  public OMElement getPriceFile(OMElement element) throws
> XMLStreamException {
> >         element.build();
> >         element.detach();
> >
> >         OMElement fileNameElement = element.getFirstElement();
> >         String fileName = fileNameElement.getText();
> >
> >         System.out.println("fileName = " + fileName);
> >
> >         OMFactory fac = OMAbstractFactory.getOMFactory();
> >         OMNamespace omNs =
> >             fac.createOMNamespace("http://quickstart.samples/xsd",
> "ns");
> >         OMElement fileElement = fac.createOMElement("file", omNs);
> >
> >         FileDataSource dataSource =
> >                 new FileDataSource(fileName);
> >
> >         DataHandler dataHandler = new DataHandler(dataSource);
> >
> >         // create an OMText node with the above DataHandler and set
> optimized to true
> >         OMText textData = fac.createOMText(dataHandler, true);
> >
> >         fileElement.addChild(textData);
> >
> >         OMElement method = fac.createOMElement("getPriceFileResponse",
> omNs);
> >         OMElement value = fac.createOMElement("priceFile", omNs);
> >         value.addChild(textData);
> >         method.addChild(value);
> >
> >         return method;
> >     }
> >
> >
> > Is this ok? Where should I store the "prova.txt" file in the server?
> > In the same folder in which I put the *.aar file?
> >
> > I attach to this mail the wsdl of the service, and the configuration
> file.
> >
> >
> > I am using Tomcat as servlet engine, and the logs are clean at the
> server side.
> >
> > At the client side the error message is:
> >
> >     [java] org.apache.axiom.om.OMException: Referenced Attachment not
> found in the MIME Message.
> > ContentID:1.urn:uuid:4728BD2692F0E9BDC21176912489723@apache.org
> >      [java] at
> org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder.getDataHandler
> (MTOMStAXSOAPModelBuilder.java:107)
> >      [java] at org.apache.axiom.om.impl.llom.OMTextImpl.getDataHandler(
> OMTextImpl.java:379)
> >      [java] at samples.quickstart.clients.AXIOMClient.main(
> AXIOMClient.java:105)
> >      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >      [java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> >      [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> >      [java] at java.lang.reflect.Method.invoke(Unknown Source)
> >      [java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(
> ExecuteJava.java:202)
> >      [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(
> ExecuteJava.java:134)
> >      [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:710)
> >      [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java
> :178)
> >      [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
> >      [java] at org.apache.tools.ant.UnknownElement.execute(
> UnknownElement.java:275)
> >      [java] at org.apache.tools.ant.Task.perform(Task.java:364)
> >      [java] at org.apache.tools.ant.Target.execute(Target.java:341)
> >      [java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
> >      [java] at org.apache.tools.ant.Project.executeSortedTargets(
> Project.java:1216)
> >      [java] at org.apache.tools.ant.Project.executeTarget(Project.java
> :1185)
> >      [java] at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(
> DefaultExecutor.java:40)
> >      [java] at
> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets
> (EclipseDefaultExecutor.java:32)
> >      [java] at org.apache.tools.ant.Project.executeTargets(Project.java
> :1068)
> >      [java] at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(
> InternalAntRunner.java:423)
> >      [java] at
> > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(Internal
> > AntRunner.java:137)
> >
> >
> > Thank you very much!
> >
> > --
> > Michele Amoretti, Ph.D.
> > Distributed Systems Group
> > Dipartimento di Ingegneria dell'Informazione Università degli Studi di
> > Parma http://www.ce.unipr.it/amoretti
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Michele Amoretti, Ph.D.
> Distributed Systems Group
> Dipartimento di Ingegneria dell'Informazione Università degli Studi di
> Parma http://www.ce.unipr.it/amoretti
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Michele Amoretti, Ph.D.
Distributed Systems Group
Dipartimento di Ingegneria dell'Informazione
Università degli Studi di Parma
http://www.ce.unipr.it/amoretti

Mime
View raw message