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 Peter <zc...@gmx.net> on 2007/01/03 17:43:20 UTC

large attachments in dime format

hi list,

i'm developing a webservice which should be able to handle multiple 
soap-attatchment within one request with a maximum size of 3MB per 
attachment.

sending and receiving attachments with a size smaller then 20kB in dime-format 
is no problem.

but when i try to send attachments with a size greater then 20kB i can not 
handle them. the files are stored in my attachment folder by via the 
sourcecode i can't find a possibility to get access to these files.

how can I get it to work ?
thanks

best regards peter

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


Re: large attachments in dime format

Posted by Martin Gainty <mg...@hotmail.com>.
//create the service
   Service service = new Service();
//create the call
   Call call = (Call) service.createCall();
//set ATTACHMENT_ENCAPSULATION_FORMAT to DIME
         call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
                                  call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);

  call.setTargetEndpointAddress(new URL(WEB_SERVICE_URL)); //Set the target service host and service location,
  
  call.setOperationName(new QName(WEB_SERVICE_NAME, operation)); //This is the target services method to invoke.
        
  QName qnameAttachment = new QName(WEB_SERVICE_NAME, "DataHandler");

        DataHandler dhSource = new DataHandler(new FileDataSource(INPUT_XML));
        
        call.registerTypeMapping(dhSource.getClass(), //Add serializer for attachment. 
                                 qnameAttachment,
                                 JAFDataHandlerSerializerFactory.class,
                                 JAFDataHandlerDeserializerFactory.class);

        call.addParameter("source", qnameAttachment, ParameterMode.IN); //Add the file.

        call.setReturnType(qnameAttachment);
        

        try {

         Object ret = call.invoke(new Object[]{dhSource}); //Add the attachment.
   
         log.info("ret : " + ret);
         if(ret == null) {
          log.info("null response received.");
         } else if(ret instanceof String) { 
          String errorMsg = (String)ret;
          log.info("errorMsg : " + errorMsg);
         } else  if(ret instanceof DataHandler) 
        {
              DataHandler dh = (DataHandler)ret;
              log.info("dh.getName() : " + dh.getName());
              byte[] responseBytes = Utils.getBytesFromDataHandler(dh);
              log.info("responseBytes length : " + responseBytes.length);
              String responseStr = new String(responseBytes, "UTF-8");
              log.info("responseStr : " + responseStr);
         }
        } catch(RemoteException  e) {
         log.error("AttachmentServiceException :" , e);
        }

--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message ----- 
From: "Peter" <zc...@gmx.net>
To: <ax...@ws.apache.org>
Sent: Wednesday, January 03, 2007 11:43 AM
Subject: large attachments in dime format


> hi list,
> 
> i'm developing a webservice which should be able to handle multiple 
> soap-attatchment within one request with a maximum size of 3MB per 
> attachment.
> 
> sending and receiving attachments with a size smaller then 20kB in dime-format 
> is no problem.
> 
> but when i try to send attachments with a size greater then 20kB i can not 
> handle them. the files are stored in my attachment folder by via the 
> sourcecode i can't find a possibility to get access to these files.
> 
> how can I get it to work ?
> thanks
> 
> best regards peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>