[Axis2] Exception occurred while trying to invoke service method

2007-02-19 Thread Kay*

Hello,
first of all, I apologize for my bad English...
I have a problem but I don't know  how I can resolve it.
This is code:

--
PrintOnVideo.java
--
package stampa.wservice;
import stampa.data.Ordinabile;

public class PrintOnVideo{

  public String print(Ordinabile o){
 System.out.println("E' stato ricevuto un oggetti di classe
"+o.getClass().getName());
 return (o.getClass().getName());
   }
}

--
Ordinabile.java
--
package stampa.data;
public interface Ordinabile
{
  public boolean maggioreDi(Ordinabile o);
}

---
PrintClient.java
---
package stampa.client;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

import stampa.data.Carte;


public class PrintClient {

   public static void main(String[] args1) throws AxisFault {

   RPCServiceClient serviceClient = new RPCServiceClient();

   Options options = serviceClient.getOptions();

   EndpointReference targetEPR = new EndpointReference("
http://localhost:8080/axis2/services/PrintOnVideo";);

   options.setTo(targetEPR);

   // Setting the weather
   QName opPrint = new QName("http://wservice.stampa/xsd";, "print");

   //setto l'oggetto
   Carte obj = new Carte("Re","Nero","Fiori");

   Object[] opPrintArgs = new Object[] { obj };
   Class[] returnTypes = new Class[] { String.class };

   Object[] risposta = serviceClient.invokeBlocking(opPrint,
opPrintArgs,returnTypes);
   String cclasse = (String) risposta[0];

   if (cclasse == null) {
   System.out.println("Weather didn't initialize!");
   return;
   }

   // Displaying the result
   System.out.println("La risposta e' stata "+cclasse);
   }
}

-
Carte.java
-
package stampa.data;

public class Carte implements Ordinabile{

 private String valore, colore, seme;

  public Carte(){
 valore=new String("Asso");
 colore=new String("Rosso");
 seme=new String("Cuori");
  }
  public Carte(String val, String col, String sm){
 this.valore=val;
 this.colore=col;
 this.seme=sm;
  }

  public boolean maggioreDi(Ordinabile o){
 if (o instanceof Carte){
Carte p=(Carte)o;
boolean ok= seme.equals(p.getSeme());
if ( ok ){
   int x= Integer.parseInt(valore);
   int ox= Integer.parseInt(p.getValore());
   return ( x>ox  );
}else{return false;}
 }else{return false;}
  }

  String getValore(){return valore;}
  String getColore(){return colore;}
  String getSeme(){return seme;}
}


When I run my client, I have this exception:

linux:~/TESI/PrintOnVideo/build/PrintOnVideo # java -
Djava.ext.dirs=/usr/local/axis2-1.1.1/lib/ stampa.client.PrintClient
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred
while trying to invoke service method print
   at org.apache.axis2.description.OutInAxisOperationClient.send(
OutInAxisOperation.java:271)
   at org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:202)
   at org.apache.axis2.client.ServiceClient.sendReceive (
ServiceClient.java:579)
   at org.apache.axis2.client.ServiceClient.sendReceive(
ServiceClient.java:508)
   at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(
RPCServiceClient.java:95)
   at stampa.client.PrintClient.main(Unknown Source)


I don't know what it means
How can I resolve my problem?
Thanks very much!!

Kay*


Re: [Axis2] Exception occurred while trying to invoke service method

2007-02-20 Thread Kay*

Michele, there are no spaces 

2007/2/19, Michele Mazzucco <[EMAIL PROTECTED]>:


Kay,
please try to remove the white space from the EPR.

Michele


On 19 Feb 2007, at 16:06, Kay* wrote:

Hello,
first of all, I apologize for my bad English...
I have a problem but I don't know  how I can resolve it.
This is code:

--
 PrintOnVideo.java
--
package stampa.wservice;
import stampa.data.Ordinabile;

public class PrintOnVideo{

