开发者

wsdl bad url generation behind nginx haproxy

I am currently developing a webservice using jax-ws based on an EJB behind a nginx ssl offloader and a haproxy for the load balancing like :

@WebService()
@RolesAllowed("allowedOne")
@Stateless()
public class Account
{
    @WebMethod(operationName = "register")
    public RegisterOutTo register(
        @WebParam(name = "registerInTo") RegisterInTo RegisterInTo)
    {
        // do some stuffs
    }
}

https => http => WSDL generation => http => https

jax-ws doesn't seems to take care of x-forwarded-proto to generate the WSDL :

<xsd:import namespace="http开发者_StackOverflow中文版://services/" schemaLocation="http://myprodserver.com:80/Services/Account?xsd=1" />

and

<soap:address location="http://myprodserver.com:80/Services/Account"/>

Of course, the clients can't find the xsd and the requests fails.

Is there something I miss.

Some help would be greatly appreciated.


We finally get through the problem patching the HttpAdapter class from the package com.sun.xml.ws.transport.http and repacking it onto the glassfish/modules/webservices-osgi.jar

We now detect if the x-forwarded-proto is set to https then replacing http by https into the final address and removing the port if necessary.


Also had to do this. Unfortunately you need to replace a glassfish (Version 5) module file:

glassfish/modules/webservices-osgi.jar

To do this clone https://github.com/javaee/metro-jax-ws and modify the file

jaxws-ri/servlet/src/main/java/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java

Apply this patch: https://pastebin.com/HUcWNTJ6

The Header "X-Forwarded-Proto" will be parsed and used as the URL scheme. Final step is to replace the compiled .class file of ServletConnectionImpl in the webservices-osgi.jar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