2 Replies Latest reply on Apr 26, 2011 6:24 PM by loveug

    Problems with example on JBossWS - JAX-WS Tools

    cristisor

      Hi guys. I am trying to deploy the test project that is showed on the "JBossWS - JAX-WS Tool s" page: http://community.jboss.org/wiki/JBossWS-JAX-WSTools. I generated the wsdl and schema files with "wsprovide".

       

      This is the wsdl file:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions name="EchoService" targetNamespace="http://echo/"
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://echo/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
          <wsdl:types>
              <schema xmlns="http://www.w3.org/2001/XMLSchema">
                  <import namespace="http://echo/" schemaLocation="EchoService_schema1.xsd" />
              </schema>
          </wsdl:types>
          <wsdl:message name="echoResponse">
              <wsdl:part name="parameters" element="tns:echoResponse">
              </wsdl:part>
          </wsdl:message>
          <wsdl:message name="echo">
              <wsdl:part name="parameters" element="tns:echo">
              </wsdl:part>
          </wsdl:message>
          <wsdl:portType name="Echo">
              <wsdl:operation name="echo">
                  <wsdl:input name="echo" message="tns:echo">
                  </wsdl:input>
                  <wsdl:output name="echoResponse" message="tns:echoResponse">
                  </wsdl:output>
              </wsdl:operation>
          </wsdl:portType>
          <wsdl:binding name="EchoServiceSoapBinding" type="tns:Echo">
              <soap:binding style="document"
                  transport="http://schemas.xmlsoap.org/soap/http" />
              <wsdl:operation name="echo">
                  <soap:operation soapAction="" style="document" />
                  <wsdl:input name="echo">
                      <soap:body use="literal" />
                  </wsdl:input>
                  <wsdl:output name="echoResponse">
                      <soap:body use="literal" />
                  </wsdl:output>
              </wsdl:operation>
          </wsdl:binding>
          <wsdl:service name="EchoService">
              <wsdl:port name="EchoPort" binding="tns:EchoServiceSoapBinding">
                  <soap:address location="http://localhost:9090/EchoPort" />
              </wsdl:port>
          </wsdl:service>
      </wsdl:definitions>
      

       

      This is the schema file that was generated along with the wsdl when I called wsprovide:

       

      <?xml version="1.0" encoding="utf-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:tns="http://echo/" elementFormDefault="unqualified"
          targetNamespace="http://echo/" version="1.0">
          <xs:element name="echo" type="tns:echo" />
          <xs:element name="echoResponse" type="tns:echoResponse" />
          <xs:complexType name="echo">
              <xs:sequence>
                  <xs:element minOccurs="0" name="arg0" type="xs:string" />
              </xs:sequence>
          </xs:complexType>
          <xs:complexType name="echoResponse">
              <xs:sequence>
                  <xs:element minOccurs="0" name="return" type="xs:string" />
              </xs:sequence>
          </xs:complexType>
      </xs:schema>
      

       

      Then I generated  all the class files with "wsconsume" on the wsdl file. This generated an interface "Echo" and so I created a class "EchoImpl" that implements the interface:


      package echo;

       

      @javax.jws.WebService

      public class EchoImpl implements Echo

      {

         public String echo(String arg0)

         {

            return arg0;

         }

      }

       

       

      The web service is ok when I make the deploy and so I created a client also. I used the class "EchoService", generated by wsconsume, and I created a new class, called "EchoClient", just like in the example. The client connect to the web service and gets the correct result, but JBoss throws a warning after creating the line:

       

      EchoService service = new EchoService();
      

       

      This is the warn:

       

      12:46:49,724 WARN  [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for {http://echo/}EchoImplService has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: No such operation: WebWithWSDLnull (HTTP GET PATH_INFO: /WebWithWSDLnull)
          at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:88) [:2.3.1]
      

       

      I googled for this warn and I found that it should come up only when a GET request is made, but I use the generated service class, nothing else.

      This happens when I run the example from the Eclipse IDE, run as java application. If I use wsrunclient on the client classes I get this:

       

       

      Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.serv
      ice.factory.ServiceConstructionException: Failed to create service.
              at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:152)
              at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(Pro
      viderImpl.java:71)
              at javax.xml.ws.Service.<init>(Service.java:57)
              at echo.EchoService.<init>(EchoService.java:45)
              at echo.EchoClient.main(EchoClient.java:11)
      Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed t
      o create service.
              at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.ja
      va:93)
              at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:207
      )
              at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150)
              ... 4 more
      Caused by: javax.wsdl.WSDLException: WSDLException (at /soap:Envelope): faultCod
      e=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'
      .
              at com.ibm.wsdl.xml.WSDLReaderImpl.checkElementName(Unknown Source)
      

       

       

      I guess that there might be something in my wsdl that he doesn't like, but I can't figure out what.

       

      Thanks a lot.