axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fady Kaddoum <fady.kadd...@steria.com>
Subject Re: using a generated Stub
Date Mon, 20 Sep 2004 07:33:35 GMT
Yep you are right,

It worked!

Thanks
Fady
  ----- Original Message ----- 
  From: Shahi, Ashutosh 
  To: axis-user@ws.apache.org 
  Cc: fady.kaddoum@steria.com 
  Sent: Saturday, September 18, 2004 11:57 AM
  Subject: RE: using a generated Stub


  Try using:

   DataHandler dataHandler = new DataHandler(dataSource);

  Instead of

  DataHandler dataHandler = new DataHandler(dataSource, "image/gif");

  It should work.

   

  The problem is you are using the constructor:

  DataHandler(java.lang.Object obj, java.lang.String mimeType)

  For datahandler. But it doesn't work if u already have a datasource with you, the Datahandler
doesn't recognize the DataSource and attempts to delegate operations to a DCH (Data Content
Handler) - which causes the datahandler to throw an exception  

   

  Regards,

  Ashutosh Shahi




------------------------------------------------------------------------------

  From: Fady Kaddoum [mailto:fady.kaddoum@steria.com] 
  Sent: Thursday, September 16, 2004 5:34 PM
  To: axis-user@ws.apache.org
  Subject: using a generated Stub

   

  Hi, I am trying to send an image as an attachment through a generated stub

   

  // ==== CODE =====
        gifsToAttach = new File[1];
        gifsToAttach[0] = new File("C:/SetVisning_2.gif");
        srvStub._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
                             Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
        if (gifsToAttach != null) {
          for (int i = 0; i < gifsToAttach.length; i++) {
            FileDataSource dataSource = new FileDataSource(gifsToAttach[0]);
            DataHandler dataHandler = new DataHandler(dataSource, "image/gif");
            srvStub.addAttachment(dataHandler);
          }
        }
  // ==============

   

  It gives me this exception:

   

  // ==== Exception =====

  javax.activation.UnsupportedDataTypeException: no object DCH for MIME type image/gif
   at javax.activation.DataHandler.getInputStream(DataHandler.java:240)
   at javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:668)
   at org.apache.axis.attachments.DimeBodyPart.getDataSize(DimeBodyPart.java:444)
   at org.apache.axis.attachments.DimeBodyPart.getDataSize(DimeBodyPart.java:419)
   at org.apache.axis.attachments.DimeBodyPart.getTransmissionSize(DimeBodyPart.java:394)
   at org.apache.axis.attachments.DimeMultiPart.getTransmissionSize(DimeMultiPart.java:57)
   at org.apache.axis.attachments.AttachmentsImpl.getContentLength(AttachmentsImpl.java:408)
   at org.apache.axis.Message.getContentLength(Message.java:508)
   at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:347)
   at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:87)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:144)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2688)
   at org.apache.axis.client.Call.invoke(Call.java:2671)
   at org.apache.axis.client.Call.invoke(Call.java:2357)
   at org.apache.axis.client.Call.invoke(Call.java:2280)
   at org.apache.axis.client.Call.invoke(Call.java:1741)
   at org.opcfoundation.webservices.XMLDA._1_0.ServiceStub.write(ServiceStub.java:681)
   at com.steria.m3.opc.XmlDaMgr.write(XmlDaMgr.java:551)
   at com.steria.m3.opc.XmlDaMgr.write(XmlDaMgr.java:497)
   at com.steria.m3.testitf.gui.FrameWrite.send(FrameWrite.java:296)
   at com.steria.m3.testitf.gui.FrameWrite.jButtonSend_actionPerformed(FrameWrite.java:247)
   at com.steria.m3.testitf.gui.FrameWrite_jButtonSend_actionAdapter.actionPerformed(FrameWrite.java:402)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
   at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
   at java.awt.Component.processMouseEvent(Component.java:5100)
   at java.awt.Component.processEvent(Component.java:4897)
   at java.awt.Container.processEvent(Container.java:1569)
   at java.awt.Component.dispatchEventImpl(Component.java:3615)
   at java.awt.Container.dispatchEventImpl(Container.java:1627)
   at java.awt.Component.dispatchEvent(Component.java:3477)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
   at java.awt.Container.dispatchEventImpl(Container.java:1613)
   at java.awt.Window.dispatchEventImpl(Window.java:1606)
   at java.awt.Component.dispatchEvent(Component.java:3477)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  ...

   

  Does anyone have any ideas?

   

  Thanks 

  Fady

Mime
View raw message