5 Replies Latest reply on Mar 28, 2007 1:20 PM by jason.greene

    Webservice Client consumer

    nean

      Hello i have some problems to built a client which can use web services deployed...

      My config is like :
      - eclispe jboss IDE 2.0.0 beta
      - jboss 4.0.5 EJB3 config
      - jdk 1.5_11


      i deploy normaly an EJB3.0 webservice on jboss, and my wsdl is like :

      ?
      <definitions name="wsSiteService" targetNamespace="http://wsSite/jaws">
      <types/>
      ?
      <message name="wsSite_getDelaiProduit">
      <part name="String_1" type="xsd:string"/>
      </message>
      ?
      <message name="wsSite_getDelaiProduitResponse">
      <part name="result" type="xsd:int"/>
      </message>
      ?
      <message name="wsSite_getPrixProduit">
      <part name="String_1" type="xsd:string"/>
      </message>
      ?
      <message name="wsSite_getPrixProduitResponse">
      <part name="result" type="xsd:double"/>
      </message>
      ?
      <portType name="wsSite">
      ?
      <operation name="getDelaiProduit" parameterOrder="String_1">
      <input message="tns:wsSite_getDelaiProduit"/>
      <output message="tns:wsSite_getDelaiProduitResponse"/>
      </operation>
      ?
      <operation name="getPrixProduit" parameterOrder="String_1">
      <input message="tns:wsSite_getPrixProduit"/>
      <output message="tns:wsSite_getPrixProduitResponse"/>
      </operation>
      </portType>
      ?
      <binding name="wsSiteBinding" type="tns:wsSite">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      ?
      <operation name="getDelaiProduit">
      <soap:operation soapAction=""/>
      ?
      <input>
      <soap:body namespace="http://wsSite/jaws" use="literal"/>
      </input>
      ?
      <output>
      <soap:body namespace="http://wsSite/jaws" use="literal"/>
      </output>
      </operation>
      ?
      <operation name="getPrixProduit">
      <soap:operation soapAction=""/>
      ?
      <input>
      <soap:body namespace="http://wsSite/jaws" use="literal"/>
      </input>
      ?
      <output>
      <soap:body namespace="http://wsSite/jaws" use="literal"/>
      </output>
      </operation>
      </binding>
      ?
      <service name="wsSiteService">
      ?
      <port binding="tns:wsSiteBinding" name="wsSitePort">
      <soap:address location="http://localhost:8080/SiteMarchand-ejb/wsSiteBean"/>
      </port>
      </service>
      </definitions>


      my client is like :
      import java.net.MalformedURLException;
      import java.net.URL;
      import java.rmi.RemoteException;
      
      import javax.xml.namespace.QName;
      import javax.xml.rpc.Call;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceException;
      import javax.xml.rpc.ServiceFactory;
      
      public class testWS {
      
       /**
       * @param args
       * @throws MalformedURLException
       */
       public static void main(String[] args) {
       // TODO Auto-generated method stub
       String urlstr="http://localhost:8080/SiteMarchand-ejb/wsSiteBean?wsdl";
       URL url=null;
       try {
       try {
       url = new URL(urlstr);
       } catch (MalformedURLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
      
       System.out.println("Contacting webservice at " + urlstr);
       String ns = "http://wsSite/jaws";
      
       QName qname = new QName(ns,"wsSiteService");
       QName port = new QName(ns, "wsSitePort");
       QName operation = new QName(ns, "getPrixProduit");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
       Call call = service.createCall(port, operation);
       try {
       Double d = (Double) call.invoke(new Object[]{"ezekiel"});
       } catch (RemoteException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
       } catch (ServiceException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
       }
      }


      i imported these libraries in my classpath :

      jre system library 1.5_11
      JbossAOP 1.3 libraries (sdk 1.5)
      J2EE 1.4 Libraries (JBoss-IDE)
      jboss ejb3 libraries
      jbossws-client.jar



      And my error returned :

      Contacting webservice at http://localhost:8080/SiteMarchand-ejb/wsSiteBean?wsdl
      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSModel
      at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:106)
      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 testWS.main(testWS.java:37)


      ligne 37 of testWS.java is "Service service = factory.createService(url, qname);"

      So is there someone who can give me a solution or my error ?

      Or maybe a tips to create automaticaly the client with my configuration...

      Thanks for responses, please

        • 1. Re: Webservice Client consumer
          nean

          sorry it seems there is somes mod for xml ...

          i put it again :

          ?
           <definitions name="wsSiteBeanService" targetNamespace="http://wsSite/">
          <types/>
          ?
           <message name="wsSite_getDelaiProduitResponse">
          <part name="return" type="xsd:int"/>
          </message>
          ?
           <message name="wsSite_getPrixProduit">
          <part name="arg0" type="xsd:string"/>
          </message>
          ?
           <message name="wsSite_getPrixProduitResponse">
          <part name="return" type="xsd:double"/>
          </message>
          ?
           <message name="wsSite_getDelaiProduit">
          <part name="arg0" type="xsd:string"/>
          </message>
          ?
           <portType name="wsSite">
          ?
           <operation name="getDelaiProduit" parameterOrder="arg0">
          <input message="tns:wsSite_getDelaiProduit"/>
          <output message="tns:wsSite_getDelaiProduitResponse"/>
          </operation>
          ?
           <operation name="getPrixProduit" parameterOrder="arg0">
          <input message="tns:wsSite_getPrixProduit"/>
          <output message="tns:wsSite_getPrixProduitResponse"/>
          </operation>
          </portType>
          ?
           <binding name="wsSiteBinding" type="tns:wsSite">
          <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
          ?
           <operation name="getDelaiProduit">
          <soap:operation soapAction=""/>
          ?
           <input>
          <soap:body namespace="http://wsSite/" use="literal"/>
          </input>
          ?
           <output>
          <soap:body namespace="http://wsSite/" use="literal"/>
          </output>
          </operation>
          ?
           <operation name="getPrixProduit">
          <soap:operation soapAction=""/>
          ?
           <input>
          <soap:body namespace="http://wsSite/" use="literal"/>
          </input>
          ?
           <output>
          <soap:body namespace="http://wsSite/" use="literal"/>
          </output>
          </operation>
          </binding>
          ?
           <service name="wsSiteBeanService">
          ?
           <port binding="tns:wsSiteBinding" name="wsSiteBeanPort">
          <soap:address location="http://localhost:8080/SiteMarchand-ejb/wsSiteBean"/>
          </port>
          </service>
          </definitions>


          • 2. Re: Webservice Client consumer
            openyourmind

            Hi Nean,

            If you check in the wsrunclient.sh you will see that you should set the vm options as follows:

            -Djava.endorsed.dirs=/[jboss_install_path]/jboss/jboss-4.0.5.GA/lib/endorsed

            Hope it helps
            Open Your Mind

            • 3. Re: Webservice Client consumer
              nean

               

              "openyourmind" wrote:
              Hi Nean,

              If you check in the wsrunclient.sh you will see that you should set the vm options as follows:

              -Djava.endorsed.dirs=/[jboss_install_path]/jboss/jboss-4.0.5.GA/lib/endorsed

              Hope it helps
              Open Your Mind



              i haven't wsrunclient.sh, i have only a wstool.sh, where i can find a such line...


              After finaly i found the problem, i put my main as method on a stateless session bean and it works... Do you know why i can't make a simple client without to do a stateless session bean ?

              And do you know how i can use objects because it seems that the mapping is impossible... ?

              • 4. Re: Webservice Client consumer
                openyourmind

                Hi,

                I thought you were using jbossws-1.2.0.GA.

                I'm sorry I cannot help with previous versions.
                M.

                • 5. Re: Webservice Client consumer
                  jason.greene

                  Xerces needs to be in your classpath. openyourmind is correct, any client application you write needs to use the endorsed property to load the most current xerces.

                  -Jason