Skip longList argument for TECDOC web service from php

I am working on a TECDOC project. learn about TECDOC http://webservicepilot.tecdoc.net/pegasus-2-0/ here.

So on this page http://webservicepilot.tecdoc.net/pegasus-2-0/test2/index.html in the dropdown menu you will find the functions getVehicleByIds () , getVehicleByIds2 () , getVehicleByIds2StringList () and getVehicleByIds .StringList () and getVehicleByIds .

In the above functions, you will find the carIds field , which is of datatype like longList (for the first two functions) or StringList (for the other two functions).

Now when I call this function from PHP I need to pass the arguments of this field to datatype lonlList or StringList which is not available in PHP and, you know, usually php array is usually used for this task. But he doesn't work here.

here is the code ...

<?php
$url ="http://webservicepilot.tecdoc.net/pegasus-2-0/wsdl/TecdocToCat";
$trace = array('trace' => 1);
$client = new SoapClient($url, $trace);
$request_array = array(
                        'country'=>'pt',
                        'countryUserSetting'=>'CH',
                        'lang'=>'pt',
                        'motorCodes'=>true,
                        'provider'=>'452',
                        'vehicleTerms'=>true,
                        'carIds'=>1116,
                        'passengerCarDetails'=>true
                    );
echo "<pre>";
    $responce = $client->getVehicleByIds($request_array);

print_r($responce);

?>

      

Note: there are some docs provided in the first link I post. refer to InterfaceCatService.pdf for each detailed data type data exploration.

Please help me.

+3


source to share


2 answers


I see the result as shown below.

stdClass Object
(
    [data] => stdClass Object
        (
            [array] => Array
                (
                )

            [empty] => 1
        )

    [status] => 200
    [statusText] => 
)

      

Hello again,

I tried with CURL ... using soapclient, problem with longlist carIds. so we can do with a CURL request.

got the following result.

Array ([data] => Array ([array] => Array ([array] => Array ([0] => Array ([carId] => 1116 [motorCodes]] => Array ([array] => Array ( [array] => Array ([motorCode] => DZ)

                                            )

                                        [empty] => false
                                    )

                                [passengerCarDetails] => Array
                                    (
                                        [brakeSystem] => Hidráulico
                                        [constructionType] => três volumes
                                        [cylinder] => 4
                                        [cylinderCapacityCcm] => 1781
                                        [cylinderCapacityLiter] => 180
                                        [fuelType] => Gasolina
                                        [fuelTypeProcess] => Injecção no colector de admissão/carburador
                                        [impulsionType] => Tracção dianteira
                                        [manuName] => AUDI
                                        [modelName] => 80 (89, 89Q, 8A, B3)
                                        [motorType] => Otto
                                        [powerHP] => 112
                                        [powerKW] => 82
                                        [typeName] => 1.8 E
                                        [typeNumber] => 1116
                                        [valves] => 2
                                        [yearOfConstructionFrom] => 198606
                                        [yearOfConstructionTo] => 199108
                                    )

                                [vehicleDetails] => Array
                                    (
                                        [axisConfiguration] => Array
                                            (
                                                [@value] => 
                                                [@attributes] => Array
                                                    (
                                                        [nil] => true
                                                    )

                                            )

                                        [carId] => 1116
                                        [ccmTech] => 1781
                                        [constructionType] => três volumes
                                        [manuId] => 5
                                        [modId] => 31
                                        [powerHpFrom] => 112
                                        [powerHpTo] => 112
                                        [powerKwFrom] => 82
                                        [powerKwTo] => 82
                                        [tonnage] => Array
                                            (
                                                [@value] => 
                                                [@attributes] => Array
                                                    (
                                                        [nil] => true
                                                    )

                                            )

                                        [yearOfConstrFrom] => 198606
                                        [yearOfConstrTo] => 199108
                                    )

                                [vehicleTerms] => Array
                                    (
                                        [carId] => 1116
                                        [carType] => 1.8 E
                                        [manuId] => 5
                                        [manuName] => AUDI
                                        [modId] => 31
                                        [modelName] => 80 (89, 89Q, 8A, B3)
                                    )

                            )

                        [1] => Array
                            (
                                [carId] => 1117
                                [motorCodes] => Array
                                    (
                                        [array] => Array
                                            (
                                                [array] => Array
                                                    (
                                                        [motorCode] => SD
                                                    )

                                            )

                                        [empty] => false
                                    )

                                [passengerCarDetails] => Array
                                    (
                                        [brakeSystem] => Hidráulico
                                        [constructionType] => três volumes
                                        [cylinder] => 4
                                        [cylinderCapacityCcm] => 1847
                                        [cylinderCapacityLiter] => 180
                                        [fuelType] => Gasolina
                                        [fuelTypeProcess] => Injecção no colector de admissão/carburador
                                        [impulsionType] => Tracção dianteira
                                        [manuName] => AUDI
                                        [modelName] => 80 (89, 89Q, 8A, B3)
                                        [motorType] => Otto
                                        [powerHP] => 113
                                        [powerKW] => 83
                                        [typeName] => 1.8
                                        [typeNumber] => 1117
                                        [valves] => 2
                                        [yearOfConstructionFrom] => 198609
                                        [yearOfConstructionTo] => 198807
                                    )

                                [vehicleDetails] => Array
                                    (
                                        [axisConfiguration] => Array
                                            (
                                                [@value] => 
                                                [@attributes] => Array
                                                    (
                                                        [nil] => true
                                                    )

                                            )

                                        [carId] => 1117
                                        [ccmTech] => 1847
                                        [constructionType] => três volumes
                                        [manuId] => 5
                                        [modId] => 31
                                        [powerHpFrom] => 113
                                        [powerHpTo] => 113
                                        [powerKwFrom] => 83
                                        [powerKwTo] => 83
                                        [tonnage] => Array
                                            (
                                                [@value] => 
                                                [@attributes] => Array
                                                    (
                                                        [nil] => true
                                                    )

                                            )

                                        [yearOfConstrFrom] => 198609
                                        [yearOfConstrTo] => 198807
                                    )

                                [vehicleTerms] => Array
                                    (
                                        [carId] => 1117
                                        [carType] => 1.8
                                        [manuId] => 5
                                        [manuName] => AUDI
                                        [modId] => 31
                                        [modelName] => 80 (89, 89Q, 8A, B3)
                                    )

                            )

                    )

            )

        [empty] => false
    )

      



)

