简体   繁体   中英

Unable to overide the wsdl location in apache cxf 2.4.6

i have placed the wsdl files in

E:/testworkspace/projectname/docroot 
                  WEB-INF
                       src
                         com
                           test
                             wsdl

if i give the full path say wsdlLocation = " file:E:/testworkspace/projectname/docroot/WEB- INF/src/com/test/wsdl/some.wsdl " , it picks the WSDL file.

but i need to make generic something like directly fetching:

        @WebServiceClient(name = "TestInterfaceService", 
        wsdlLocation = "WEB-INF/wsdl/some.wsdl",                  
        targetNamespace = "http://www.google.com/job") 

     public class TestInterfaceService extends Service {
     public final static URL WSDL_LOCATION;
     public final static QName SERVICE = new QName("http://www.google.com/job", "TestInterfaceService");
     public final static QName TestInterfaceSoapHttpPort = new QName("http://www.google.com/job", "TestInterfaceSoapHttpPort");
  static {
    URL url = null;
    try {

        url = new URL("WEB-INF/wsdl/some.wsdl");

    } catch (MalformedURLException e) {
        java.util.logging.Logger.getLogger(TestInterfaceService.class.getName())
            .log(java.util.logging.Level.INFO, 
                 "Can not initialize the default wsdl from {0}", "WEB-INF/wsdl/some.wsdl");
    }
    WSDL_LOCATION = url;
}

Can you please suggest how to pick WSDL files independently from that of my local system, currently it throws the error Can not initialize the default wsdl from WEB-INF/wsdl/some.wsdl

You need a valid URL string to be able to create a new URL. If your service does expose the URL, it might be an option to use that.

If your client is a web application, another option is to make the wsdl available via your application and reference it from there using http://localhost/app/some.wsdl

Hope that helps

不确定您要在这里实现什么,配置: wsdlLocation = "WEB-INF/wsdl/some.wsdl"就完全没问题,只要 WSLD 文件在WEB-INF/wsdl ,如果您将 wsdl 放在WEB-INF/src/com/test/wsdl并像这样指定 WSDL 位置: wsdlLocation = "WEB-INF/wsdl/some.wsdl - 当然它不会工作,在WEB-INF/wsdl添加你的 WSDL,一切都会美好的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM