3 Replies Latest reply on Nov 8, 2011 2:44 AM by ropalka

    How to configure a service-ref in the environment?

    m.winkels

      Hi,

       

      I'm building an application that uses both internal and external webservices. This application is based on JAX-WS and is using @WebServiceRef to inject references to webservices. The location of the WSDL for the endoints are configured in th web.xml using a service-ref element. This is working great.

       

      The location of the webservices, however, differs per deployment environment. My question is how to make the endpoint (WSDL) location configurable per location. To me this seems very similar to defining a JDBC or any other resource: The application uses anamed resource that is configured in the container. I'm not finding the functionality to do this in JBoss 7, however.

       

      I have been trying a number of options:

      - Use a system property in the web.xml like  <wsdl-file>${some.property}?wsdl</wsdl-file>. This does not seem to work.

      This doesn't seem to work.

      - Use a jboss-web.xml and do property override there.

      I haven't tried this yet, but looking at the source code that parses the jboss-web.xml I see nothing that will inject system properties

      - Configure the service-ref in Global JNDI.

      According to the spec the mappedName property of the @WebServiceRef annotation should link it to a globally defined resource. I cannot find a way to define global JNDI entries in JBoss AS 7, let alone configure a WebServcice EndPoint.

      - Use jUDDI for web service registration and lookup.

      I'm a little bit hesitant to use another product to connect the dots. Is this the only possible solution?

       

      Can anyone point me in the right direction?

       

      Thanks!

      -Maarten Winkels

        • 1. Re: How to configure a service-ref in the environment?
          ropalka

          Provide jboss-web.xml with the /jboss-web/service-ref/wsdl-override element.

          See the following example:

           

          <jboss-web>

           

                <!-- usecase 1 --> 

                <service-ref>

                  <service-ref-name>service2</service-ref-name>

                  <wsdl-override>WEB-INF/wsdl/Endpoint.wsdl</wsdl-override>

                </service-ref>

           

                <!-- usecase 2 -->

                <service-ref>

                  <service-ref-name>service2</service-ref-name>

                  <wsdl-override>http://foo/bar/Endpoint.wsdl</wsdl-override>

                </service-ref>

           

                <!-- usecase 3 -->

                <service-ref>

                  <service-ref-name>service2</service-ref-name>

                  <wsdl-override>file:///var/data/webapp1/Endpoint.wsdl</wsdl-override>

                </service-ref>

           

          </jboss-web>

          • 2. Re: How to configure a service-ref in the environment?
            m.winkels

            Hi Richard,

             

            Thanks for you answer!

            Maybe my question was not clear enough: Can I change the values in the (jboss-)web-xml for the wsdl-file or wsdl-override elements depending on the environment? If I could inject a system property, that would be just what I'm looking for!

             

            Thanks, -Maarten Winkels

            • 3. Re: How to configure a service-ref in the environment?
              ropalka

              There's no such dynamic approach available