[jboss-user] [JBoss Web Services Users] - Re: Problem of polymorphism of JBoss WebService
xiangyingbing
do-not-reply at jboss.com
Wed Nov 4 05:14:37 EST 2009
============below codes are for Client test ============
============below codes are for Client test ============
============below codes are for Client test ============
| /**
| * EJBWebServiceBean.java
| *
| * This file was auto-generated from WSDL
| * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
| */
|
| package com.ybxiang.ejbws;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
|
|
| @WebService
| public interface EJBWebServiceBean extends java.rmi.Remote {
| @WebMethod
| public void passParameter1(java.lang.String arg0) throws java.rmi.RemoteException;
|
| @WebMethod
| public void passParameter2(com.ybxiang.ejbws.Animal arg0) throws java.rmi.RemoteException;
| @WebMethod
| public void passParameter3(com.ybxiang.ejbws.Human arg0) throws java.rmi.RemoteException;
| @WebMethod
| public void passParameter4(com.ybxiang.ejbws.Animal[] arg0) throws java.rmi.RemoteException;
| @WebMethod
| public com.ybxiang.ejbws.Animal[] returnSomething1(int arg0) throws java.rmi.RemoteException;
| }
|
|
|
|
|
|
| package com.ybxiang.ejbws;
|
| import java.net.URL;
|
| import javax.xml.namespace.QName;
| import javax.xml.ws.Service;
|
|
|
| public class TestMain {
| public static void main(String []args){
| try {
| URL location = new URL("http://127.0.0.1:8080/PolymorphismEJBWebService/EJBWebServiceBean?wsdl");
| QName serviceName = new QName("http://ejbws.ybxiang.com/","EJBWebServiceBeanService");
|
| Service service = Service.create(location, serviceName);
| //service.setHandlerResolver(new EmsHandlerResolver());
|
| QName port = new QName("http://ejbws.ybxiang.com/","EJBWebServiceBeanPort");
| EJBWebServiceBean ejbWebServiceBean = service.getPort(port, EJBWebServiceBean.class);
|
| Animal a1 = new Animal();
| a1.setName("Animal.1");
| a1.setAge(new Long(1));
| //
| Animal a2 = new Animal();
| a2.setName("Animal.2");
| a2.setAge(new Long(2));
| //
| Human h = new Human();
| h.setName("Human.1");
| h.setAge(new Long(1));
| h.setEmail("human1 at gmail.com");
| System.out.println("===================testing===========================");
| System.out.println("test:ejbWebServiceBean.passParameter1(\"Test string\");");
| ejbWebServiceBean.passParameter1("Test string");
|
| System.out.println("test:ejbWebServiceBean.passParameter2(a1);");
| ejbWebServiceBean.passParameter2(a1);
|
| System.out.println("test:ejbWebServiceBean.passParameter2(h);");
| ejbWebServiceBean.passParameter2(h);
|
| System.out.println("test:ejbWebServiceBean.passParameter3(h);");
| ejbWebServiceBean.passParameter3(h);
| //
| Animal aa[] = new Animal[]{a1,a2};
| System.out.println("test:ejbWebServiceBean.passParameter4(aa);");
| ejbWebServiceBean.passParameter4(aa);
| //
| Human hh[] = new Human[]{h};
| System.out.println("test:ejbWebServiceBean.passParameter4(hh);");
| ejbWebServiceBean.passParameter4(hh);
| //
| System.out.println("---------------[animal]------------------");
| Animal[] returnedValue1 = ejbWebServiceBean.returnSomething1(1);
| System.out.println("------------returnedValue1:");
| for(Animal item:returnedValue1){
| System.out.println(" *** item:"+item);
| }
|
| System.out.println("---------------[human]------------------");
| Animal[] returnedValue2 = ejbWebServiceBean.returnSomething1(2);
| System.out.println("------------returnedValue2:");
| for(Animal item:returnedValue2){
| System.out.println(" *** item:"+item);
| }
|
|
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263902#4263902
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263902
More information about the jboss-user
mailing list