Below is the code to get the response using CURL.

$soap_request  = "<?xml version=\"1.0\"?>\n";
$soap_request .= '<soapenv:Envelope     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://path-    to/schemas" xmlns:urn="urn:axis.server.cat.tecdoc.net"     xmlns:car="http://carselection.datatype.tocinterface.cat.tecdoc.net"     xmlns:dat="http://datatype.cat.tecdoc.net"     xmlns:tec="http://webservicepilot.tecdoc.net/pegasus-2-0/services/TecdocToCatWL">
<soapenv:Header/>
<soapenv:Body>
<urn:getVehicleByIds>
     <urn:in0>
        <car:carIds>
           <dat:array>
              <tec:item>1116</tec:item>
              <tec:item>1117</tec:item>
           </dat:array>
        </car:carIds>
        <car:country>pt</car:country>
        <car:countryUserSetting>CH</car:countryUserSetting>
        <car:lang>pt</car:lang>
        <car:motorCodes>true</car:motorCodes>
        <car:passengerCarDetails>true</car:passengerCarDetails>
        <car:provider>292</car:provider>
        <car:vehicleTerms>true</car:vehicleTerms>
</urn:in0>
</urn:getVehicleByIds>
</soapenv:Body>
</soapenv:Envelope>';

$header = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: \"run\"",
"Content-length: ".strlen($soap_request),

      

);

$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, "http://webservicepilot.tecdoc.net/pegasus-2-    0/services/TecdocToCatWL?wsdl" );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT,        10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST,           true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);
curl_setopt($soap_do, CURLOPT_PROXY, IF_ANY);

$result = curl_exec($soap_do);

      

Thanks, Gaurang

+1


source


you need to convert the array to tecdoc list type.

However, it is very easy to make an object stdClass

with two fields.

empty

and array

set empty

to false and array

into the carIds array, for example



$carIds = array(1116);
$obj = new stdClass();
$obj->empty = false;
$obj->array = $carIds;

      

now pass $ obj in the soap query parameter list

$request_array = array(

                    'country'=>'pt',
                    'countryUserSetting'=>'CH',
                    'lang'=>'pt',
                    'motorCodes'=>true,
                    'provider'=>'292',
                    'vehicleTerms'=>true,
                    'carIds'=> $obj,
                    'passengerCarDetails'=>true
                );

      

better to make a function that converts array to structure above object, flag empty

will be set to true if array

null or empty

0


source







All Articles