我有HTTPS Web服务。我可以使用wsimport生成Java类,但是在调用服务时收到以下异常:com.sun.xml.internal.ws.client.ClientTransportException:HTTP传输错误:java.net.UnknownHostException:abc.xyz.ca.com在com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:208)在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)在com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:124)在com.sun.xml.internal.ws.api.pipe.Fiber .__ doRun(Fiber.java:1121)在com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)在com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)在com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)在com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)在com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)在com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)在com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)在com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)在com.sun.proxy。$ Proxy33.query(未知来源)在com.westpac.idm.clarityuserprovisioning.MainClass.main(MainClass.java:29)引起原因:java.net.UnknownHostException:cppm6002-dev.ondemand.ca.com在java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)在java.net.Socket.connect(Socket.java:606)在sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)在sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)在sun.net.NetworkClient.doConnect(NetworkClient.java:180)在sun.net.www.http.HttpClient.openServer(HttpClient.java:463)在sun.net.www.http.HttpClient.openServer(HttpClient.java:558)在sun.net.www.protocol.https.HttpsClient。(HttpsClient.java:264)在sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)在sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)在sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1205)在sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)在sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)在sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)在sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)在sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)在com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:104)
我调用服务的类是这样的:public static void main(String[] args) {
try {
Auth auth = new Auth();
auth.setUsername("username");
auth.setPassword("password");
WbcActiveUsersQuery query_code = new WbcActiveUsersQuery();
query_code.setCode("wbc_active_users");
WbcActiveUsersQueryService service = new WbcActiveUsersQueryService();
WbcActiveUsersQueryPort port = service.getWbcActiveUsersQueryService();
WbcActiveUsersQueryResult result = port.query(query_code, auth);
}catch(Exception e) {
e.printStackTrace();
}
}
我尝试使用SoapUI调用Web服务,该服务在那儿工作正常。
任何人都可以帮忙。预先谢谢你。