6 Replies Latest reply on Jul 8, 2007 4:34 PM by Alessio Soldano

    advice needed

    Andrew Dale Newbie

      Hi,

      Let me first explain that i am a beginner when it come to jboss web services, so i am sorry if this is a stupid problem.

      I installed jbossws-1.2.0.GA last week to an ejb3-clustered install of jboss4.0.5.GA. I then proceeded to follow the simple step listed here http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWS181HelloWorld
      I created an EJB3 (Stateless bean) like so:


      @RemoteBinding(jndiBinding = "ws_remote")
      @Stateless
      @WebService
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class WebServiceTestBean implements IWebServiceTestRemote {
      
      
       @WebMethod
       @WebResult(name = "res")
       public String echo(@WebParam(name = "input_string") String pInputString) {
       System.out.println(pInputString);
       return pInputString + " :: web serviced";
       }
      
      ............
      }


      And the wsdl generation for it worked. So i am now trying to access it with a simple client. I created the client using the wsconsume.sh script (with -k option) provided with jbossws. This creates the following file:

      /**
       * JBossWS Generated Source
       *
       * Generation Date: Mon Mar 12 14:55:35 CET 2007
       *
       * This generated source code represents a derivative work of the input to
       * the generator that produced it. Consult the input for the copyright and
       * terms of use that apply to this source code.
       *
       * JAX-WS Version: 2.0
       *
       */
      @WebServiceClient(name = "WebServiceTestBeanService", targetNamespace = "http://beans.test.com/", wsdlLocation = "http://172.16.26.83:8080/test/Echo?wsdl")
      public class WebServiceTestBeanService extends Service {
      
       private final static URL WEBSERVICETESTBEANSERVICE_WSDL_LOCATION;
      
       static {
       URL url = null;
       try {
       url = new URL("http://172.16.26.83:8080/test/Echo?wsdl");
       } catch (MalformedURLException e) {
       e.printStackTrace();
       }
       WEBSERVICETESTBEANSERVICE_WSDL_LOCATION = url;
       }
      
       public WebServiceTestBeanService(URL wsdlLocation, QName serviceName) {
       super(wsdlLocation, serviceName);
       }
      
       public WebServiceTestBeanService() {
       super(WEBSERVICETESTBEANSERVICE_WSDL_LOCATION, new QName("http://beans.test.com/", "WebServiceTestBeanService"));
       }
      
      
       /**
       *
       * @return
       * returns WebServiceTestBean
       */
       @WebEndpoint(name = "WebServiceTestBeanPort")
       public WebServiceTestBean getWebServiceTestBeanPort() {
       return (WebServiceTestBean)super.getPort(new QName("http://beans.test.com/", "WebServiceTestBeanPort"), WebServiceTestBean.class);
       }
      
      }


      I then try to create a WebServiceTestBeanService object, and call the getWebServiceTestBeanPort method which should return a proxy to the web service which i can call the test method "echo" with.

      I am running into trouble with creating the WebServiceTestBeanService object, as i get a noClassDefFound exception, the stack trace is:

      Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/xb/binding/ObjectModelFactory
       at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:108)
       at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:61)
       at javax.xml.ws.Service.<init>(Service.java:83)
       at com.test.beans.WebServiceTestBeanService.<init>(WebServiceTestBeanService.java:45)
       at com.test.beans.driver.main(driver.java:13)
      


      can anybody tell me what i have done wrong.

      Cheers,

      Andy

        • 1. Re: advice needed
          Peter Johnson Master

          Are you using wsrunclient to run the lcient? If so, check the wsrunclient script, it might not be including the jboss-xml-binding.jar file in the classpath.

          • 2. Re: advice needed
            Andrew Dale Newbie

            Hi,

            I am not running the client via the wsrunclient, i am trying to run it as a standalone app (probably not the best idea, considering the trouble i am having). I added the correct jar into the classpath but i now get a

            org.jboss.ws.WSException: Cannot find configFile: META-INF/standard-jaxws-client-config.xml


            error when trying to run the client. I even installed jbossws1.0.4GA on 4.0.4GA and i still get the same problem after coping the standard-jaxws-client-config.xml in the META-INF within the jbossws.sar dir in deploy.

            I am now attempting to call the web service via a HTTP form with the web service URL as the action (using HTTP POST) , the web service returns something but it is only an error saying:

            <env:Envelope>
             <env:Header/>
             <env:Body>
             <faultcode>env:Client</faultcode>
             <faultstring>
             Unsupported content type: application/x-www-form-urlencoded
             </faultstring>
             </env:Body>
            </env:Envelope>
            


            Any help/adivce would be appreciated.

            Thanks,

            Andy

            • 3. Re: advice needed
              monowai Newbie

              simplest thing to do is add all the [JBOSS_HOME]/client libraries to your classpath. I tried to do what you are doing, and did resolve all dependancies, but it takes time!

              • 4. Re: advice needed
                Jason Greene Master

                As PeterJ recommends, use the wsrunclient script, its for standalone apps. You can just copy that and modify it to your liking.

                -Jason

                • 5. Re: advice needed
                  Florian Bauer Newbie

                  I have the same problem by using an javascript/AJAX client.

                  That is the xml, that I send to the webservice:

                  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><getHalloWorld xmlns
                  
                  ="http://hibernate.base.dooris.com/jaws"></getHalloWorld></soap:Body></soap:Envelope>
                  


                  and that is the xml of the response:

                  <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body
                  
                  ><env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><faultcode>env:Server</faultcode><faultstring
                  
                  >Unsupported content type: application/x-www-form-urlencoded</faultstring></env:Fault></env:Body></env
                  
                  :Envelope>
                  
                  


                  what is the meaning of this Exception: "Unsupported content type: application/x-www-form-urlencoded"

                  • 6. Re: advice needed
                    Alessio Soldano Newbie

                    You should check the content type in your http requests. Valid content types are text/xml(soap1.1) and application/soap+xml (soap1.2)
                    Bye
                    Alessio Soldano
                    http://www.javalinux.it