23 Nisan 2021 Cuma

JAX-WS Reverse Proxy Wrong URL in WSDL (Apache & Nginx)

Environment:

  • Payara Application Server (4.x, 5.x or Glassfish)
  • Apache 2.4 Http Server as Reverse Proxy
  • Reverse Proxy is HTTPS
  • Application server is HTTP

  • Update as 23.04.2021 - Nginx Reverse Proxy scenerio has been added
Symptoms:
  • Wsdl Location Is: https://myapp.mydomain.com/MyApp/MyWebService?WSDL
  • JAX-WS generated WSDL shows invalid URL:
<xsd:import namespace="http://myapp.ws.mydomain.com/"schemaLocation="http://myapp.mydomain.com:80/MyApp/MyWebService?xsd=1"/>

<soap:address location="http://myapp.mydomain.com:80/MyApp/MyWebService"/>


  • Generated URL is not https which causes bad request error

Solution:

  • Set virtual host server name with your domain name in payara (glassfish) admin console.
  • Activate mod_substitute for apache.
  • In apache virtual conf add Substitution for new url:

<Location "/mergenTechKampusWSIstemci">
    AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/xml
    Substitute "s|http://myapp.mydomain.com:80/|https://myapp.mydomain.com/|ni"
</Location>
  • Restart apache:

  • For nginx
  • Use substitions : https://www.nginx.com/resources/wiki/modules/substitutions/
  • Edit site config
location /mergenTechKampusWSIstemci {
    subs_filter_types text/xml
    subs_filter    http://myapp.mydomain.com:80/ https://myapp.mydomain.com/
}
<xsd:import namespace="http://myapp.ws.mydomain.com/"schemaLocation="https://myapp.mydomain.com/MyApp/MyWebService?xsd=1"/>

<soap:address location="https://myapp.mydomain.com/MyApp/MyWebService"/>

Hiç yorum yok:

Yorum Gönder