2 Replies Latest reply on Dec 13, 2006 6:49 PM by elcapitan

    Mapping Problems

    elcapitan

      G'day all,

      I'm just getting started writing an application, and I'm dealing with JBossWS for the first time. I've been banging my head against a brick wall for some time now, and haven't been able to find an answer anywhere (although I'm now suffering from serious information overload).

      Basically, I'm running two components. The first is an EJB3 stateless session bean "server", deployed in JBoss 4.0.5; the second is a very simple standalone client. The server deploys fine, and responds appropriately to requests made using soapUI; however, although the client compiles fine, attempting to run it provides the following stack trace:

      [java] Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://servercontroller.application.server.webcrawler.thedistillery
      .com.au/jaws}addItemToWatchList
      [java] at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataDoc(JSR109MetaDataBuilder.java:451)
      [java] at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuilder.java:200)
      [java] at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaDataInternal(JSR109ClientMetaDataBuilder.java:208)
      [java] at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:126)
      [java] at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
      [java] at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
      [java] at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
       [java] at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
      [java] at au.com.thedistillery.webcrawler.server.application.servercontroller.TestWebService.main(TestWebService.java:23)


      My initial thought were that I was using a complex type that wasn't being mapped properly, however when I stripped the code down to only using the available literals (i.e. long, String, etc.), I kept getting the same error. I have tried using wstools to generate artifacts, however, all I get is a bunch of Java files which, when integrated into the client, return an almost identical error. I have also managed to generate an XML mapping file - do I need to deploy this or make it available to the client in some way?

      The client code, in full, is (the class WatchList is a POJO with some very simple attributes, all of which are Java primitives):
      package au.com.thedistillery.webcrawler.server.application.servercontroller;
      
      import au.com.thedistillery.webcrawler.server.application.servercontroller.WatchListManagerInterface;
      
      import javax.xml.namespace.QName;
      import javax.xml.rpc.Call;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceFactory;
      import java.net.URL;
      import java.io.File;
      
      public class TestWebService
      {
       public static void main(String[] args) throws Exception
       {
       URL url = new URL("http://localhost:8080/crawler/WatchListManager?wsdl"); // from xml files, soap address, last line
       QName qname = new QName("http://servercontroller.application.server.webcrawler.thedistillery.com.au/jaws",
       "WatchListManagerInterfaceService");//first line from xml file
      
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);// create service
      
       WatchListManagerInterface cm = (WatchListManagerInterface) service.getPort(WatchListManagerInterface.class);
      
       cm.createWatchList("frank", 1000);
       }
      }


      The endpoint interface I'm using looks like:

      package au.com.thedistillery.webcrawler.server.application.servercontroller;
      
      import java.net.URI;
      import java.util.List;
      
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      
      @WebService
      public interface WatchListManagerInterface {
      
       /* Methods that provide access to manipulation functionality of WatchLists */
      
       @WebMethod public int createWatchList(String name, long durationMilliSeconds);
       @WebMethod public boolean deleteWatchList(int watchListID);
      
       @WebMethod public boolean addItemToWatchList(int watchListID, URI itemURI);
       @WebMethod public int getWatchListItemID(int watchListID, URI itemURI);
       @WebMethod public boolean removeItemFromWatchList(int watchListID, int watchListItemID);
      
       @WebMethod public WatchList getWatchList(int watchListID);
       @WebMethod public WatchList[] getAllWatchLists();
       @WebMethod public boolean updateWatchList(WatchList updatedWatchList);


      I can provide more code if necessary.

      Thanks in advance,

      James

        • 1. Re: Mapping Problems
          thomas.diesler

           

           ServiceFactory factory = ServiceFactory.newInstance();
           Service service = factory.createService(url, qname);// create service
          


          This client has no information about xml/java mapping.

          You could:
          - Use an appclient, to get a preconfigured stub from jndi
          - Use the propriatarey createService that takes a pointer to jaxrpc-mapping

          Both is explained in the user guide. Also, you could start with working code from the samples.

          • 2. Re: Mapping Problems
            elcapitan

            Thanks for the reply. I seem to have solved my problem by integrating the wstools-generated stubs into the client and placing the jaxrpc-mapping.xml file in the classpath.

            I have to say, I found it very difficult to locate the information you specified in the user-guide - in particular, I had difficulty working out which methods applied to which releases of JBoss, and which EJB version. As I look through Chapter 12 of the JBoss 4 AS Guide, none of this is clearly spelled out - the jaxrpc-mapping.xml file is mentioned tangentially in a couple of code fragments, and nowhere beyond that. The JBossWS user guide isn't really any easier to find information in.

            I'm not suggesting that the information isn't there, at least in some form - however, as a relatively experienced Java developer with a higher-than-average level of skill in English comprehension, I'm concerned that many other people will have similar problems in locating it. Is a documentation overhaul in the pipe at some stage?

            Let me know if I can help you out with this. :) Thanks again for your help.