Apache CXF wsdl2java: make service return original

2019-08-05 18:52发布

I am struggling big time offering a web service based on some WSDL file received from a customer. As described in details here, the WSDL file returned when appending a ?wsdl to the service URL like

http://never.mind/SomeService?wsdl

seems to be misinterpreted by SoapUI and this again prevents the customer from using the service!

I was now hoping that someone could help me understand if it is possible to make the get WSDL endpoint return the original WSDL file instead of some Apache CXF digested version?

Update: I just read somewhere that there is a WSDLGetInterceptor taking care of the get WSDL requests - can I maybe override that one?

1条回答
一纸荒年 Trace。
2楼-- · 2019-08-05 19:33

I chose to override the getDocument method of the WSDLGetUtils class being used by the WSDLGetInterceptor. My version of the utils class MyWSDLGetUtilsis put into action via this interceptor:

public class WsdlGetSoapInterceptor extends AbstractSoapInterceptor {
    public WsdlGetSoapInterceptor() {
        super(Phase.READ);
        addBefore(WSDLGetInterceptor.class.getName());
    }

    /** {@inheritDoc} */
    @Override
    public void handleMessage(final SoapMessage message) throws Fault {
        message.setContextualProperty(WSDLGetUtils.class.getName(), MyWSDLGetUtils.Instance);
    }
}
查看更多
登录 后发表回答