Re: SOAP Attachment from RPC Service Question

Martin Cavanagh <[email protected]> Thu, 09 Mar 2006 17:54:22 +0100
Newsgroups gmane.text.xml.soap.user
Message-ID <[email protected]>
My quick answer is:
Soap 2.3.1 is rather old - never the less I am still using it.

I personally have speed issues under java 1.5 - so i would suggest 
starting with Java 1.4 - if you do use Java 1.5 I'd love to hear your 
experiences - I'd love to move to java 1.5.....

Under either SOAP 2.3.1 or 2.3.0 there was an option zip - 
SOAPContext.setGzip(boolean)

I know thats probably not much help - but maybe....

Please let me know how that works out for you?

Martin

Jingjiu Wang wrote:

>Hi All,
>
>I am using Apache SOAP 2_3_1 on Tomcat 4.1.27.
>
>I have a RPC service at http://hostip:port/soap/servlet/rpcrouter that
>sends back a response upon receiving a request.  I build a very large
>XML (100Mb or more) in the response and the performance was bad, so I
>thought I will use SOAP with Attachment and just put the XML file into
>the attachment.  I have some questions on how to accomplish this:
>
>1) In the SOAP Service code, what should I return?
>
>Suppose the following is my code for the SOAP Service:
>
>public class MySoapService {
>    public DataHandler MyServiceMethod(Element request) {
>	 	DataHandler dh = null;
>
>		try {
>			//use the request parameter to generate the
>output XML ...
>
>			ByteArrayOutputStream baos = new
>ByteArrayOutputStream();
>
>			//baos contains the output XML ...
>
>         		DataSource ds = new ByteArrayDataSource(new
>ByteArrayInputStream(baos.toByteArray()), null);
>        		dh = new DataHandler(ds);
>		}
>		catch (Exception e) {
>			e.printStackTrace();
>		}
>		finally {
>			return dh;
>		}
>	}
>}
>
>I read in a post in the archive that for RPC service, the service method
>should return a DataHandler and it will be sent to the client as an
>attachment.  Is this correct??
>
>2) In the Deployment Descriptor on the server, do I need to add a
><isd:mappings> node to specify what serializer/deserializer I need to
>use?  If I use the above code and a Deployment Descriptor with no
><isd:mappings> node, I got an error "java.lang.IllegalArgumentException:
>I only know how to serialize an 'org.w3c.dom.Element'."  Could someone
>shed some light on the configuration of the Deployment Descriptor in
>this case?
>
>3) If you could provide some example codes on how to implement RPC
>service responding with attachment, it would be most helpful.
>
>Thanks for you help!
>
>JW
>
>
>  
>