[jboss-user] [JBossWS] - Newbie Question: WebService & Object Parameter

FabBoco do-not-reply at jboss.com
Sat Jun 2 11:39:56 EDT 2007


Hi

I have a very simple web service


  | 
  | public interface MyWebService
  | {
  | 	public String sayHello(String to);
  | 	public Long add(MyClass e1);
  | }
  | 
  | @Stateless
  | @WebService(name="MyService", serviceName="MyService")
  | @Remote(MyWebService.class)
  | @RemoteBinding
  | @SOAPBinding(style=SOAPBinding.Style.RPC)
  | public class MyWebServiceBean implements MyWebService
  | {
  | 	@WebMethod 
  | 	public String sayHello(String to)
  | 	{
  | 		return "Hello "+to;
  | 	}
  | 	
  | 	@WebMethod
  | 	public Long add(MyClass e1)
  | 	{
  | 		return e1.getL1()+e1.getL2();
  | 	}
  | }
  | 
  | 

this is myClass


  | public class MyClass implements Serializable
  | {
  |    private Long l1;
  |    private Long l2;
  | 	
  | 	public Long getL1()
  | 	{
  | 		return l1;
  | 	}
  | 	
  | 	public void setL1(Long l1)
  | 	{
  | 		this.l1 = l1;
  | 	}
  | 	   
  | 	
  | 	public Long getL2()
  | 	{
  | 		return l2;
  | 	}
  | 
  | 	
  | 	public void setL2(Long l2)
  | 	{
  | 		this.l2 = l2;
  | 	}
  | 
  | }
  | 
  | 

I deploy it and I issue the following command to generate the auxiliary classes



  | 
  | wsconsume.sh -k http://fabocoxp:8080/MyWebServiceBeanService/MyWebServiceBean?wsdl -s src -p test.webServices.aux
  | 
  | 

I call the webService with this code (using the auxiliary classes)


  |       MyService_Service myss = new MyService_Service();      
  |       MyService myService = myss.getMyServicePort();
  | 
  |       System.out.println(myService.sayHello("Bob"));
  | 
  | 

The problem is that 


  |     myService.add(...);
  | 

accept a parameter of class testSeamWebApp2.webServices.aux.MyClass that is the auxiliary class.

myClass is a class belonging to a library shared between client end server.

To call the web service, I have to use the auxiliary class, not my library class coping values from one to the other. It's very boring.

Moreover, if MyClass contains other classes, the coping operation as to be performed for inner classes to. This is almost impossible !

Is there any way to use the original myClass as parameter type ?

Thank you very much

Fab.




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050679#4050679

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050679



More information about the jboss-user mailing list