Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JAX-WS服务在Perl查询时返回SOAP错误';s SOAP::Lite模块_Java_Perl_Soap_Jax Ws - Fatal编程技术网

Java JAX-WS服务在Perl查询时返回SOAP错误';s SOAP::Lite模块

Java JAX-WS服务在Perl查询时返回SOAP错误';s SOAP::Lite模块,java,perl,soap,jax-ws,Java,Perl,Soap,Jax Ws,我有一个简单的Java服务来获取当前时间 我编写了一个Perl客户端来访问它 #! /usr/bin/perl -w use SOAP::Lite; my $url = 'http://127.0.0.1:9876/ts?wsdl'; my $service = SOAP::Lite->service($url)->soapversion('1.1'); print "\nCurrent time is: ", $service->getTimeAsString(); pri

我有一个简单的Java服务来获取当前时间

我编写了一个Perl客户端来访问它

#! /usr/bin/perl -w
use SOAP::Lite;
my $url = 'http://127.0.0.1:9876/ts?wsdl';
my $service = SOAP::Lite->service($url)->soapversion('1.1');

print "\nCurrent time is: ", $service->getTimeAsString();
print "\nElapsed milliseconds from the epoch: ", $service->getTimeAsElapsed();
一旦客户机发出调用(也在同一台机器上),服务就会在下面记录异常,并向客户机返回一个SOAP错误,而不是预期的响应

Nov 05, 2011 11:20:34 AM com.sun.xml.internal.ws.transport.http.HttpAdapter$Http Toolkit handle
SEVERE: Couldn't create SOAP message. Expecting Envelope in namespace http://sch
emas.xmlsoap.org/soap/envelope/, but got http://schemas.xmlsoap.org/wsdl/soap/
com.sun.xml.internal.ws.protocol.soap.VersionMismatchException: Couldn't create
SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/en
velope/, but got http://schemas.xmlsoap.org/wsdl/soap/
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCod ec.java:167)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCod ec.java:292)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCod ec.java:118)
at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:343)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:321)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.access$400(HttpAdapter.java:81)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:576)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:665)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:637)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

知道为什么吗?

您的客户机Python正在以Java Web服务所期望的不同格式发送XML。为了了解真正发送给客户的是什么,我建议您使用以下工具

它将允许您检查发送的XML,并根据需要对其进行修改。下面是一个关于如何使用TcpMon的教程


有点晚了,但对于其他所有遇到此问题的人来说,问题在于SOAP::Lite盲目地从WSDL文件导入名称空间,并根据其中使用的前缀(包括它用来发送SOAP信封本身的名称空间)覆盖它自己的名称空间

解决方案是使用envprefix方法使其对SOAP信封使用不同的名称空间前缀。例如:

my$service=SOAP::Lite->service($url)->soapversion('1.1')->envprefix('S')