0

我有点卡住了。我使用 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...]

你能告诉我我错过了什么吗?

提前致谢

4

1 回答 1

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);
于 2013-07-01T14:04:37.990 回答