1 2 Previous Next 15 Replies Latest reply on Nov 16, 2009 8:18 AM by Richard Opalka

    Problem of polymorphism of JBoss WebService

    xiang yingbing Master

      Dear JBoss developers,
      I spent several days to solve the problem of polymorphism in JBoss WebService, but failed.
      I googled many articles, Only "http://forums.sun.com/thread.jspa?threadID=5225941" is usefull to me. But it just does NOT work!!

      Please help me. Great Thanks to any tips.

      My envirionment:
      jboss-5.1.0.GA-jdk6.
      jdk1.6.0_14_Windows
      Eclipse 3.2

      My code:
      Server:
      --------------------------------------------------------------------------------------------------------------------
      package com.ybxiang.ejbws;

      import javax.xml.bind.annotation.XmlSeeAlso;

      @XmlSeeAlso({Human.class})
      public class Animal implements java.io.Serializable{
      private String name;
      private Long age;
      public String getName() {
      return name;
      }
      public void setName(String name) {
      this.name = name;
      }

      public Long getAge() {
      return age;
      }
      public void setAge(Long age) {
      this.age = age;
      }

      public String toString(){
      return "Animal-->name:"+this.getName()+",age:"+this.getAge();
      }
      }

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

      package com.ybxiang.ejbws;

      public class Human extends Animal implements java.io.Serializable{
      private String email;

      public void setEmail(String email) {
      this.email = email;
      }

      public String getEmail() {
      return email;
      }

      public String toString(){
      return "Human-->name:"+this.getName()+",age:"+this.getAge()+","+"email:"+email;
      }

      }


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

      package com.ybxiang.ejbws;

      import java.util.ArrayList;
      import java.util.Iterator;

      import javax.jws.WebMethod;

      public interface EJBWebServiceInterface {
      public void passParameter1(String s);
      public void passParameter2(Animal a);
      public void passParameter3(Human h);
      public void passParameter4(ArrayList lst);
      public ArrayList<? extends Animal> returnSomething1(int type);
      }


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

      package com.ybxiang.ejbws;

      import java.util.ArrayList;
      import java.util.Iterator;

      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.xml.bind.annotation.XmlSeeAlso;

      import javax.jws.soap.SOAPBinding;

      @Stateless
      @WebService
      //@**XmlSeeAlso({Animal.class, Human.class})
      public class EJBWebServiceBean implements EJBWebServiceInterface{
      @WebMethod
      public void passParameter1(String s){
      System.out.println("------------String is got:"+s);
      }
      @WebMethod
      public void passParameter2(Animal a){
      System.out.println("------------Animal is got:"+a);
      if(a instanceof Human){
      System.out.println("************* It's realy human!!! *************");
      }
      }
      @WebMethod
      public void passParameter3(Human h){
      System.out.println("------------Human is got, name:"+h.getName()+", email:"+h.getEmail());
      }

      @WebMethod
      public void passParameter4(ArrayList lst){
      System.out.println("------------ArrayList is got:");
      if(lst!=null){
      Iterator it = lst.iterator();
      Animal a = it.next();
      if(a instanceof Human){
      System.out.println("One human is got:"+((Human)a));
      }else{
      System.out.println("One Animal is got:"+a);
      }
      }else{
      System.out.println("------------List is null.");
      }
      }

      @WebMethod
      public ArrayList<? extends Animal> returnSomething1(int type){
      if(type==1){
      ArrayList aa = new ArrayList();
      {
      Animal animal1 = new Animal();
      animal1.setName("Animal.1");
      animal1.setAge(new Long(1));
      aa.add(animal1);
      }
      {
      Animal animal2 = new Animal();
      animal2.setName("Animal.2");
      animal2.setAge(new Long(2));
      aa.add(animal2);
      }
      return aa;
      }else{
      ArrayList bb = new ArrayList();
      {
      Human human1 = new Human();
      human1.setName("Human.1");
      human1.setAge(new Long(1));
      bb.add(human1);
      }
      {
      Human human2 = new Human();
      human2.setName("Human.2");
      human2.setAge(new Long(2));
      bb.add(human2);
      }
      return bb;
      }
      }


      }

        • 1. Re: Problem of polymorphism of JBoss WebService
          xiang yingbing Master

          I compiled those code and run in eclipse:
          run as --> run on server[jboss 5.1]

          Now, i can see that the web service is deployed successfully and i can visit http://127.0.0.1:8080/PolymorphismEJBWebService/EJBWebServiceBean?wsdl

          I got the wsdl:

          - <definitions name="EJBWebServiceBeanService" targetNamespace="http://ejbws.ybxiang.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ejbws.ybxiang.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          -
          - <xs:schema targetNamespace="http://ejbws.ybxiang.com/" version="1.0" xmlns:tns="http://ejbws.ybxiang.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
          <xs:element name="passParameter1" type="tns:passParameter1" />
          <xs:element name="passParameter1Response" type="tns:passParameter1Response" />
          <xs:element name="passParameter2" type="tns:passParameter2" />
          <xs:element name="passParameter2Response" type="tns:passParameter2Response" />
          <xs:element name="passParameter3" type="tns:passParameter3" />
          <xs:element name="passParameter3Response" type="tns:passParameter3Response" />
          <xs:element name="passParameter4" type="tns:passParameter4" />
          <xs:element name="passParameter4Response" type="tns:passParameter4Response" />
          <xs:element name="returnSomething1" type="tns:returnSomething1" />
          <xs:element name="returnSomething1Response" type="tns:returnSomething1Response" />
          - <xs:complexType name="passParameter1">
          - <xs:sequence>
          <xs:element minOccurs="0" name="arg0" type="xs:string" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="passParameter1Response">
          <xs:sequence />
          </xs:complexType>
          - <xs:complexType name="passParameter2">
          - <xs:sequence>
          <xs:element minOccurs="0" name="arg0" type="tns:animal" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="animal">
          - <xs:sequence>
          <xs:element minOccurs="0" name="age" type="xs:long" />
          <xs:element minOccurs="0" name="name" type="xs:string" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="human">
          - <xs:complexContent>
          - <xs:extension base="tns:animal">
          - <xs:sequence>
          <xs:element minOccurs="0" name="email" type="xs:string" />
          </xs:sequence>
          </xs:extension>
          </xs:complexContent>
          </xs:complexType>
          - <xs:complexType name="passParameter2Response">
          <xs:sequence />
          </xs:complexType>
          - <xs:complexType name="passParameter3">
          - <xs:sequence>
          <xs:element minOccurs="0" name="arg0" type="tns:human" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="passParameter3Response">
          <xs:sequence />
          </xs:complexType>
          - <xs:complexType name="passParameter4">
          - <xs:sequence>
          <xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" type="tns:animal" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="passParameter4Response">
          <xs:sequence />
          </xs:complexType>
          - <xs:complexType name="returnSomething1">
          - <xs:sequence>
          <xs:element name="arg0" type="xs:int" />
          </xs:sequence>
          </xs:complexType>
          - <xs:complexType name="returnSomething1Response">
          - <xs:sequence>
          <xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="tns:animal" />
          </xs:sequence>
          </xs:complexType>
          </xs:schema>

          -


          -


          -


          -


          -


          -


          -


          -


          -


          -


          -
          -



          -



          -



          -



          -




          -
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
          -
          <soap:operation soapAction="" />
          -
          <soap:body use="literal" />

          -
          <soap:body use="literal" />


          -
          <soap:operation soapAction="" />
          -
          <soap:body use="literal" />

          -
          <soap:body use="literal" />


          -
          <soap:operation soapAction="" />
          -
          <soap:body use="literal" />

          -
          <soap:body use="literal" />


          -
          <soap:operation soapAction="" />
          -
          <soap:body use="literal" />

          -
          <soap:body use="literal" />


          -
          <soap:operation soapAction="" />
          -
          <soap:body use="literal" />

          -
          <soap:body use="literal" />



          -
          -
          <soap:address location="http://127.0.0.1:8080/PolymorphismEJBWebService/EJBWebServiceBean" />


          • 2. Re: Problem of polymorphism of JBoss WebService
            xiang yingbing Master

            The client code:
            Create a new java project WSClient.

            Animal.java and Human.java are copied from server part.

            package com.ybxiang.ejbws;

            import javax.xml.bind.annotation.XmlSeeAlso;

            @XmlSeeAlso({Human.class})
            public class Animal implements java.io.Serializable{
            private String name;
            private Long age;
            public String getName() {
            return name;
            }
            public void setName(String name) {
            this.name = name;
            }

            public Long getAge() {
            return age;
            }
            public void setAge(Long age) {
            this.age = age;
            }

            public String toString(){
            return "Animal-->name:"+this.getName()+",age:"+this.getAge();
            }
            }

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

            package com.ybxiang.ejbws;

            public class Human extends Animal implements java.io.Serializable{
            private String email;

            public void setEmail(String email) {
            this.email = email;
            }

            public String getEmail() {
            return email;
            }

            public String toString(){
            return "Human-->name:"+this.getName()+",age:"+this.getAge()+","+"email:"+email;
            }

            }
            -----------------------------------

            /**
            * 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;
            }


            ================test===============
            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@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();
            }
            }
            }

            • 3. Re: Problem of polymorphism of JBoss WebService
              xiang yingbing Master

              Printed result:

              Server:
              18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,120 INFO [STDOUT] ------------String is got:Test string
              18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Animal.1,age:1
              18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Human.1,age:1
              18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 INFO [STDOUT] ------------Human is got, name:Human.1, email:human1@gmail.com
              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 INFO [STDOUT] ------------ArrayList is got:
              18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Animal.1,age:1
              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
              18:05:26,151 INFO [STDOUT] ------------ArrayList is got:
              18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Human.1,age:1


              Client:

              INFO: Dynamically creating request wrapper Class com.ybxiang.ejbws.jaxws.ReturnSomething1
              Nov 4, 2009 6:05:25 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
              INFO: Dynamically creating response wrapper bean Class com.ybxiang.ejbws.jaxws.ReturnSomething1Response
              ===================testing===========================
              test:ejbWebServiceBean.passParameter1("Test string");
              test:ejbWebServiceBean.passParameter2(a1);
              test:ejbWebServiceBean.passParameter2(h);
              test:ejbWebServiceBean.passParameter3(h);
              test:ejbWebServiceBean.passParameter4(aa);
              test:ejbWebServiceBean.passParameter4(hh);
              ---------------[animal]------------------
              ------------returnedValue1:
              *** item:Animal-->name:Animal.1,age:1
              *** item:Animal-->name:Animal.2,age:2
              ---------------[human]------------------
              ------------returnedValue2:
              *** item:Animal-->name:Human.1,age:1
              *** item:Animal-->name:Human.2,age:2

              • 4. Re: Problem of polymorphism of JBoss WebService
                xiang yingbing Master

                Obviously, the result is NOT what i want!!!

                Please help me!!! I am really painfull now.

                Thank you in advance!!! Please!!!

                • 5. Re: Problem of polymorphism of JBoss WebService
                  xiang yingbing Master

                  =====================sorry, i will rearrange the code by

                  ============
                  
                  
                  


                  • 6. Re: Problem of polymorphism of JBoss WebService
                    xiang yingbing Master

                     

                    package com.ybxiang.ejbws;
                    
                    import javax.xml.bind.annotation.XmlSeeAlso;
                    
                    @XmlSeeAlso({Human.class})
                    public class Animal implements java.io.Serializable{
                     private String name;
                     private Long age;
                     public String getName() {
                     return name;
                     }
                     public void setName(String name) {
                     this.name = name;
                     }
                    
                     public Long getAge() {
                     return age;
                     }
                     public void setAge(Long age) {
                     this.age = age;
                     }
                    
                     public String toString(){
                     return "Animal-->name:"+this.getName()+",age:"+this.getAge();
                     }
                    }
                    


                    • 7. Re: Problem of polymorphism of JBoss WebService
                      xiang yingbing Master

                       

                      package com.ybxiang.ejbws;
                      
                      public class Human extends Animal implements java.io.Serializable{
                       private String email;
                      
                       public void setEmail(String email) {
                       this.email = email;
                       }
                      
                       public String getEmail() {
                       return email;
                       }
                      
                       public String toString(){
                       return "Human-->name:"+this.getName()+",age:"+this.getAge()+","+"email:"+email;
                       }
                      
                      }
                      


                      • 8. Re: Problem of polymorphism of JBoss WebService
                        xiang yingbing Master

                         

                        package com.ybxiang.ejbws;
                        
                        import java.util.ArrayList;
                        import java.util.Iterator;
                        
                        import javax.jws.WebMethod;
                        
                        public interface EJBWebServiceInterface {
                         public void passParameter1(String s);
                         public void passParameter2(Animal a);
                         public void passParameter3(Human h);
                         public void passParameter4(ArrayList<Animal> lst);
                         public ArrayList<? extends Animal> returnSomething1(int type);
                        }
                        
                        
                        
                        
                        
                        package com.ybxiang.ejbws;
                        
                        import java.util.ArrayList;
                        import java.util.Iterator;
                        
                        import javax.ejb.Stateless;
                        import javax.jws.WebMethod;
                        import javax.jws.WebService;
                        import javax.xml.bind.annotation.XmlSeeAlso;
                        
                        import javax.jws.soap.SOAPBinding;
                        
                        @Stateless
                        @WebService
                        //@**XmlSeeAlso({Animal.class, Human.class})// Here i tried too!
                        public class EJBWebServiceBean implements EJBWebServiceInterface{
                         @WebMethod
                         public void passParameter1(String s){
                         System.out.println("------------String is got:"+s);
                         }
                         @WebMethod
                         public void passParameter2(Animal a){
                         System.out.println("------------Animal is got:"+a);
                         if(a instanceof Human){
                         System.out.println("************* It's realy human!!! *************");
                         }
                         }
                         @WebMethod
                         public void passParameter3(Human h){
                         System.out.println("------------Human is got, name:"+h.getName()+", email:"+h.getEmail());
                         }
                        
                         @WebMethod
                         public void passParameter4(ArrayList<Animal> lst){
                         System.out.println("------------ArrayList<Animal> is got:");
                         if(lst!=null){
                         Iterator<Animal> it = lst.iterator();
                         Animal a = it.next();
                         if(a instanceof Human){
                         System.out.println("One human is got:"+((Human)a));
                         }else{
                         System.out.println("One Animal is got:"+a);
                         }
                         }else{
                         System.out.println("------------List is null.");
                         }
                         }
                        
                         @WebMethod
                         public ArrayList<? extends Animal> returnSomething1(int type){
                         if(type==1){
                         ArrayList<Animal> aa = new ArrayList<Animal>();
                         {
                         Animal animal1 = new Animal();
                         animal1.setName("Animal.1");
                         animal1.setAge(new Long(1));
                         aa.add(animal1);
                         }
                         {
                         Animal animal2 = new Animal();
                         animal2.setName("Animal.2");
                         animal2.setAge(new Long(2));
                         aa.add(animal2);
                         }
                         return aa;
                         }else{
                         ArrayList<Human> bb = new ArrayList<Human>();
                         {
                         Human human1 = new Human();
                         human1.setName("Human.1");
                         human1.setAge(new Long(1));
                         bb.add(human1);
                         }
                         {
                         Human human2 = new Human();
                         human2.setName("Human.2");
                         human2.setAge(new Long(2));
                         bb.add(human2);
                         }
                         return bb;
                         }
                         }
                        
                        
                        }
                        


                        • 9. Re: Problem of polymorphism of JBoss WebService
                          xiang yingbing Master

                          ============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@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();
                           }
                           }
                          }
                          


                          • 10. Re: Problem of polymorphism of JBoss WebService
                            xiang yingbing Master

                            ============== result from JBoss AS==============

                            18:05:01,199 DEBUG [ManagerBase] Start expire sessions StandardManager at 1257329101199 sessioncount 0
                            18:05:01,199 DEBUG [ManagerBase] End expire sessions StandardManager processingTime 0 expired sessions: 0
                            18:05:07,230 FINE [tcp] RMI Scheduler(0): close connection
                            18:05:07,230 FINE [tcp] RMI TCP Connection(9)-127.0.0.1: (port 1558) connection closed
                            18:05:07,230 FINE [tcp] RMI TCP Connection(9)-127.0.0.1: close connection
                            18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,120 INFO [STDOUT] ------------String is got:Test string
                            18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Animal.1,age:1
                            18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Human.1,age:1
                            18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 INFO [STDOUT] ------------Human is got, name:Human.1, email:human1@gmail.com
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
                            18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Animal.1,age:1
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
                            18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Human.1,age:1
                            18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            18:05:26,167 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected
                            1
                            



                            ============== result from client ==============

                            Nov 4, 2009 6:05:25 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
                            INFO: Dynamically creating response wrapper bean Class com.ybxiang.ejbws.jaxws.ReturnSomething1Response
                            ===================testing===========================
                            test:ejbWebServiceBean.passParameter1("Test string");
                            test:ejbWebServiceBean.passParameter2(a1);
                            test:ejbWebServiceBean.passParameter2(h);
                            test:ejbWebServiceBean.passParameter3(h);
                            test:ejbWebServiceBean.passParameter4(aa);
                            test:ejbWebServiceBean.passParameter4(hh);
                            ---------------[animal]------------------
                            ------------returnedValue1:
                             *** item:Animal-->name:Animal.1,age:1
                             *** item:Animal-->name:Animal.2,age:2
                            ---------------[human]------------------
                            ------------returnedValue2:
                             *** item:Animal-->name:Human.1,age:1
                             *** item:Animal-->name:Human.2,age:2


                            • 11. Re: Problem of polymorphism of JBoss WebService
                              xiang yingbing Master

                               

                              18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
                              18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Animal.1,age:1
                              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
                              stateless bean context, it should already have been injected
                              18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
                              stateless bean context, it should already have been injected
                              18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
                              18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Human.1,age:1
                              ~~~~~~~~~~~I had expected here print
                              [18:05:26,151 INFO [STDOUT] One Human is got:Animal-->name:Human.1,age:1]
                              
                              
                              
                              ------------returnedValue2:
                               *** item:Animal-->name:Human.1,age:1
                               *** item:Animal-->name:Human.2,age:2
                              ~~~~~~~~Here i had expected print something like:
                               *** item:Human-->name:Human.1,age:1, email:xxxx
                              
                              
                              




                              • 13. Re: Problem of polymorphism of JBoss WebService
                                xiang yingbing Master

                                Dear JBoss developers,
                                please give me an simple example about polymorphism webservice.

                                Thanks!!! I DO need it.

                                • 14. Re: Problem of polymorphism of JBoss WebService
                                  xiang yingbing Master

                                  I find that if jbossws-native is replaced by JBOssws-METRO, the same jar works!!!

                                  There must be something wrong with jbossws-native!

                                  1 2 Previous Next