2 Replies Latest reply on Feb 16, 2008 8:10 AM by Johannes Koch

    Cannot obtain java type mapping for {http://business/jaws}Li

    Jaguar SB Newbie


      I'm using Jboss 4.0.5G, JbossWS 1.0.3, SDK 1.5.0_9 and Windows XP_SP2.

      I have created theses classes using EJB3 annotation:

      package business;

      import java.rmi.Remote;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import javax.jws.soap.SOAPBinding.Style;

      @SOAPBinding(style = Style.RPC)
      public interface SelecionarMusicas extends Remote{
      public java.util.List selecionarMusicas() ;

      package business;

      import java.util.ArrayList;
      import java.util.List;
      import javax.ejb.Remote;
      import javax.ejb.Stateless;
      import javax.jws.WebService;

      import transfer.MusicaTO;

      import delegate.ManterMusicaDelegate;
      import exceptions.MusicaException;

      public class SelecionarMusicasWS {

      public java.util.List selecionarMusicas() throws MusicaException{

      List musicas = new ArrayList();
      ManterMusicaDelegate delegate;
      delegate = new ManterMusicaDelegate();
      musicas = delegate.selecionarMusicas();
      return musicas;


      package client;

      import java.net.MalformedURLException;
      import java.net.URL;
      import java.util.ArrayList;
      import java.util.Iterator;
      import java.util.List;

      import javax.xml.namespace.QName;
      import javax.xml.rpc.ServiceException;
      import javax.xml.rpc.ServiceFactory;
      import javax.xml.rpc.Service;

      import transfer.MusicaTO;
      import business.SelecionarMusicas;

      public class WebserviceClient {

      private static final String nameSpace="http://business/jaws";
      private static final String service="SelecionarMusicasService";
      private static final String wsdl="http://localhost:8080/easd2007/SelecionarMusicasWS?wsdl";

      public static void main(String[] args) {
      try {

      System.out.println("Starting Test Client");
      URL url = new URL(wsdl);
      QName qname = new QName(nameSpace,service);
      System.out.println("Creating a service");
      ServiceFactory factory = ServiceFactory.newInstance();
      Service remote = factory.createService(url, qname);
      System.out.println("Obtaining reference to a proxy object");
      SelecionarMusicas proxy = (SelecionarMusicas) remote.getPort(SelecionarMusicas.class);
      System.out.println("Accessed local proxy: " + proxy);
      System.out.println("Receiving data: ");

      List musicas = new ArrayList();
      musicas = proxy.selecionarMusicas();
      for (Iterator iter = musicas.iterator() ; iter.hasNext();){
      System.out.print("Nome: "+ iter.next().getNome());
      System.out.print("Tom: "+ iter.next().getNome());
      System.out.print("Dominante Primário: "+ iter.next().getNome());
      System.out.print("Dominante Secundário: "+ iter.next().getNome());
      System.out.print("Diminuto Ascendente: "+ iter.next().getNome());
      System.out.print("Diminuto Descendente: "+ iter.next().getNome());
      System.out.print("Diminuto Alternativo: "+ iter.next().getNome());
      System.out.print("Clichê Harmônico: "+ iter.next().getNome());

      } catch (MalformedURLException e) {
      // TODO Auto-generated catch block

      catch (ServiceException e) {
      // TODO Auto-generated catch block


      When I try to use a webservice client happens it:

      Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://business/jaws}List
      at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataRpc(JSR109MetaDataBuilder.java:321)
      at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuilder.java:196)
      at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaDataInternal(JSR109ClientMetaDataBuilder.java:208)
      at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:126)
      at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
      at org.jboss.ws.jaxrpc.ServiceImpl.(ServiceImpl.java:96)
      at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
      at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
      at client.WebserviceClient.main(Unknown Source)

      Somebody know why ?


        • 1. Re: Cannot obtain java type mapping for {http://business/jaw
          Salva Carsi Newbie


          I have been working several days with this issue. At last this problem is caused in the Client application. In my case a web app. It was not able to recognize the type that the server was returning (ArrayList in this case).

          Another important thing, correct me if I am wrong, is that Web Services Soap Messages not support ArrayList directly, so if you would like to use it you must implement an ArrayList by yourself. A pretty hard work. The thing that I have done is to return an Array (suported by the Web Services) of my own objects, that I have mapped previously.

          My solution was to create a Web Service Client using Eclipse Wtp. It creates a EAR that includes all the necessary stuff for map the user types.

          • 2. Re: Cannot obtain java type mapping for {http://business/jaw
            Johannes Koch Newbie

            What's this type mapping about after all? I'm trying to write my first own webservice and did two tutorials, leading to this client code:

            package test.de.laliluna.library;
            import java.net.URL;
            import javax.xml.namespace.QName;
            import javax.xml.rpc.Service;
            import javax.xml.rpc.ServiceFactory;
            import de.laliluna.library.BookTestBean;
            public class WebServiceTestClient
             * @param args
             public static void main(String[] args) throws Exception
             URL url = new URL("http://localhost:8080/FirstEjb3Tutorial/BookTestBean?wsdl");
             QName qname = new QName("http://library.laliluna.de/", "BookTestBeanService");
             ServiceFactory factory = ServiceFactory.newInstance();
             Service service = factory.createService(url, qname);
             BookTestBean serviceEndpoint = (BookTestBean)service.getPort(BookTestBean.class);

            leading to this exception:
            Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://library.laliluna.de/}test
             at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.processDocElement(JAXRPCMetaDataBuilder.java:627)
             at test.de.laliluna.library.WebServiceTestClient.main(WebServiceTestClient.java:22)

            The last line refers to the statement "Service service = factory.createService(url, qname);"

            I expected not to have to care about XML internals of the web service when using Java Annotations - like this:
             public void test()

            So, if you could answer these questions:
            1. Where/how can I manually specify a type mapping? Or do I need to extend my Annotations?
            2. My web method has neither parameters nor a return value, how can there be any types to map??

            I'd really appreciate it.

            Also, does anybody know a good webservices tutorial for complete webservice rookies using JBoss?

            Thanks in advance!