I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-03-07 09:45:32.512805-08 by olli
Need help for rebuilding a working PHP WSDL-Call in Perl using SOAP::Lite
Hey folks,
there is a good working PHP WSDL call-example which I want to redo in Perl using SOAP::Lite. My other calls built in Perl work very well, but that silly one won't. I'm working so so long on it without result... Hope someone can help me :)

These scripts shall get some informations about the given carIds, e.g. number of cylinders etc.


At first that working PHP example:
<?php require_once('lib/nusoap.php'); $client = new nusoap_client('http://webservicepilot.tecdoc.net/pegasus-2-0/wsdl/TecdocToCat',true); $client->soap_defencoding = 'UTF-8'; $providerid = 555; //(555 won't work...) $paramneu = array('provider'=>$providerid, 'axles' => true, 'cabs' => true, 'carIds' => array('empty' => false , 'array' => array(19016)), 'countriesCarSelection' => de, 'country'=>de, 'countryGroupFlag'=>false, 'countryUserSetting'=>de, 'motorCodes'=>true, 'secondaryTypes'=>true, 'vehicleDetails2'=>true, 'vehicleTerms'=>true, 'wheelbases'=>true, 'lang'=>de ); // set request $result = $client->call('getVehicleByIds2', array('in0' => $paramneu)); if ($client->fault) { echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>'; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { // show the informations echo '<h2>Results:</h2><pre >'; print_r($result); echo '</pre>'; } } unset($client); ?>


...and now my poor Perl plagiate:
#!/usr/bin/perl -w #!/usr/bin/composite use CGI::Carp 'fatalsToBrowser'; use SOAP::Lite; use Data::Dumper; use warnings; print "Content-type: text/html \n\n"; my $soap = SOAP::Lite -> uri('http://webservicepilot.tecdoc.net/pegasus-2-0/wsdl/TecdocToCat') -> proxy('http://webservicepilot.tecdoc.net/pegasus-2-0/services/TecdocToCat'); $providerid = 555; #(555 won't work...) my $som = $soap->getVehicleByIds2( { axles => true, cabs => true, carIds => \( empty => false, array => [19016] ), country => "de", countriesCarSelection => "de", countryGroupFlag => false, countryUserSetting => false, lang => "de", motorCodes => true, provider => $providerid, secondaryTypes => true, vehicleDetails2 => true, vehicleTerms => true, wheelbases => true }); if ($som->fault) { print $som->faultstring; } else { my $soap_result = $som->result; print Dumper $soap_result; }


I know the problem is that carIds array. First I tried just to send my one ID 19016 as a simple integer / long. Then i got that PHP example and saw that there has to be an array, with as its first entry an element "empty" which is 'false' to say there will follow some entries. Next one is the element "array" with an array of carIds (in my case there is only one carID). It is said that this is described in the service, but there they only say a LongList is needed:
<element name="carIds" nillable="true" type="tns1:LongList"/>
(Taken from http://webservicepilot.tecdoc.net/pegasus-2-0/wsdl/TecdocToCatWL)

So how can I rebuild that needed array(s) so that this call will be successful?
Hope somebody can help me... Please :)

All the best
Olli
Direct Responses: Write a response