在变量PHP中获取SOAP响应数据

时间:2014-10-24 14:12:44

标签: php web-services soap wsdl

我不熟悉PHP中的SOAP和XML。我使用WSDL处理的SOAP有以下结果,现在希望将变量中的响应数据发送到数据库并使用它进行进一步处理。尝试了所有可能的排列和组合

使用以下内容从服务器获取信息。

$request = $client->__soapCall("<function Name>", $args);

以下是从服务器收到的回复

array (size=10)
  'pWeoMotPolicyIn_inout' => 
    object(stdClass)[2]
      public 'vehicleTypeCode' => string '22' (length=2)
      public 'vehicleSubtype' => string 'LXI' (length=3)
      public 'elecAccTotal' => string '0' (length=1)
      public 'addLoadingOn' => string '0' (length=1)
      public 'nonElecAccTotal' => string '0' (length=1)
      public 'polType' => string '3' (length=1)
      public 'registrationNo' => string '<some value>' (length=10)
      public 'partnerType' => string 'p' (length=1)
      public 'ncb' => string '20' (length=2)
      public 'prvClaimStatus' => string '0' (length=1)
      public 'registrationDate' => string '19-Oct-2013' (length=11)
      public 'miscVehType' => string '0' (length=1)
      public 'fuel' => string 'P' (length=1)
      public 'chassisNo' => string 'ABCD' (length=6)
      public 'contractId' => string '0' (length=1)
      public 'yearManf' => string '2013' (length=4)
      public 'spDiscRate' => string '0' (length=1)
      public 'cubicCapacity' => string '1298' (length=4)
      public 'regiLocOther' => string '<some value>' (length=5)
      public 'addLoading' => string '0' (length=1)
      public 'vehicleSubtypeCode' => string '21' (length=2)
      public 'prvPolicyRef' => string '123123123' (length=9)
      public 'vehicleMake' => string '<some value>' (length=6)
      public 'autoMembership' => string '0' (length=1)
      public 'termStartDate' => string '24-Oct-2014' (length=11)
      public 'carryingCapacity' => string '5' (length=1)
      public 'termEndDate' => string '23-Oct-2015' (length=11)
      public 'hypo' => string '<some value>' (length=19)
      public 'branchCode' => string '1104' (length=4)
      public 'prvNcb' => string '0' (length=1)
      public 'vehicleMakeCode' => string '110' (length=3)
      public 'vehicleIdv' => string '325236' (length=6)
      public 'prvInsCompany' => string '1' (length=1)
      public 'engineNo' => string 'ABCD' (length=4)
      public 'product4digitCode' => string '1801' (length=4)
      public 'color' => string 'RED' (length=3)
      public 'vehicleModel' => string '<some value>' (length=5)
      public 'vehicleType' => string 'Private Car' (length=11)
      public 'prvExpiryDate' => string '13-Nov-2014' (length=11)
      public 'tpFinType' => null
      public 'deptCode' => string '18' (length=2)
      public 'vehicleModelCode' => string '29' (length=2)
      public 'registrationLocation' => string '<some value>' (length=5)
      public 'zone' => string 'A' (length=1)
  'accessoriesList_inout' => 
    object(stdClass)[3]
  'paddoncoverList_inout' => 
    object(stdClass)[4]
      public 'WeoMotGenParamUser' => 
        array (size=13)
          0 => 
            object(stdClass)[5]
              ...
          1 => 
            object(stdClass)[6]
              ...
          2 => 
            object(stdClass)[7]
              ...
          3 => 
            object(stdClass)[8]
              ...
          4 => 
            object(stdClass)[9]
              ...
          5 => 
            object(stdClass)[10]
              ...
          6 => 
            object(stdClass)[11]
              ...
          7 => 
            object(stdClass)[12]
              ...
          8 => 
            object(stdClass)[13]
              ...
          9 => 
            object(stdClass)[14]
              ...
          10 => 
            object(stdClass)[15]
              ...
          11 => 
            object(stdClass)[16]
              ...
          12 => 
            object(stdClass)[17]
              ...
  'pQuestList_inout' => 
    object(stdClass)[18]
  'pDetariffObj_inout' => 
    object(stdClass)[19]
      public 'driverQualificationCode' => null
      public 'vehPurchaseType' => null
      public 'extCol25' => null
      public 'extCol26' => null
      public 'tacMakeCode' => null
      public 'extCol23' => null
      public 'extCol24' => null
      public 'extCol29' => null
      public 'extCol27' => null
      public 'extCol28' => null
      public 'extCol33' => null
      public 'extCol32' => null
      public 'extCol31' => null
      public 'extCol30' => null
      public 'registrationAuth' => null
      public 'extCol12' => null
      public 'extCol13' => null
      public 'extCol14' => null
      public 'extCol15' => null
      public 'extCol16' => null
      public 'extCol17' => null
      public 'extCol18' => null
      public 'extCol19' => null
      public 'otherGoodsFrequency' => null
      public 'extCol20' => string '0' (length=1)
      public 'extCol22' => null
      public 'incurredClmExpCode' => null
      public 'extCol21' => null
      public 'clmHistCode' => null
      public 'roadType' => null
      public 'bodyType' => null
      public 'monthOfMfg' => null
      public 'natureOfGoods' => null
      public 'extCol9' => null
      public 'extCol8' => null
      public 'extCol7' => null
      public 'extCol6' => null
      public 'vehPurchaseDate' => null
      public 'extCol5' => null
      public 'extCol4' => string '0' (length=1)
      public 'vehDrivenBy' => null
      public 'extCol3' => null
      public 'extCol2' => string '0' (length=1)
      public 'extCol1' => string '3.283' (length=5)
      public 'goodsTransType' => null
      public 'permitType' => null
      public 'extCol38' => null
      public 'extCol39' => null
      public 'extCol34' => null
      public 'extCol35' => null
      public 'extCol36' => null
      public 'extCol10' => null
      public 'extCol37' => null
      public 'extCol11' => null
      public 'extCol40' => null
      public 'driverExperience' => null
  'premiumDetailsOut_out' => 
    object(stdClass)[20]
      public 'serviceTax' => string '1197' (length=4)
      public 'collPremium' => string '11207' (length=5)
      public 'totalActPremium' => string '1432' (length=4)
      public 'netPremium' => string '9974' (length=4)
      public 'totalIev' => string '325236' (length=6)
      public 'addLoadPrem' => string '0' (length=1)
      public 'totalNetPremium' => string '36' (length=2)
      public 'imtOut' => string '22,' (length=3)
      public 'totalPremium' => string '9974' (length=4)
      public 'ncbAmt' => string '-2135.499576' (length=12)
      public 'stampDuty' => string '1' (length=1)
      public 'totalOdPremium' => string '8542' (length=4)
      public 'spDisc' => string '0' (length=1)
      public 'finalPremium' => string '11207' (length=5)
  'premiumSummeryList_out' => 
    object(stdClass)[21]
      public 'WeoMotPremiumSummaryUser' => 
        array (size=4)
          0 => 
            object(stdClass)[22]
              ...
          1 => 
            object(stdClass)[23]
              ...
          2 => 
            object(stdClass)[24]
              ...
          3 => 
            object(stdClass)[25]
              ...
  'pError_out' => 
    object(stdClass)[26]
  'pErrorCode_out' => string '0' (length=1)
  'pTransactionId_inout' => string '<some value>' (length=8)

期待如何在变量中获得上述响应值。帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您的数据位于数组$ request

您可以遍历该数组并将每个索引保存到php变量中。

为了更好地查看客户端代码中的数组结构print_r($ request),并查看要迭代的键和值。

祝你好运。