【发布时间】:2011-09-15 10:29:03
【问题描述】:
我在我们自己的 Web 服务器上部署了一个 Web 服务(不是在任何 IIS 或 Tomcat 上) .所以,我只有一个 WSDL 文件和一个 webserver.exe(有 内部实现的服务)。
使用这个 WSDL 文件,我已经在 .net 中开发了一个客户端应用程序 (C#) 运行正常。
现在我必须使用相同的 WSDL 在 JAVA 中创建另一个客户端应用程序。 但我不知道如何进行(我是 JAVA 新手)。具体来说,我有一些 问题继续进行。请参阅我用Java编写的代码sn-p。
trustAllHttpsCertificates();
HttpsURLConnection.setDefaultHostnameVerifier(hv);
QName serviceName = new QName("Sphericall");
URL url = new URL("https","localhost",8085,"/SphericallService");
testthebest.Sphericall_Service service = new testthebest.Sphericall_Service
(url, serviceName);
//service.create(serviceName);
testthebest.Sphericall port = service.getSphericall();
// TODO initialize WS operation arguments here
testthebest.StartSessionRequest value = new testthebest.StartSessionRequest();
在上面的代码段中,我编写了绕过证书检查的代码, 然后进行主机名验证,最后尝试创建对象 服务。
但是在创建对象时,我收到以下异常。 (未找到 WSDL)。 请注意,在代码中,我已经为服务分配了新的 URL。而在 项目我附上了网络参考(WSDL),它保存在我的 机器的 D 盘。所以,它把 URL 当作 D:/xyz.wsdl 但不是 URL 的正确路径,所以我将其更改为“https://localhost: 8085/SphericallService”。但它没有运行..
com.sun.xml.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of
InaccessibleWSDLException.
java.io.FileNotFoundException: https://localhost:8085/SphericallService
java.io.FileNotFoundException: https://localhost:8085/SphericallService?wsdl
正如我所说,我的服务在我们自己开发的网络服务器上,它运行起来就像一个 可执行文件(作为 exe 文件)。并且 wsdl 文件是单独提供的。所以,没有路径 像 wsdl 的“https://localhost:8085/SphericallService?wsdl”一样存在。
如果您对此有任何想法,请提出建议。
【问题讨论】:
标签: java web-services wsdl jax-ws