简体   繁体   English

jax-ws客户端问题

[英]jax-ws client problem

I have produced a jax-ws client by executing the command: 我通过执行命令生成了一个jax-ws客户端:

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

The service address in the wsdl file is: wsdl文件中的服务地址是:

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. 好吧,我已经将生成的文件打包在jar( clentjaxw.jar )中,并且我在eclipse项目中使用它作为导入的库来进行一些测试。

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: 事实是我能够毫无问题地进行测试,但是当我向同事提供clientjaxw.jar他在执行期间出现以下错误:

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. 我不明白这个问题:然而,同事能够在该地址的浏览器中可视化服务,也就是ping localhost运行。 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. 更新:我必须添加新的细节:我发现同事可以通过浏览器访问: http:// localhost:8585 / active-bpel / services / HealthMobilitySequence?wsdl但是如果他试图访问: http://127.0.0.1:8585/active-bpel/services/HealthMobilitySequence?wsdl或者使用ip地址代替localhost的同一个url,他失败了。 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. 在我的机器上我没有这样的问题我能够访问所有可能:localhost,机器名称,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. 所以我认为这可能是问题,我的意思是我想通过java,url http:// localhost:8585 / active-bpel / services / HealthMobilitySequence在打开java套接字连接之前,在使用ip的新套接字连接中进行翻译地址(或127.0.0.1)代替localhost,访问失败。 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). 所以似乎问题是由于操作系统,因为我们在操作系统中共享完全相同的配置(在我的机器上赢得xp,在他的机器上获得vista)。

Some ideas? 一些想法? Thanks 谢谢


UPDATE: Hi again, for some reason changing the machine (always 64 bit) the collegue has solved the problem I have described. 更新:嗨再次,由于某种原因改变机器(总是64位)同事解决了我描述的问题。 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. 无论如何,他还有另一个问题,它不依赖于客户端,因为他也通过调用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 例外情况如下:java.lang.ClassCastException:com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl无法强制转换为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)

Please take care that the web service he is tring to invoke is that one of a bpel process deployed in an ActiveBPEL (version 5.0.2) running in a Tomcat 5.5.27. 请注意他要调用的Web服务是在Tomcat 5.5.27中运行的ActiveBPEL(版本5.0.2)中部署的bpel进程之一。 Moreover its configuration is the following: OP: windows 7, jdk: 1.6, arch:64 bit while the mine is: OP: windows xp, jdk: 1.6, arch: 32 bit. 此外它的配置如下:OP:windows 7,jdk:1.6,arch:64 bit而mine是:OP:windows xp,jdk:1.6,arch:32 bit。 Have you some idea about the problem? 你对这个问题有所了解吗?

Thanks in advance 提前致谢

I just ran into this issue when building and testing the ActiveBPEL code. 我在构建和测试ActiveBPEL代码时遇到了这个问题。 My solution was to explicitly map the java.xml.soap.MessageFactory to the Axis implementation. 我的解决方案是将java.xml.soap.MessageFactory显式映射到Axis实现。 This avoids the incompatibilities between the two SOAP stacks. 这避免了两个SOAP堆栈之间的不兼容性。

The mapping can be done a couple of different ways. 映射可以通过几种不同的方式完成。

  1. Use a system property -Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl 使用系统属性-Djavax.xml.soap.MessageFactory = org.apache.axis.soap.MessageFactoryImpl
  2. Include a factory file on the classpath: /META-INF/javax.xml.soap.MessageFactory where the contents of this file is a single line of text: org.apache.axis.soap.MessageFactoryImpl 在类路径中包含一个工厂文件:/META-INF/javax.xml.soap.MessageFactory,其中此文件的内容是单行文本:org.apache.axis.soap.MessageFactoryImpl

If you're building the AE source then the latter is the preferred mechanism and could be added to the org.activebpel.rt.axis.bpel project. 如果您正在构建AE源,则后者是首选机制,可以添加到org.activebpel.rt.axis.bpel项目中。 If you're using the binaries, then you'll likely need to create a custom property on the startup script for your container (Tomcat/Jetty). 如果您正在使用二进制文件,那么您可能需要在容器的启动脚本(Tomcat / Jetty)上创建自定义属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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