1 Reply Latest reply on Apr 28, 2008 10:23 AM by acefrehley

    Writing a WS cliente

    rinconmaradona

      Hi all,

      I'm trying to write a Hello World client for a deployed web service. This subject was addressed a year ago by GenesisD, but the problem was never solved in the forum.

      Any way, I hope you can help me, my client:

      package demo;
      
      import java.net.URL;
      
      import javax.xml.namespace.QName;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceFactory;
      
      public class demoCliente
      {
       public static void main(String[] args) throws Exception
       {
       String endpointURL = "http://localhost:8080/orquestador/OrquestadorWS?wsdl";
       URL wsdlURL = new URL(endpointURL);
      
       String targetNS = "http://webservices.orquestador.cupi2.uniandes/jaws";
       QName serviceName = new QName(targetNS, "IOrquestadorWSService");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(wsdlURL, serviceName);
      
       IOrquestadorWS orquestador = (IOrquestadorWS) service.getPort(IOrquestadorWS.class);
       orquestador.receiveItemInformation("Algo");
      
       }
      }


      The error the cliente produces:
      Exception in thread "main" java.lang.NoSuchMethodError: org.jboss.ws.utils.JBossWSEntityResolver.getEntityMap()Ljava/util/Map;
       at org.jboss.ws.utils.JBossWSEntityResolver.resolveNamespaceURI(JBossWSEntityResolver.java:65)
       at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:164)
       at org.jboss.ws.metadata.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:227)
       at org.jboss.ws.metadata.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:118)
       at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:145)
       at org.jboss.ws.metadata.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:273)
       at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:110)
       at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
       at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
       at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
       at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
       at demo.demoCliente.main(demoCliente.java:20)
      


      I have cofirmed that this method exists in the class JBossEntityResolver and it's inherited by JBossWSEntityResolver. All of this in the library jbossall-client.jar. THX!!

        • 1. Re: Writing a WS cliente
          acefrehley

          This is a classpath issue. I had this problem too trying to run a WS client from Eclipse. It took me a while, but in Eclipse, I did the following:

          - Add * ONLY * the xercesImpl.jar from the server lib/endorsed directory to
          your build path (DO NOT ADD resolver.jar or any of the other jars from here)
          - Add all jars in the server/client directory to your classpath
          - Add the stax-api.jar from the server/default/deploy/jboss.sar directory

          This solved the problem for me.