Eu estou um pouco preso. Eu uso o SOAP :: Lite e ele retorna um resultado vazio.
Usando o modo de depuração, vejo que a solicitação foi bem-sucedida. Onde está o meu erro?
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 imprime:
$VAR1 = "0";
Quando ligo o modo de depuração
use SOAP::Lite +trace => "debug";
, Eu recebo:
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...]
Você pode me dizer onde estou perdendo?
desde já, obrigado
Respostas:
0 para resposta № 1A maneira recomendada é criar classes desta maneira: http://metacpan.org/pod/SOAP::WSDL::Manual
Você poderia usar SOAP :: WSDL para fazer isso:
my $soap = SOAP::WSDL->new(
wsdl => "http://produktdaten.xxx.net/soapschemes/EAN.wsdl",
);
my $result = $soap->call("MyMethod", %data);