4 Replies Latest reply on Nov 20, 2002 7:21 PM by Sascha Kulawk

    how to specify typemappings

    ymidt Newbie

      it seems that to return a bean object from the web service, you need to specify a beanmapping in the axis-config.xml

      but how do you give axis exposure to your classes that are deployed only in your .ear file?

      Is there a way to specify these mappings in the .wsr?

      -- David

        • 1. Re: how to specify typemappings
          ymidt Newbie

          figured it out. to use standard bean serialization:

          bean mapping goes in wsr's web-service.xml:

          <beanMapping qname="ns:TestBean" xmlns:ns="myns" languageSpecificType="java:com.company.client.TestBean"/>

          where TestBean adheres to all bean rules (no nice error messages if it doesn't)

          then in your client you must:

          QName tb = new QName("odcs","TestBean");
          call.registerTypeMapping(TestBean.class, tb, new BeanSerializerFactory(TestBean.class, tb), new BeanDeserializerFactory(TestBean.class, tb) );
          call.setOperationName("getTestBean");
          call.setReturnType(tb);
          call.addParameter("name", XMLType.XSD_STRING, ParameterMode.PARAM_MODE_IN);
          call.addParameter("id", XMLType.XSD_INT, ParameterMode.PARAM_MODE_IN);
          TestBean b = (TestBean) call.invoke( new Object[] {"dave",new Integer(5)} );
          System.out.println(b);

          • 2. Re: how to specify typemappings
            ymidt Newbie

            important typo in previous post. should be:

            figured it out. to use standard bean serialization:

            bean mapping goes in wsr's web-service.xml:

            <beanMapping qname="ns:TestBean" xmlns:ns="myns" languageSpecificType="java:com.company.client.TestBean"/>

            where TestBean adheres to all bean rules (no nice error messages if it doesn't)

            then in your client you must:

            QName tb = new QName("myns","TestBean");
            call.registerTypeMapping(TestBean.class, tb, new BeanSerializerFactory(TestBean.class, tb), new BeanDeserializerFactory(TestBean.class, tb) );
            call.setOperationName("getTestBean");
            call.setReturnType(tb);
            call.addParameter("name", XMLType.XSD_STRING, ParameterMode.PARAM_MODE_IN);
            call.addParameter("id", XMLType.XSD_INT, ParameterMode.PARAM_MODE_IN);
            TestBean b = (TestBean) call.invoke( new Object[] {"dave",new Integer(5)} );
            System.out.println(b);

            • 3. Re: how to specify typemappings
              Lars Mehrmann Newbie

              When using XDoclet to generate web-service.xml, how can one tell xdoclet to create the bean mapping entries in web-service.xml?

              • 4. Re: how to specify typemappings for Vector ?
                Sascha Kulawk Newbie

                I've problems returning java.sql.Timestamp and java.util.Vector Objects containing Serialized Beans (DAO Objects).

                How Do I have to specify the Typemapping for that ?

                Whats about development of the XDoclet Addon ? I'm using XDoclet 1.2 and the Plugin does not work.