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 anant khandekar <kh...@gmail.com> on 2007/01/15 15:34:03 UTC

Fwd: Attachment problem

Hi all,

i am trying to deploy a web service that accepts attachments. The method
exposed as web service is something like

*

public
**class* SubEcho {

*public* String echo(String [] msgs,String [] moreMsgs , DataHandler dh){

              System.
*out*.println("Message array 1's length : " +msgs.length);

*                       for*( *int* i=0 ;i<msgs. length;i++){

                              System.
*out*.println("Message from 1," +i+" : "+msgs[i]);

                       }

              System.
*out*.println("Message array 2's length : " +moreMsgs.length);

*                       for*( *int* i=0 ;i<moreMsgs. length;i++){

                              System.
*out*.println("Message from 2," +i+" : "+moreMsgs[i]);

                        }

              System.
*out*.println("Attachment received : "+ dh.getName ());

*              return* ("Echoed and Received");

}

And the client code is like .....
*

public
**class* TestClient_Attachment {

*public* *static* *void *main(String args1*[]){*

*try* {

*                    *RPCServiceClient serviceClient =
*new* RPCServiceClient();

*                    *Options options = serviceClient.getOptions();

*                    *EndpointReference targetEPR =
*new* EndpointReference*(* **
http://localhost:8080/axis2/services/EchoService);

 *                   *options.setTo(targetEPR);

*                    *options.setProperty(Constants.Configuration.
*ENABLE_MTOM*, Constants.* VALUE_TRUE*);

*                    *String a[] = {
"a","b", "c"};

 *                   *String b[] = {
"d","e", "f"};

*                    *DataHandler attachment1 =
*new* DataHandler(*new* FileDataSource("TestClient.java"));

 *                   *QName *opEcho* =
*new* QName(" http://service.echo.my/xsd", "echo");

*                    Object*[] *opEchoArgs* =
*new* Object[] { a,b,attachment1};

                    OMElement response = serviceClient.invokeBlocking(opEcho,
opEchoArgs);

}

   *catch* (AxisFault axisFault) {

                        axisFault.printStackTrace();

                      System.*out*.println(axisFault.getFaultCode());

   }

}

Runnig the client produces this exception stack trace at the server



SEVERE: Exception occurred while trying to invoke service method echo

org.apache.axis2.AxisFault: javax.activation.DataHandler; nested exception
is:

        java.lang.InstantiationException: javax.activation.DataHandler

        at org.apache.axis2.engine.DefaultObjectSupplier.getObject(
DefaultObjectSupplier.java:28)

        at org.apache.axis2.databinding.utils.BeanUtil.deserialize(
BeanUtil.java:261)

        at org.apache.axis2.databinding.utils.BeanUtil.processObject(
BeanUtil.java:549)

        at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(
BeanUtil.java:499)

        at org.apache.axis2.databinding.utils.BeanUtil.deserialize(
BeanUtil.java:442)

        at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(
RPCUtil.java:109)

        at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(
RPCMessageReceiver.java:116)

        at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(
AbstractInOutSyncMessageReceiver.java:39)

        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:493)

        at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
HTTPTransportUtils.java:319)

        at org.apache.axis2.transport.http.HTTPWorker.service(
HTTPWorker.java:230)

        at
org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor.doService
(DefaultHttpServiceProcessor.java:179

)

        at org.apache.http.protocol.HttpService.handleRequest(
HttpService.java:123)

        at
org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor.run(
DefaultHttpServiceProcessor.java:251)

        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:665)

        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:690)

        at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.InstantiationException: javax.activation.DataHandler

        at java.lang.Class.newInstance0(Class.java:335)

        at java.lang.Class.newInstance(Class.java:303)

        at org.apache.axis2.engine.DefaultObjectSupplier.getObject(
DefaultObjectSupplier.java:26)

        ... 16 more



What can be the reason behind this????

Is there any other way to send attachments (using an
RPCServiceClient....just as the one above)



Thanks,

Anant

Re: Attachment problem

Posted by Thilina Gunarathne <cs...@gmail.com>.
> D:\axis2-1.1.1\samples\soapwithattachments>ant run.client -Dfile
> README.txt -Ddest README.txt
Please provide the "-Ddest" an absolute path...

Eg: D:\axis2-1.1.1\samples\soapwithattachments>ant run.client -Dfile
README.txt -Ddest D:\README.txt
            ^^^^^^^^

~Thilina

>
>
> --
> Regards,
>
> On 1/16/07, anant khandekar <> wrote:
> > Hi,
> >
> > Putting a byte[] instead of A DataHandler works!!!!
> > But one more query.....
> > Is there any workaround for making overloading possible in axis2.
> >
> > thanks in advance,
> > anant
> >
> > ---------- Forwarded message ----------
> > From: Thilina Gunarathne <cs...@gmail.com>
> > Date: Jan 16, 2007 12:43 AM
> > Subject: Re: Attachment problem
> > To: axis-user@ws.apache.org
> >
> > AFAIK Axis2 still does not support the deployment of POJO based
> > services with dataHandler parameters..
> > Please try putting a byte[] instead of the data handler.
> >
> > >
> > > Is there any other way to send attachments (using an
> > > RPCServiceClient....just as the one above)
> > There are other ways such as using Axiom & databinding. Once again I'm
> > not sure whether the RPCServiceClient supports it..
> >
> > You can log couple of improvement JIRA's for the pojo & rpcClient
> > support for DataHandlers.
> >
> > Thanks,
> > Thilina
> >
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Anant
> >
> >
> > --
> > Thilina Gunarathne
> > WSO2, Inc.; http://www.wso2.com/
> > Home page: http://webservices.apache.org/~thilina/
> > Blog: http://thilinag.blogspot.com/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Regards,
> Alex
>


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

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


Fwd: Attachment problem

Posted by anant khandekar <kh...@gmail.com>.
Hi,

Putting a byte[] instead of A DataHandler works!!!!
But one more query.....
Is there any workaround for making overloading possible in axis2.

thanks in advance,
anant

---------- Forwarded message ----------
From: Thilina Gunarathne <cs...@gmail.com>
Date: Jan 16, 2007 12:43 AM
Subject: Re: Attachment problem
To: axis-user@ws.apache.org

AFAIK Axis2 still does not support the deployment of POJO based
services with dataHandler parameters..
Please try putting a byte[] instead of the data handler.

>
> Is there any other way to send attachments (using an
> RPCServiceClient....just as the one above)
There are other ways such as using Axiom & databinding. Once again I'm
not sure whether the RPCServiceClient supports it..

You can log couple of improvement JIRA's for the pojo & rpcClient
support for DataHandlers.

Thanks,
Thilina

>
>
>
> Thanks,
>
> Anant


--
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

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

Re: Attachment problem

Posted by Thilina Gunarathne <cs...@gmail.com>.
AFAIK Axis2 still does not support the deployment of POJO based
services with dataHandler parameters..
Please try putting a byte[] instead of the data handler.

>
> Is there any other way to send attachments (using an
> RPCServiceClient....just as the one above)
There are other ways such as using Axiom & databinding. Once again I'm
not sure whether the RPCServiceClient supports it..

You can log couple of improvement JIRA's for the pojo & rpcClient
support for DataHandlers.

Thanks,
Thilina

>
>
>
> Thanks,
>
> Anant


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

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