3 Replies Latest reply on Jun 21, 2006 4:32 AM by yogendra_g

    Fail to access the servlet-style web service


      I am using JBoss 4.0.3 SP1.

      According to the instructions from adminguide, I deploy a so-called "JAX-RPC service endpoints (JSEs)". The deployment seems to be successful, if we check it in "http://localhost:8080//ws4ee/services".

      But when i use the following code to access the service, exception is thrown

       String urlstr = "http://localhost:8080/hello-servlet/Hello";
       String argument = "Jack";
       System.out.println("Contacting webservice at " + urlstr);
       URL url = new URL(urlstr);
       QName qname = new QName("http://hello.ws.jboss.org/", "HelloService");
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
       Hello hello = (Hello) service.getPort(Hello.class);
       System.out.println("hello.hello(" + argument + ")");
       System.out.println("output:" + hello.hello(argument));

      Exception in thread "main" javax.xml.rpc.ServiceException: Error processing WSDL document:
      org.xml.sax.SAXException: Fatal Error: URI=http://localhost:8080/hello-servlet/Hello Line=2: Element type "meta" must be followed by either attribute specifications, ">" or "/>".
      at org.jboss.axis.client.Service.initService(Service.java:289)
      at org.jboss.axis.client.Service.(Service.java:191)
      at org.jboss.axis.client.ServiceFactory.createService(ServiceFactory.java:246)
      at org.jboss.ws.client.HelloClient.main(HelloClient.java:26)

        • 1. Re: Fail to access the servlet-style web service

          all the jar files are copied from jboss client folder including:


          xercesImpl.jar is from the lib\endorsed

          client-config.wsdd is a rename of \server\default\deploy\jboss-ws4ee.sar\META-INF\axis-client-config.xml

          • 2. Re: Fail to access the servlet-style web service

            The wsdl file seems to be fine, which is generated by sun's jwsdp 2.0

            <?xml version="1.0" encoding="UTF-8"?>
            <definitions name="HelloService" targetNamespace="http://hello.ws.jboss.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://hello.ws.jboss.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
             <message name="Hello_hello">
             <part name="String_1" type="xsd:string"/>
             <message name="Hello_helloResponse">
             <part name="result" type="xsd:string"/>
             <portType name="Hello">
             <operation name="hello" parameterOrder="String_1">
             <input message="tns:Hello_hello"/>
             <output message="tns:Hello_helloResponse"/>
             <binding name="HelloBinding" type="tns:Hello">
             <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
             <operation name="hello">
             <soap:operation soapAction=""/>
             <soap:body namespace="http://hello.ws.jboss.org/" use="literal"/>
             <soap:body namespace="http://hello.ws.jboss.org/" use="literal"/>
             <service name="HelloService">
             <port binding="tns:HelloBinding" name="HelloPort">
             <soap:address location="REPLACE_WITH_ACTUAL_URL"/>

            • 3. Re: Fail to access the servlet-style web service

              Following is the code for accessing the servlet-web service.

              public class WebServiceStandaloneClient {
               * @param args
               public static void main(String[] args) {
               try {
               String endPoint = "http://localhost:8080/age/Age?wsdl";
               URL url = new URL(endPoint);
               ServiceFactory sf = ServiceFactory.newInstance();
               QName serviceQname = new QName("http://age.webservices.javasrc.com/","AgeService");
               Service s = sf.createService(url,serviceQname);
               Age age = (Age) s.getPort(Age.class);
               System.out.println("got output " + age.age("name",new Integer(26)));
               } catch (MalformedURLException e) {
               } catch (ServiceException e) {
               } catch (RemoteException e) {

              You need to create following classes : I generated it using the Eclipse Web Service Client.
              package com.javasrc.webservices.age;
              public interface AgeService extends javax.xml.rpc.Service {
               public java.lang.String getAgePortAddress();
               public com.javasrc.webservices.age.Age getAgePort() throws javax.xml.rpc.ServiceException;
               public com.javasrc.webservices.age.Age getAgePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;

              There are jaxr,jaxrp,saaj,xml-api.jar, axis.jar, commons-loggin,commons-discovery,log4j and wsdl4j.jar files in the class path of the client.