1 Reply Latest reply on Mar 17, 2010 9:33 AM by skymic

    Webservice behind proxy

    skymic

      Hi,

       

      I am using JBoss-5.1.0_GA with a JRE 1.6.0_17 on a LINUX platform.

       

      I generated serverside and clientside WS code from a WSDL using wsconsume.

       

      I deployed my server on a developement server (no proxy) and the client could access the webservice endpoint fine.

       

      Then I deployed my application in a test environment where the client has to go over a proxy server (Apache with mod_jk using the ajp/1.3 connector).

       

      Now the client cannot reach the WS endpoint and gets a http timeout.

       

      The connectors in jbossweb.sar/server.xml are configured as follows:

       

         <Service name="jboss.web">

            <!-- A HTTP/1.1 Connector on port 8080 -->
            <Connector protocol="HTTP/1.1" port="8099" address="${jboss.bind.address}"
                     connectionTimeout="20000" redirectPort="8443" />


            <!-- Add this option to the connector to avoid problems with
                .NET clients that don't implement HTTP/1.1 correctly
               restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
            -->

            <!-- A AJP 1.3 Connector on port 8009 -->
            <Connector protocol="AJP/1.3" port="8089" address="${jboss.bind.address}"
               redirectPort="8443" />


            <!-- SSL/TLS Connector configuration using the admin devl guide keystore
            <Connector protocol="HTTP/1.1" SSLEnabled="true"
                 port="8443" address="${jboss.bind.address}"
                 scheme="https" secure="true" clientAuth="false"
                 keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
                 keystorePass="rmi+ssl" sslProtocol = "TLS" />
            -->

            <Engine name="jboss.web" defaultHost="localhost" jvmRoute="zhISAta1">

       

      Both the HTTP/1.1 connector and the AJP 1.3 connectors are configured on different ports.

      My application client tries the use the AJP 1.3 connector on Port 8089.

       

      I can access the wsdl in Internet Explorer on the deployed application using the URL http://<Proxy IP address>/WS_Server/services/SDOCustomerInterfacesImpl?wsdl

      The IP address is the IP aaddress of the apache/mod_jk proxy.

      The WSDL content which is shown in the Internet Explorer looks like this:

       

      <?xml version="1.0" encoding="UTF-8" ?>

      - <types>
      - <xs:schema>
      <xs:import namespace="http://types.server.ws.aim.interfaces.skyguide.ch" schemaLocation="http://<Local AppServer IP address>:8099/WS_Server/services/SDOCustomerInterfacesImpl?wsdl&resource=SDO_CustomerInterfaces_WS.xsd" />
      </xs:schema>
      </types>
      ...
      - <service name="SDO_WS">
      - <port binding="tns:SDOCustomerInterfacesBinding" name="SDOCustomerInterfaces">
      <soap:address location="http://<local appServer IP address>:8099/WS_Server/services/SDOCustomerInterfacesImpl" />
      </port>
      </service>
      </definitions>

      The IP address for the schema location and the soap address location in the WSDL were expanded by JBoss to the real IP address

      of the AppServer behind the proxy. The Port which was chosen by JBoss was the Port for the HTTP 1.1 connector and not the Port of AJP 1.3.

       

      From the client side the WS is not accessible neither on this IP address nor on this port.

       

      Could this be the reason that my client cannot access the WS via the Apache /mod_jk proxy?

       

      How can I configure the WS so that it runs behind a proxy?

       

      Thanks for your help.

       

      Michael

        • 1. Re: Webservice behind proxy
          skymic

          Hi,

           

          ok, I have found it.

           

          If one operates a JBossWS endpoint behind a reverse proxy, one must look at the soap:address rewrite of the wsdl.

           

          Everything is covered here: http://community.jboss.org/wiki/JBossWS-UserGuide#Address_rewrite

           

          The file to modify is $JBOSS_HOME/server/all/deployers/jbossws.deployer/META_INF/stack-agnostic-jboss-beans.xml

          Look for the WSServerConfig bean.

           

          Replace

                       <property name="webServiceHost">${jboss.bind.address}</property>
                       <property name="modifySOAPAddress">true</property>

          with

                       <property name="webServiceHost">jbossws.undefined.host</property>
                       <property name="modifySOAPAddress">true</property>

           

          JBoss will now rewrite the soap:address of the wsdl with the address from the client http request.

           

          This solved my problem.