   public String print(Ordinabile o){
  System.out.println("E' stato ricevuto un oggetti di classe
"+o.getClass().getName());
  return ( o.getClass().getName());
}
}

--
 Ordinabile.java
--
package stampa.data;
public interface Ordinabile
{
   public boolean maggioreDi(Ordinabile o);
}

---
 PrintClient.java
---
package stampa.client;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient ;

import stampa.data.Carte;


public class PrintClient {

public static void main(String[] args1) throws AxisFault {

RPCServiceClient serviceClient = new RPCServiceClient();

Options options = serviceClient.getOptions();

EndpointReference targetEPR = new EndpointReference("
http://localhost:8080/axis2/services/PrintOnVideo";);

options.setTo(targetEPR);

// Setting the weather
QName opPrint = new QName("http://wservice.stampa/xsd ", "print");

//setto l'oggetto
Carte obj = new Carte("Re","Nero","Fiori");

Object[] opPrintArgs = new Object[] { obj };
Class[] returnTypes = new Class[] { String.class };

Object[] risposta = serviceClient.invokeBlocking (opPrint,
opPrintArgs,returnTypes);
String cclasse = (String) risposta[0];

if (cclasse == null) {
System.out.println("Weather didn't initialize!");
return;
}

// Displaying the result
System.out.println("La risposta e' stata "+cclasse);
}
}

-
 Carte.java
-
package stampa.data;

public class Carte implements Ordinabile{

  private String valore, colore, seme;

   public Carte(){
  valore=new String("Asso");
  colore=new String("Rosso");
  seme=new String("Cuori");
   }
   public Carte(String val, String col, String sm){
  this.valore=val ;
  this.colore=col;
  this.seme=sm;
   }

   public boolean maggioreDi(Ordinabile o){
  if (o instanceof Carte){
 Carte p=(Carte)o;
 boolean ok= seme.equals(p.getSeme());
 if ( ok ){
int x= Integer.parseInt(valore);
int ox= Integer.parseInt (p.getValore());
return ( x>ox  );
 }else{return false;}
  }else{return false;}
   }

   String getValore(){return valore;}
   String getColore(){return colore;}
   String getSeme(){return seme;}
}


When I run my client, I have this exception:

linux:~/TESI/PrintOnVideo/build/PrintOnVideo # java -
Djava.ext.dirs=/usr/local/axis2-1.1.1/lib/ stampa.client.PrintClient
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred
while trying to invoke service method print
at org.apache.axis2.description.OutInAxisOperationClient.send(
OutInAxisOperation.java:271)
at org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:202)
at org.apache.axis2.client.ServiceClient.sendReceive (
ServiceClient.java:579)
at org.apache.axis2.client.ServiceClient.sendReceive(
ServiceClient.java:508)
at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(
RPCServiceClient.java:95)
at stampa.client.PrintClient.main(Unknown Source)


I don't know what it means
How can I resolve my problem?
Thanks very much!!

Kay*





Re: [Axis2] Exception occurred while trying to invoke service method

2007-02-20 Thread Kay*

Ah ... no, the spaces are not in my code,  only in my mail there is a
space...
I modified  my service with other method trying to understand what is the
problem, but some work and some not

package stampa.wservice;
import stampa.data.Ordinabile;

public class PrintOnVideo{

