doxzrb8721 2016-01-26 00:13
浏览 120

PHP SOAP:为SoapVar中的父级嵌套多个子参数,错误:SoapFault:错误版本

At first, Please go through my scenario, WSDL file is: https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl

Sample Request XML is:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rev="http://www.tibco.com/schemas/CMS_Service/BusinessServices/Schemas/Rev_Input_Schema.xsd">
   <soap:Header/>
   <soap:Body>
      <rev:reversal>
         <rev:header>
            <rev:req_id>01404099</rev:req_id>
            <rev:msg_src>BTS</rev:msg_src>
            <rev:client_code>KOSECNSE</rev:client_code>
            <rev:date_post>2014-09-10T00:00:00+01:00</rev:date_post>
         </rev:header>
         <rev:details>
            <!--Zero or more repetitions:-->
            <rev:msg_id>CMS-2014062300007</rev:msg_id>
            <rev:msg_id>CMS-2014062300013</rev:msg_id>
            <rev:msg_id>CMS-2014062300010</rev:msg_id>
            <rev:msg_id>CMS-2014062300016</rev:msg_id>
            <rev:msg_id>CMS-2014042300008</rev:msg_id>
         </rev:details>
      </rev:reversal>
   </soap:Body>
</soap:Envelope>

Now, i tried to construct the same above sample request using the PHP soapVar as follows:

 $soapClient = new SoapClient('https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl',
                                        array('trace' => 1, "exceptions"=>0, 'soap_version' => SOAP_1_1) );
    $soapClient->__setLocation('https://203.196.200.42/cmspi/UCMSPAY/BusinessServices/StarterProcesses/CMS_Service.serviceagent?wsdl');

$headerRequestVar = new SoapVar(array(
               'rev:req_id'           => '01404099',
               'rev:msg_src'            => 'BTS',
               'rev:client_code'         => 'KOSECNSE',
               'rev:date_post'      => '2014-09-10T00:00:00+01:00',
           ), SOAP_ENC_OBJECT);

    $headerRequest = new SoapVar(array('rev:header' => $headerRequestVar), SOAP_ENC_OBJECT);

    $detailsRequestVar = new SoapVar(array(
               'rev:msg_id'           => 'CMS-2014062300007',
           ), SOAP_ENC_OBJECT);

    $detailsRequest = new SoapVar(array('rev:details' => $detailsRequestVar), SOAP_ENC_OBJECT);


    $request =  new SoapVar(array('rev:reversal' => $detailsRequest, $headerRequest), SOAP_ENC_OBJECT);

 $result = $soapClient->WebAPI_rev($request);
    var_dump($result);

When i run the above program i am getting the following error (Var_dump response) :

    object(SoapFault)#7 (10) {
  ["message":protected]=>
  string(13) "Wrong Version"
  ["string":"Exception":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
  ["file":protected]=>
  string(41) "/home/skumar/testme/kotak/soapClient3.php"
  ["line":protected]=>
  int(37)
  ["trace":"Exception":private]=>
  array(2) {
    [0]=>
    array(6) {
      ["file"]=>
      string(41) "/home/skumar/testme/kotak/soapClient3.php"
      ["line"]=>
      int(37)
      ["function"]=>
      string(6) "__call"
      ["class"]=>
      string(10) "SoapClient"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(2) {
        [0]=>
        string(10) "WebAPI_rev"
        [1]=>
        array(1) {
          [0]=>
          object(SoapVar)#6 (2) {
            ["enc_type"]=>
            int(301)
            ["enc_value"]=>
            array(2) {
              ["rev:reversal"]=>
              object(SoapVar)#5 (2) {
                ["enc_type"]=>
                int(301)
                ["enc_value"]=>
                array(1) {
                  ["rev:details"]=>
                  object(SoapVar)#4 (2) {
                    ["enc_type"]=>
                    int(301)
                    ["enc_value"]=>
                    array(1) {
                      ["rev:msg_id"]=>
                      string(17) "CMS-2014062300007"
                    }
                  }
                }
              }
              [0]=>
              object(SoapVar)#3 (2) {
                ["enc_type"]=>
                int(301)
                ["enc_value"]=>
                array(1) {
                  ["rev:header"]=>
                  object(SoapVar)#2 (2) {
                    ["enc_type"]=>
                    int(301)
                    ["enc_value"]=>
                    array(4) {
                      ["rev:req_id"]=>
                      string(8) "01404099"
                      ["rev:msg_src"]=>
                      string(3) "BTS"
                      ["rev:client_code"]=>
                      string(8) "KOSECNSE"
                      ["rev:date_post"]=>
                      string(25) "2014-09-10T00:00:00+01:00"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    [1]=>
    array(6) {
      ["file"]=>
      string(41) "/home/skumar/testme/kotak/soapClient3.php"
      ["line"]=>
      int(37)
      ["function"]=>
      string(10) "WebAPI_rev"
      ["class"]=>
      string(10) "SoapClient"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(1) {
        [0]=>
        object(SoapVar)#6 (2) {
          ["enc_type"]=>
          int(301)
          ["enc_value"]=>
          array(2) {
            ["rev:reversal"]=>
            object(SoapVar)#5 (2) {
              ["enc_type"]=>
              int(301)
              ["enc_value"]=>
              array(1) {
                ["rev:details"]=>
                object(SoapVar)#4 (2) {
                  ["enc_type"]=>
                  int(301)
                  ["enc_value"]=>
                  array(1) {
                    ["rev:msg_id"]=>
                    string(17) "CMS-2014062300007"
                  }
                }
              }
            }
            [0]=>
            object(SoapVar)#3 (2) {
              ["enc_type"]=>
              int(301)
              ["enc_value"]=>
              array(1) {
                ["rev:header"]=>
                object(SoapVar)#2 (2) {
                  ["enc_type"]=>
                  int(301)
                  ["enc_value"]=>
                  array(4) {
                    ["rev:req_id"]=>
                    string(8) "01404099"
                    ["rev:msg_src"]=>
                    string(3) "BTS"
                    ["rev:client_code"]=>
                    string(8) "KOSECNSE"
                    ["rev:date_post"]=>
                    string(25) "2014-09-10T00:00:00+01:00"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ["previous":"Exception":private]=>
  NULL
  ["faultstring"]=>
  string(13) "Wrong Version"
  ["faultcode"]=>
  string(15) "VersionMismatch"
  ["faultcodens"]=>
  string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}

When i checked in Firebug, it is showing, status is "200 OK" , did any one know, what is happening here please. I think, if you look at the sample xml, it " < reversal > " parent has two children "< header > < details >", i passed the same in my code as shown above :

$request = new SoapVar(array('rev:reversal' => $detailsRequest, $headerRequest), SOAP_ENC_OBJECT);

Do you think this is the problem?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)