我有点卡住了。我使用SOAP :: Lite并返回一个空结果。
使用调试模式,我看到请求成功。 我的错误在哪里?
use Data::Dumper;
use Encode;
use SOAP::Lite;
my $user="username";
my $password="password";
my $ean = '1234567890123'
my $service_url='http://produktdaten.xxx.net/soapschemes/EAN.wsdl';
my $client = SOAP::Lite->service($service_url);
$client->soapversion('1.2');
$client->envprefix('soap12');
my @headers = (
SOAP::Header->name('PID')->value($user),
SOAP::Header->name('password')->value($password) );
# make the call
my $result = $client->getProductsByEAN($user,$password,$ean);
print Dumper($result);
$ result打印出来:
$VAR1 = '0';
当我打开调试模式时
use SOAP::Lite +trace => 'debug';
,我明白了:
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Sun, 30 Jun 2013 11:27:26 GMT
Pragma: no-cache
Server: nginx/1.4.0
Content-Length: 4447
Content-Type: application/soap+xml; charset=utf-8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Client-Date: Sun, 30 Jun 2013 11:36:15 GMT
Client-Peer: x.x.x.x.x:80
Client-Response-Num: 1
Set-Cookie: xxx_CORE=344gb3h94nlmob7am9bmv3pv40; path=/
X-Powered-By: PHP/5.4.15
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:xmethodsProductDataService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><ns1:getProductsByEANResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">7{......AND SO ON...]
你能告诉我我缺少的地方吗?
提前致谢
答案 0 :(得分:0)
推荐的方法是以这种方式创建类:http://metacpan.org/pod/SOAP::WSDL::Manual
您可以使用SOAP::WSDL执行此操作:
my $soap = SOAP::WSDL->new(
wsdl => 'http://produktdaten.xxx.net/soapschemes/EAN.wsdl',
);
my $result = $soap->call('MyMethod', %data);