3 Replies Latest reply on Jun 18, 2010 5:35 AM by gvlax

    Provider based service

    mikefinnx

      Trying to deploy top-down provider based service to AS 5.1.0 (I am down to a trivial sample). The app seems to deploy OK, and jbossws services listing shows it. However, the WSDL URL listed does not work (404), nor does the endpoint shown in the generated WSDL (404).

       

      Steps-

      1. New EAR + Web project, named: EchoServiceApp, EchoServiceWeb

      2. Write WSDL - simple echo service (see below). Place in WEB-INF

      3. Build provider class (see below for src)

      4. Write web.xml (see below for src)

      5. Deploy. Following shows in log:

      14:18:30,077 INFO  [TomcatDeployment] deploy, ctxPath=/EchoServiceWeb
      14:18:30,217 INFO  [WSDLFilePublisher] WSDL published to: file:/C:/apps/jboss/jboss-5.1.0.GA/server/standard/data/wsdl/EchoServiceApp.ear/EchoServiceWeb.war/echo.wsdl

      6. Look at JBossWS con. Service listing shows:

      Endpoint Namejboss.ws:context=EchoServiceApp-EchoServiceWeb,endpoint=Endpoint
      Endpoint Addresshttp://localhost:8080/EchoServiceApp-EchoServiceWeb?wsdl

       

      7. Try to access Endpoint Address in browser, with and without "?wsdl". HTTP 404.

      8. Load WSDL from file above into test tool (SOAPUI in this case). Endpoint address from WSDL matches above.

      9. Invoke service, results in HTTP404 error message.

       

      I cannot figure out where JBossWS is ACTUALLY mounting the endpoint to. Any ideas?

       

      TIA,

      Mike

       

       

      EchoProvider.java

      package echo;

       

      import javax.xml.soap.SOAPMessage;
      import javax.xml.ws.Provider;
      import javax.xml.ws.ServiceMode;
      import javax.xml.ws.WebServiceProvider;

       

      @WebServiceProvider(portName = "EchoPort", serviceName = "EchoService", targetNamespace = "http://echo/", wsdlLocation = "WEB-INF/echo.wsdl")
      @ServiceMode(value = javax.xml.ws.Service.Mode.MESSAGE)

       

      public class EchoProvider implements Provider<SOAPMessage> {

          @Override
          public SOAPMessage invoke(SOAPMessage rqst) {
              System.out.println("invoke()");
              return rqst;
          }

      }

       

      echo.wsdl:

      <?xml version="1.0" encoding="UTF-8"?>
      <definitions name='EchoService' targetNamespace='http://echo/'
          xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
          xmlns:tns='http://echo/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
          <types>
              <xs:schema targetNamespace='http://echo/' version='1.0'
                  xmlns:tns='http://echo/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
                  <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>
          </types>
          <message name='EchoMessage'>
              <part element='tns:echo' name='echo' />
          </message>
          <message name='EchoResponseMessage'>
              <part element='tns:echoResponse' name='echoResponse' />
          </message>
          <portType name='Echo'>
              <operation name='echo' parameterOrder='echo'>
                  <input message='tns:EchoMessage' />
                  <output message='tns:EchoResponseMessage' />
              </operation>
          </portType>
          <binding name='EchoBinding' type='tns:Echo'>
              <soap:binding style='document'
                  transport='http://schemas.xmlsoap.org/soap/http' />
              <operation name='echo'>
                  <soap:operation soapAction='' />
                  <input>
                      <soap:body use='literal' />
                  </input>
                  <output>
                      <soap:body use='literal' />
                  </output>
              </operation>
          </binding>
          <service name='EchoService'>
              <port binding='tns:EchoBinding' name='EchoPort'>
                  <soap:address location='REPLACE_WITH_ACTUAL_URL' />
              </port>
          </service>
      </definitions>

       

      web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
          <servlet-name>Endpoint</servlet-name>
          <servlet-class>echo.EchoProvider</servlet-class>
        </servlet>
        <servlet-mapping>
          <servlet-name>Endpoint</servlet-name>
          <url-pattern>/*</url-pattern>
        </servlet-mapping>
      </web-app>