  Ordinabile m;
  public String print(Ordinabile o){
 m=o;
 //String r=new String(m.getClass().getName());
 String r=new String("Questa [ la mia stramaledetta classe ...");
 return (r);
   }
  public void setO(Ordinabile o){
   m=o;}
  public Ordinabile getO(){
   return m;
  }
  public String stampami(){
   return("Speriamo Speriamo Speriamo...");}
}


setO don't have exceptions, getO returns me a null object, stampami works
and print gives me this exception ...
Exception in thread "main" org.apache.axis2.AxisFault: Exception occurred
while trying to invoke service method print
   at org.apache.axis2.description.OutInAxisOperationClient.send(
OutInAxisOperation.java:271)
   at org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:202)
   at org.apache.axis2.client.ServiceClient.sendReceive(
ServiceClient.java:579)
   at org.apache.axis2.client.ServiceClient.sendReceive(
ServiceClient.java:508)
   at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(
RPCServiceClient.java:95)
   at stampa.client.PrintClient.main(PrintClient.java:73)
What can I do?
Please, can you help me?

Kay*

2007/2/20, Javier Kohen <[EMAIL PROTECTED]>:


El mar, 20-02-2007 a las 14:20 +0100, Kay* escribió:
> Michele, there are no spaces 

I'm sorry to intrude, but I do see the extra spaces Michele mentioned.

> 2007/2/19, Michele Mazzucco <[EMAIL PROTECTED]>:
> Kay,
>
>
> please try to remove the white space from the EPR.

>
> On 19 Feb 2007, at 16:06, Kay* wrote:

> > EndpointReference targetEPR = new
> > EndpointReference("
> > http://localhost:8080/axis2/services/PrintOnVideo";);
> >
> > options.setTo(targetEPR);

Check the line where EndpointReference is constructed in your code.
You'll see that there is an extra space between " and http:. You can
also see it in some of the previous posts in this thread.

Cheers,
--
Javier Kohen <[EMAIL PROTECTED]>
ICQ: blashyrkh #2361802
Jabber: [EMAIL PROTECTED]




setParam0(OMElement param) or xs:any

2007-02-26 Thread Kay*

Hello! (Sorry for my bad English...)
My problem is that my service is like this:


public Object[] compute(Object[]  data){
//...
}

and MyServiceStub.Compute has setParam0(org.apache.axiom.om.OMElement[]
param) and get_return returns an OMElement[]...
I don't know how to create an OMElement within Object[] ...and viceversa.

Please, can you help me ?

Thank you very much!!!

Kay*


Re: setParam0(OMElement param) or xs:any

2007-02-27 Thread Kay*

Thank you for your answer, but I don't understand  can you please do an
example?Do you mean that I have to change parameters ?
Thank you very very much!!!

Kay*

2007/2/27, Deepal Jayasinghe <[EMAIL PROTECTED]>:


Hi ;

When you have a method which take Object then there is no way to find
out the type of that object. That is why it generates WSDL with xsd:any.
To solve that U need to write the method to take the method with correct
Object type (String [] or what ever).

Thanks
Deepal

Kay* wrote:

> Hello! (Sorry for my bad English...)
> My problem is that my service is like this:
>
>
> public Object[] compute(Object[]  data){
>  //...
> }
>
> and MyServiceStub.Compute has setParam0(org.apache.axiom.om.OMElement
> [] param) and get_return returns an OMElement[]...
> I don't know how to create an OMElement within Object[] ...and
viceversa.
>
> Please, can you help me ?
>
> Thank you very much!!!
>
> Kay*


--
Thanks,
Deepal

"The highest tower is built one brick at a time"



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: setParam0(OMElement param) or xs:any

2007-02-28 Thread Kay*

I need to pass a variable number of different objs...
I also tried to pass a Vector of Integer (for an example) but axis2
doesn't know how resolve it and it gives me a xs:any ...
I tried also to pass one my class, called Vettore (with an array of
Object or a Vector) but when I generate the stub, it contains an its
Vettore, different from mine...
I can't explain better...
Thank you for your attention!

Kay*

2007/2/28, Deepal Jayasinghe <[EMAIL PROTECTED]>:

Hi ;

I am talking about smt like below;
public Address[] compute(Man []  data){
 //...
 }

Do not use just Object ,use the actual type you want to use.

Thanks
Deepal

Kay* wrote:

> Thank you for your answer, but I don't understand  can you please
> do an example?Do you mean that I have to change parameters ?
> Thank you very very much!!!
>
> Kay*
>
> 2007/2/27, Deepal Jayasinghe < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>:
>
> Hi ;
>
> When you have a method which take Object then there is no way to find
> out the type of that object. That is why it generates WSDL with
> xsd:any.
> To solve that U need to write the method to take the method with
> correct
> Object type (String [] or what ever).
>
> Thanks
> Deepal
>
> Kay* wrote:
>
> > Hello! (Sorry for my bad English...)
> > My problem is that my service is like this:
> >
> >
> > public Object[] compute(Object[]  data){
> >  //...
> > }
> >
> > and MyServiceStub.Compute has
> setParam0(org.apache.axiom.om.OMElement
> > [] param) and get_return returns an OMElement[]...
> > I don't know how to create an OMElement within Object[] ...and
> viceversa.
> >
> > Please, can you help me ?
> >
> > Thank you very much!!!
> >
> > Kay*
>
>
> --
> Thanks,
> Deepal
> 
> "The highest tower is built one brick at a time"
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
>
>
>

--
Thanks,
Deepal

"The highest tower is built one brick at a time"



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setParam0(OMElement param) or xs:any

2007-02-28 Thread Kay*

Thank you for your answer! I suppose that BeanUtil's method goes only
with javabean obj, but I'll try to apply to my project ! (sorry for my
English)
Thank you, thank you very much

Kay*

2007/2/28, Nilesh Ghorpade <[EMAIL PROTECTED]>:


Hi,

There is a utility tool in the AXIS 2 API's namely the BeanUtil I believe.
This class has some static methods which would enable you to convert from an
Object to an OMElement and vice versa.

Hope that helps.

Regards

Nilesh


- Original Message 
From: Kay* <[EMAIL PROTECTED]>
To: axis-user@ws.apache.org
Sent: Wednesday, February 28, 2007 7:27:53 PM
Subject: Re: setParam0(OMElement param) or xs:any


I need to pass a variable number of different objs...
I also tried to pass a Vector of Integer (for an example) but axis2
doesn't know how resolve it and it gives me a xs:any ...
I tried also to pass one my class, called Vettore (with an array of
Object or a Vector) but when I generate the stub, it contains an its
Vettore, different from mine...
I can't explain better...
Thank you for your attention!

Kay*

2007/2/28, Deepal Jayasinghe <[EMAIL PROTECTED]>:
> Hi ;
>
> I am talking about smt like below;
> public Address[] compute(Man []  data){
>  //...
>  }
>
> Do not use just Object ,use the actual type you want to use.
>
> Thanks
> Deepal
>
> Kay* wrote:
>
> > Thank you for your answer, but I don't understand  can you please
> > do an example?Do you mean that I have to change parameters ?
> > Thank you very very much!!!
> >
> > Kay*
> >
> > 2007/2/27, Deepal Jayasinghe < [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>>:
> >
> > Hi ;
> >
> > When you have a method which take Object then there is no way to
find
> > out the type of that object. That is why it generates WSDL with
> > xsd:any.
> > To solve that U need to write the method to take the method with
> > correct
> > Object type (String [] or what ever).
> >
> > Thanks
> > Deepal
> >
> > Kay* wrote:
> >
> > > Hello! (Sorry for my bad English...)
> > > My problem is that my service is like this:
> > >
> > >
> > > public Object[] compute(Object[]  data){
> > >  //...
> > > }
> > >
> > > and MyServiceStub.Compute has
> > setParam0(org.apache.axiom.om.OMElement
> > > [] param) and get_return returns an OMElement[]...
> > > I don't know how to create an OMElement within Object[] ...and
> > viceversa.
> > >
> > > Please, can you help me ?
> > >
> > > Thank you very much!!!
> > >
> > > Kay*
> >
> >
> > --
> > Thanks,
> > Deepal
> >

> > "The highest tower is built one brick at a time"
> >
> >
> >
> >
-
> > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
>

> "The highest tower is built one brick at a time"
>
>
>
>
-
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 
Looking for earth-friendly autos?
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setParam0(OMElement param) or xs:any

2007-03-07 Thread Kay*

I tried to use BeanUtil's method, but I had an error:

Exception in thread "main" java.lang.IllegalArgumentException: null rcl
   at org.codehaus.jam.internal.reflect.ReflectClassBuilder.(
ReflectClassBuilder.java:47)
   at org.codehaus.jam.provider.JamServiceFactoryImpl.createBuilder(
JamServiceFactoryImpl.java:173)
   at org.codehaus.jam.provider.JamServiceFactoryImpl.createClassLoader
(JamServiceFactoryImpl.java:137)
   at org.codehaus.jam.provider.JamServiceFactoryImpl.createService(
JamServiceFactoryImpl.java:78)
   at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(
BeanUtil.java:67)
   at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(
BeanUtil.java:225)
   at org.apache.ws.axis2.Client.main(Client.java:61)

The code is this:
...
OMElement[] param1=new OMElement[6];
   Integer [] ve=new Integer[6];
   ve[0]=(new Integer(12));
   ve[1]=(new Integer(23));
   ve[2]=(new Integer(34));
   ve[3]=(new Integer(45));
   ve[4]=(new Integer(56));
   ve[5]=(new Integer(67));

   for(int i=0;i<6;i++){
   XMLStreamReader reader = BeanUtil.getPullParser(ve[i]);
   StreamWrapper parser = new StreamWrapper(reader);
   StAXOMBuilder stAXMOMBuilder =
OMXMLBuilderFactory.createStAXOMBuilder (OMAbstractFactory.getOMFactory
(),parser);
   param1[i] = stAXMOMBuilder.getDocumentElement();
   }
   req2.setParam1(param1);

...
I suppose that the error is that, if I do

   Integer a = new Integer(55);
   ClassLoader cl = a.getClass().getClassLoader();

cl is null, and I don't know why!

Can you help me, please?

2007/2/28, Kay* <[EMAIL PROTECTED]>:


Thank you for your answer! I suppose that BeanUtil's method goes only
with javabean obj, but I'll try to apply to my project ! (sorry for my
English!!!!)
Thank you, thank you very much

Kay*

2007/2/28, Nilesh Ghorpade <[EMAIL PROTECTED]>:
>
> Hi,
>
> There is a utility tool in the AXIS 2 API's namely the BeanUtil I
believe.
> This class has some static methods which would enable you to convert
from an
> Object to an OMElement and vice versa.
>
> Hope that helps.
>
> Regards
>
> Nilesh
>
>
> - Original Message 
> From: Kay* <[EMAIL PROTECTED]>
> To: axis-user@ws.apache.org
> Sent: Wednesday, February 28, 2007 7:27:53 PM
> Subject: Re: setParam0(OMElement param) or xs:any
>
>
> I need to pass a variable number of different objs...
> I also tried to pass a Vector of Integer (for an example) but axis2
> doesn't know how resolve it and it gives me a xs:any ...
> I tried also to pass one my class, called Vettore (with an array of
> Object or a Vector) but when I generate the stub, it contains an its
> Vettore, different from mine...
> I can't explain better...
> Thank you for your attention!
>
> Kay*
>
> 2007/2/28, Deepal Jayasinghe <[EMAIL PROTECTED]>:
> > Hi ;
> >
> > I am talking about smt like below;
> > public Address[] compute(Man []  data){
> >  //...
> >  }
> >
> > Do not use just Object ,use the actual type you want to use.
> >
> > Thanks
> > Deepal
> >
> > Kay* wrote:
> >
> > > Thank you for your answer, but I don't understand  can you
please
> > > do an example?Do you mean that I have to change parameters ?
> > > Thank you very very much!!!
> > >
> > > Kay*
> > >
> > > 2007/2/27, Deepal Jayasinghe < [EMAIL PROTECTED]
> > > <mailto:[EMAIL PROTECTED]>>:
> > >
> > > Hi ;
> > >
> > > When you have a method which take Object then there is no way to
> find
> > > out the type of that object. That is why it generates WSDL with
> > > xsd:any.
> > > To solve that U need to write the method to take the method with
> > > correct
> > > Object type (String [] or what ever).
> > >
> > > Thanks
> > > Deepal
> > >
> > > Kay* wrote:
> > >
> > > > Hello! (Sorry for my bad English...)
> > > > My problem is that my service is like this:
> > > >
> > > >
> > > > public Object[] compute(Object[]  data){
> > > >  //...
> > > > }
> > > >
> > > > and MyServiceStub.Compute has
> > > setParam0(org.apache.axiom.om.OMElement
> > > > [] param) and get_return returns an OMElement[]...
> > > > I don't know how to create an OMElement within Object[] ...and
> > > viceversa.
> > > >
> > > > Please, can you help me ?
> > > >
> > > >