【发布时间】:2012-03-14 15:37:44
【问题描述】:
我正在使用 CXF 与 WCF 中的 WSDL 进行通信。 WCF 方面是在 tutorial 之后创建的。 Java 代码是使用 Maven 脚本生成的。
我已经使用 HTTPS 进行加密了。我已经进行了身份验证。但是,我希望在 WCF 端关闭 WSDL 元数据,并且仍然能够使用 Java 端与服务通信。
目前,我可以使用以下代码从 Java 端访问带有元数据发布的服务:
URL wsdlLocation = new URL("https://server.com:7010/Hservice?wsdl");
HttpsURLConnection connection = (HttpsURLConnection) wsdlLocation.openConnection();
HService service = new HService(wsdlLocation);
HAdminService calc = service.getHAdminService();
... (authentication using WSS4JOutInterceptor code and unrelated code here)
System.out.println(calc.add(new Double(5), new Double(5)));
但是,当我在 WCF 端关闭元数据发布时,我收到此错误:
Exception in thread "main" javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
at javax.xml.ws.Service.<init>(Service.java:56)
at com.blah.hservice.v_1_0.HService.<init>(HService.java:49)
at Main.main(Main.java:85)`
wsdl 所在的页面在元数据发布关闭的情况下显示此内容(这是摘录):
This is a Windows© Communication Foundation service.
Metadata publishing for this service is currently disabled.
If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:
我希望能够搜索“未发布的 CXF 元数据”并看到很多人这样做......但没有找到任何东西。如何在不发布 WSDL 的情况下与此服务通信?
【问题讨论】: