Loading ...
Sorry, an error occurred while loading the content.

AW: [soaplite] Got a Problem in building a WSDLcall in Perl SOAP::Lite from working PHP call...

Expand Messages
  • Martin Busik
    Hi, ... Yepp. It is a good idea to find out, what xml-requests do php and perl generate and then to find out how to manage it to create what s needed. I m a
    Message 1 of 2 , Mar 9 11:06 AM
    • 0 Attachment
      Hi,

      > $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));

      > I know the problem is that carIds array.

      Yepp. It is a good idea to find out, what xml-requests do php and perl
      generate and then to find
      out how to manage it to create what's needed.

      I'm a fan of creating the request on my own, i.e. create an object-tree of
      SOAP::Data-Instances.

      I've used following before - with the PHP built in webservice api. I
      suppose, nusoap.php uses the same (at least you get an idea):

      $SOAPENC_PREFIX =
      $proxy->serializer->find_prefix(SOAP::Constants::URI_SOAP11_ENC());
      $XMLSOAP_PREFIX = $proxy->serializer->find_prefix($SOAP::Constants::NS_APS);
      $client->call('Method',_array($e1,$e2,$e3,...))

      sub _array {
      my ($name,@items) = @_;

      return SOAP::Data->name($name)->type($SOAPENC_PREFIX.":Array")->value(
      \SOAP::Data->value( (map { _item($_) } @items) )
      );
      }

      sub _item {
      my ($value) = @_;

      return _map("item",$value) if ref($value) eq "HASH";
      return _array("item",@$value) if ref($value) eq "ARRAY";
      return SOAP::Data->name("item")->value($value);
      }

      sub _map {
      my ($name,$hash) = @_;

      return SOAP::Data->name($name)->type($XMLSOAP_PREFIX.":Map")->value(
      \SOAP::Data->value(
      map { SOAP::Data->name("item")->value( \SOAP::Data->value(
      SOAP::Data->name("key")->value($_),
      SOAP::Data->name("value")->value($hash->{$_})
      ))
      } keys %$hash
      )
      );
      }

      Array elements might be scalar values, arrays or hasharrays (maps), so it
      should work with following php constructs:

      $e1 = "scalar";
      $e2 = array(1,2,"aaa")
      $e3 = array("a" => 1, "b" => 2)

      Cheers,
      Martin
    Your message has been successfully submitted and would be delivered to recipients shortly.