Apache CXF wsdl2java: make service return original WSDL file

巧了我就是萌 提交于 2019-12-11 08:46:51

问题


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:


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);
    }
}


来源:https://stackoverflow.com/questions/29527257/apache-cxf-wsdl2java-make-service-return-original-wsdl-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!