douou1872 2014-08-08 09:40
浏览 80
已采纳

将长列表参数从php传递给TECDOC Web服务

I am working with project on TECDOC. get known 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 functions getVehicleByIds(), getVehicleByIds2(), getVehicleByIds2StringList() and getVehicleByIdsStringList().

In above functions You will find a carIds field which have datatype as longList (for first two function) or StringList (for other two functions).

Now I while calling this function from PHP I have to pass arguments of this field in lonlList or StringList datatype which is not available in PHP and yes know generally for this task generally php array is used. But it is not working here.

here is 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 documents provided in first link I post. please refer InterfaceCatService.pdf for each function datatype details study.

please help me.

  • 写回答

2条回答 默认 最新

  • dounouxi1020 2014-08-19 10:21
    关注

    I can see the output like below.

    stdClass Object
    (
        [data] => stdClass Object
            (
                [array] => Array
                    (
                    )
    
                [empty] => 1
            )
    
        [status] => 200
        [statusText] => 
    )
    

    Hello Again,

    I have tried with CURL...by using soapclient there is issue with longlist carIds. so we can do with CURL request.

    got the below output.

    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 response using CURL.

    $soap_request  = "<?xml version=\"1.0\"?>
    ";
    $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条)

报告相同问题?

悬赏问题

  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害