【问题标题】:Passing Array via SOAP for SAP Webservice通过 SOAP 为 SAP Webservice 传递数组
【发布时间】:2016-07-28 06:42:33
【问题描述】:

我正在尝试通过 SOAP 为 SAP Webservice 传递一个二维数组。 但我不能通过同样的。

我能够传递一个值,也能够接受来自 SAP 的表输出。 请指导。

我尝试将数组类型转换为对象。

我的代码:

<?php       
    include("include/config.php");

    $sql = "SELECT tid,OrderNumber FROM transhistory ORDER by timestamp ASC limit 2";
    $result= mysqli_query($db,$sql);
    $i=0;
    while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
        //Array based on output table
        $pmt[$i][0] = "";                       //Mandt
        $pmt[$i][1] = $row["tid"];              //Refnum
        $pmt[$i][2] = $row["OrderNumber"];  //Orderno

        $i++;
    }

    /*Two methods I tried */   
    $object = (object) $pmt;
    $object = json_decode(json_encode($pmt), FALSE);

    #Define Authentication 
    $SOAP_AUTH = array( 'login'    => 'abc',
                        'password' => 'abc');

    #Specify WSDL
    $WSDL = "working URL here";

    #Create Client Object, download and parse WSDL
    $client = new SoapClient($WSDL,$SOAP_AUTH);

    #Setup input parameters (SAP Likes to Capitalise the parameter names)
    $params = array(
          'Zpmt' => $object 
    );

    #Call Operation (Function). Catch and display any errors
    try {
        $result = $client->ZphpOT($params);
    } catch (SoapFault $exception) {
        echo 'Error!Server Connectivity issue. Please try again later.';
        die();
    }      
?>

【问题讨论】:

    标签: php arrays web-services soap sap


    【解决方案1】:

    我不知道答案是否对某人有用,但通常你会发送这样的参数

    $result = $client->ZphpOT("VARIABLE_NAME"=>$params);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-10
      • 1970-01-01
      • 2018-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      相关资源
      最近更新 更多