3 Replies Latest reply on Nov 13, 2002 10:57 AM by moreman

    how to specify typemappings

    ymidt

      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

          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

            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
              moreman

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