Chinaunix首页 | 论坛 | 博客
  • 博客访问: 16428
  • 博文数量: 4
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 30
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-11 11:24
文章分类

全部博文(4)

文章存档

2015年(4)

我的朋友

分类: LINUX

2015-04-30 16:29:24

这件事主要是我一个同事在开发,我主要是配合做了一下环境安装。
总结一下经验教训吧。
首先,我们是在suse linux下实验的,以前这个环境上安装过soap::lite,但是访问https那个wsdl文件提示500错。
使用yast2安装perl-Net-SSLeay和perl-IO-Socket-SSL,不知道为什么使用cpan安装的话,总是报编译错误。
这里有一个教训,不要动openssl,否则会导致ssh服务的崩溃,我们是在虚拟机环境上,所以没有造成问题,万幸。
然后按cpan上的提示开发soap应用,问题来了,在一个win环境上测试时好时坏,在suse的环境上测试一直连接不通,憋了一天。
后来想到soap::lite可以开日志:use SOAP::Lite +debug;

use SOAP::Lite +trace;
实际上使用是use SOAP::Lite +trace=>debug;
这样可以看到client发出的包和接收到的包,在两个环境上把测试的结果比了一下,发现了一些问题,直接google如下:

created a webservice client in Perl using SOAP::Lite.
I manage to invoke a method of my webservice quite easily, but for some unknown reasons, it works sometimes, and sometimes it won't work.
Here's my perl client code :
my $client = SOAP::Lite->uri("")
->service("");
my $res;
do {
sleep(2);
print ("ok \n");
$res = $client->sendData($data);
}while(!defined $res);
print $res, "\n";
I tried to add a while loop to resend the data if the result is undefined, but it won't work.
After some analysis of SOAP::Lite trace log file, I found that during the request, one parameter changes.
Here's the correct xml soap request :

xmlns:mime="" xmlns:ns="" xmlns:ns1="" xmlns:soap="" xmlns:soap12="" xmlns:soapenc="" xmlns:wsaw="" xmlns:wsdl="" xmlns:xs="" xmlns:xsi="">


PD94bWwgdmVyc2lvbj0



And the correct answer :




1



And here's the faulty xml request :

xmlns:mime="" xmlns:ns="" xmlns:ns1="" xmlns:soap="" xmlns:soap12="" xmlns:soapenc="" xmlns:wsaw="" xmlns:wsdl="" xmlns:xs="" xmlns:xsi="">


PD94bWwgdmVyc2lvbj0



With the answer :

xmlns:soapenv="">





soapenv:VersionMismatch
Only SOAP 1.1 or SOAP 1.2 messages are supported in the system




As you can see, xmlns:soap hasn't got the same value in the correct and the faulty request : for the correct one, it is :
""
And for the faulty one, it is :
""
Any ideas why SOAP::Lite is changing this parameter on it's own ?
perl soap axis2 xmlns soaplite
share|improve this question edited Jun 6 '14 at 9:18
asked Jun 5 '14 at 16:02
Hawknight
accepted  The problem comes from the way namespaces are handled in SOAP::Lite. See this issue on RT cpan. Axis 2 was generating a wsdl which was then parsed by SOAP::Lite, and the value of xmlns:soap from the hash, set by the SOAP::Lite::Serializer, was wrongly being modified by the parsing of the wsdl.
To solve this problem, use this at the very begining of your code (before setting the wsdl in SOAP::Lite) :
$SOAP::Constants::PREFIX_ENV = 'SOAP-ENV';
关键就在最后这一部分,注意红色部分是成功和失败不同的报文,使用最后一句解决了问题,实际上我也不知道这句意思,原因更不用说了,见上文,其中我们还使用了soapui测试和这个结果一样。改了之后就好了,全部报错都没有了。

阅读(2580) | 评论(0) | 转发(0) |
0

上一篇:suse+boost::graph

下一篇:没有了

给主人留下些什么吧!~~