users@jax-rpc.java.net

Re: Using DataHandler as return value from a method

From: Martin Marinschek <generalquestions_at_hotmail.com>
Date: Wed, 27 Oct 2004 14:20:59 +0200

Hi Vishal,

this is my command-line (I am starting from Idea):

C:\java\j2sdk1.4.2_04\bin\java -Didea.launcher.port=7532
-Didea.launcher.library=C:\java\IntelliJ\bin\breakgen.dll
-Dfile.encoding=windows-1252 -classpath
C:\java\j2sdk1.4.2_04\jre\lib\charsets.jar;C:\java\j2sdk1.4.2_04\jre\lib\jce.jar;C:\java\j2sdk1.4.2_04\jre\lib\jsse.jar;C:\java\j2sdk1.4.2_04\jre\lib\plugin.jar;C:\java\j2sdk1.4.2_04\jre\lib\rt.jar;C:\java\j2sdk1.4.2_04\jre\lib\sunrsasign.jar;C:\java\j2sdk1.4.2_04\jre\lib\ext\dnsns.jar;C:\java\j2sdk1.4.2_04\jre\lib\ext\ldapsec.jar;C:\java\j2sdk1.4.2_04\jre\lib\ext\localedata.jar;C:\java\j2sdk1.4.2_04\jre\lib\ext\sunjce_provider.jar;C:\java\IdeaProjects\roncalli\webservice-client\classes;C:\java\IdeaProjects\roncalli\webservice-client\lib\saaj-impl.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\namespace.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jta-spec1_0_1.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\activation.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\xercesImpl.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jaxp-api.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\commons-beanutils.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\xsdlib.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jaas.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jaxrpc-impl.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\xalan.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\relaxngDatatype.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\mail.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jaxrpc-api.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\commons-logging.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\saaj-api.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jax-qname.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\jaxrpc-spi.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\dom.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\commons-digester.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\commons-collections.jar;C:\java\IdeaProjects\roncalli\webservice-client\lib\sax.jar;C:\java\IntelliJ\lib\idea_rt.jar
com.intellij.rt.execution.application.AppMain
at.oekb.clearinghouse.webservices.client.content.DemoClient

and I use the jwsdp1.4 files...

Would it work for you with say a 170MB file as well?

What I would need to know is if jax-rpc principally scales to any sizes
of documents if streams are used or if some restriction is built in as
the message is at some point of time put into a byte-array or something
like that?

regards,

Martin


Vishal Mahajan wrote:

> Hi Martin,
>
> I tried reproducing the problem you've reported. I wrote a small test
> which tries to internalize a soap message containing a (~)17 MB XML
> attachment, gets the DataHandler on the attachment, and finally prints
> the data as you are trying to do in your client code. The test passed
> with JDK 1.4.2_04 as well as with JDK 5.0. Can you please provide more
> information about your environment.
>
> Thanks,
>
> Vishal
>
> Martin Marinschek wrote:
>
>> Hi,
>>
>> would there be no one interested in problems with large attachments?
>> Are webservices really only useful for small junks of data?
>>
>> regards,
>>
>> Martin
>>
>> >> My original message
>>
>> Hi there,
>>
>> I am using JAX-RPC, and compile my WSDL from the following interface:
>>
>> public interface ContentServer extends Remote
>> {
>> public DataHandler downloadContent(String userName, String passWord,
>> long id)
>> throws RemoteException;
>> }
>>
>> Now I am filling the return value with the code in the respective
>> Impl-class (code of the impl-class can be found further below).
>>
>> Finally, I compile client stubs for the code and run a small client
>> against those stubs - printing out the retrieved values:
>>
>> public class DemoClient
>> {
>> public static void main (String args[])
>> throws Exception
>> {
>> ContentServer_Service_Impl service =
>> new ContentServer_Service_Impl();
>> ContentServer_PortType stub = service.getContentServerPort();
>>
>> DataHandler handler = stub.downloadContent("exmam","xxx",45);
>>
>> BufferedReader instr = new BufferedReader(
>> new InputStreamReader(handler.getInputStream()));
>>
>> String str=null;
>>
>> while((str = instr.readLine())!=null)
>> System.out.println(str);
>>
>> System.out.println("success");
>>
>> }
>> }
>>
>> This works fine if the file is a rather small one (let's say up to a
>> megabyte), with larger files (I tried a 16MB file) I inevitably run
>> into the following exception, even though my memory should easily be
>> able to cope with the size of the file and I am using only stream-based
>> access....
>>
>> Are there any restrictions on how large an attached file can grow in
>> using the JAX-RPC Datahandler mapping?
>>
>> regards,
>>
>> Martin
>>
>> java.lang.OutOfMemoryError
>> 04.10.2004 13:10:55 com.sun.xml.messaging.saaj.soap.MessageImpl <init>
>> SCHWERWIEGEND: SAAJ0535: Unable to internalize message
>> java.rmi.RemoteException: HTTP transport error:
>> com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize
>> message; nested exception is:
>> HTTP transport error: com.sun.xml.messaging.saaj.SOAPExceptionImpl:
>> Unable to internalize message
>> at
>> at.oekb.clearinghouse.webservices.client.content.ContentServer_PortType_Stub.downloadContent(ContentServer_PortType_Stub.java:89)
>>
>> at
>> at.oekb.clearinghouse.webservices.client.content.DemoClient.main(DemoClient.java:27)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:324)
>> at
>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
>> Caused by: HTTP transport error:
>> com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize
>> message
>> at
>> com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:140)
>>
>> at
>> com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:92)
>> at
>> at.oekb.clearinghouse.webservices.client.content.ContentServer_PortType_Stub.downloadContent(ContentServer_PortType_Stub.java:72)
>>
>> ... 6 more
>> Exception in thread "main"
>>
>> public class ContentServerImpl implements ContentServer
>> {
>> public DataHandler downloadContent(String userName, String passWord,
>> long id)
>> {
>>
>> String dsName1 = "jdbc/roncalli_dev"; // JNDI name
>> javax.sql.DataSource ds1 = null;
>> Connection conn = null;
>>
>> try
>> {
>> Context ic = new InitialContext();
>> Context ctx = (Context) ic.lookup("java:comp/env");
>> ds1 = (javax.sql.DataSource)ctx.lookup(dsName1); //
>> Problem here
>> conn = ds1.getConnection();
>>
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>>
>> InputStream dataStream =
>> XMLLoader.getAsAsciiStream(conn,"contents","id","data",id);
>> StreamDataSource src = new StreamDataSource();
>> src.setInputStream(dataStream);
>> src.setName("content.xml");
>>
>> DataHandler handler = new DataHandler(src);
>>
>> return handler;
>> }
>>
>> public static class StreamDataSource implements DataSource
>> {
>> private InputStream _inputStream;
>> private OutputStream _outputStream;
>> private String _name;
>> private String _contentType = "text/xml";
>>
>> public void setInputStream(InputStream inputStream)
>> {
>> _inputStream = inputStream;
>> }
>>
>> public void setName(String name)
>> {
>> _name = name;
>> }
>>
>> public void setOutputStream(OutputStream outputStream)
>> {
>> _outputStream = outputStream;
>> }
>>
>> public InputStream getInputStream() throws IOException
>> {
>> return _inputStream;
>> }
>>
>> public OutputStream getOutputStream() throws IOException
>> {
>> return _outputStream;
>> }
>>
>> public String getContentType()
>> {
>> return _contentType;
>> }
>>
>> public String getName()
>> {
>> return _name;
>> }
>>
>> public void setContentType(String contentType)
>> {
>> _contentType = contentType;
>> }
>> }
>> }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
> .
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net