gpt4 book ai didi

java - jax-ws客户端问题

转载 作者:搜寻专家 更新时间:2023-11-01 03:44:00 26 4
gpt4 key购买 nike

我通过执行以下命令生成了一个 jax-ws 客户端:

C:\wsdl>wsimport -keep -verbose -d generated HealthMobilitySequenceArtifacts.wsdl

The service address in the wsdl file is:

    soap:address location="http://localhost:8585/active-bpel/services/HealthMobilitySequence

Well, I have packaged the generated files in a jar (clentjaxw.jar) and I'm using it, as imported library, in an eclipse project to make some tests.

The fact is that I'm able to make my tests without problems but when I provide a collegue the clientjaxw.jar he has the following error during the execution:

    Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect        at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(Unknown Source)        at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)        at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)        at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)        at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)        at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)        at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)        at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)        at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)        at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)        at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)        at $Proxy29.bookTreatment(Unknown Source)        at test.TestJaxWS.main(TestJaxWS.java:32)    Caused by: java.net.ConnectException: Connection refused: connect        at java.net.PlainSocketImpl.socketConnect(Native Method)        at java.net.PlainSocketImpl.doConnect(Unknown Source)        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)        at java.net.PlainSocketImpl.connect(Unknown Source)        at java.net.SocksSocketImpl.connect(Unknown Source)        at java.net.Socket.connect(Unknown Source)        at java.net.Socket.connect(Unknown Source)        at sun.net.NetworkClient.doConnect(Unknown Source)        at sun.net.www.http.HttpClient.openServer(Unknown Source)        at sun.net.www.http.HttpClient.openServer(Unknown Source)        at sun.net.www.http.HttpClient.(Unknown Source)        at sun.net.www.http.HttpClient.New(Unknown Source)        at sun.net.www.http.HttpClient.New(Unknown Source)        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)        ... 15 more

I don't understand the problem: nevertheless the collegue is able to visualize the service in the browser at that address an also the ping localhost runs. Moreover I have checked he is not behind a proxy.

Have you some ideas about the cause of the problem?


UPDATE:I have to add new details: I have discovered that the collegue is able to access, via browser, to: http://localhost:8585/active-bpel/services/HealthMobilitySequence?wsdl but if he tries to access to:http://127.0.0.1:8585/active-bpel/services/HealthMobilitySequence?wsdl or to the same url with the ip address in place of localhost he fails. On my machine I don't have such problem I'm able to access with all possibilities: localhost, machine name, 127.0.0.1, ipaddress.

So I think this could be the problem I mean I immagine that via java, the url http://localhost:8585/active-bpel/services/HealthMobilitySequence is translated, before opening a java socket connection, in a new one using the ip address (or 127.0.0.1) in place of localhost and the access fails. So it seems that the problem is due to the operative system since we share exactly the same configuration a part the operative system (win xp on my machine, vista on his one).

Some ideas? Thanks


UPDATE: Hi again, for some reason changing the machine (always 64 bit) the collegue has solved the problem I have described. Anyway he has another problem which does not depend from the client since he has experienced the same also by invoking using eclipse web explorer.The exception is the following:java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl cannot be cast to java.lang.String

    org.apache.axis.SOAPPart.getAsString(SOAPPart.java:554)

org.apache.axis.SOAPPart.writeTo(SOAPPart.java:322)

org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)

org.apache.axis.Message.writeTo(Message.java:539)

org.apache.axis.transport.http.AxisServlet.sendResponse(AxisServlet.java:902)

org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:777)

javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)

javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

请注意他要调用的 Web 服务是部署在 ActiveBPEL(版本 5.0.2)中的一个 bpel 进程,该进程在 Tomcat 5.5.27 中运行。而且它的配置如下:OP:windows 7,jdk:1.6,arch:64位而我的是:OP:windows xp,jdk:1.6,arch:32位。你对这个问题有什么想法吗?

提前致谢

最佳答案

我刚刚在构建和测试 ActiveBPEL 代码时遇到了这个问题。我的解决方案是将 java.xml.soap.MessageFactory 显式映射到 Axis 实现。这避免了两个 SOAP 堆栈之间的不兼容性。

映射可以通过几种不同的方式完成。

  1. 使用系统属性 -Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
  2. 在类路径中包含一个工厂文件:/META-INF/javax.xml.soap.MessageFactory,其中该文件的内容是一行文本:org.apache.axis.soap.MessageFactoryImpl

如果您正在构建 AE 源,那么后者是首选机制,可以添加到 org.activebpel.rt.axis.bpel 项目中。如果您使用的是二进制文件,那么您可能需要在容器 (Tomcat/Jetty) 的启动脚本上创建自定义属性。

关于java - jax-ws客户端问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7228224/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com