Quantcast
Channel: SCN : Discussion List - Scripting Languages
Viewing all articles
Browse latest Browse all 325

PHP SDK for SAP OData - Method

$
0
0

  Hello all,

 

I am currently trying to integrate PHP with SAP OData gateway. I got the Query, Read and Create working from various guides and blogposts, however, I am struggling with the Delete and Update.

 

I am using the following SDK: http://odataphp.codeplex.com/

 

In the case of the Delete, I am using the following code:

 

function deleteBank($id) {

   

    $scheme_agency_id = "LOCAL";

    $scheme_id = "Z_BANK_RFC_RRO";

    error_log('deleteBank() with id: ' . $id);

    $search = null;

 

    try {

        $proxy = new ZBANKRFCRRO("http://developer:xxxxxxxx@sapnwgw01:8042/sap/opu/sdata/sap/ZBANKRFCRRO");

        $query = "z_bank_rfc_rroCollection(value=%27$id%27,scheme_id=%27$scheme_id%27,scheme_agency_id=%27$scheme_agency_id%27)";

        $bank = $proxy->Execute($query . $search)->Result;

       

        $proxy->setMethod('HttpVerb::DELETE');

       

        //The object is added to the list of objects to delete in the database

        $proxy->DeleteObject($bank);

         //SaveChanges persists the changes in the database

        $proxy->SaveChanges();

       

    } catch(ODataServiceException $exception) {

        echo '{"error":{"text":'. $exception->getError().'}}';

    }  

}

 

 

Looking the SDK documentation, it instructs to use the DeleteObject method, however, after using a packet sniffer I can confirm that it's using a GET and not a DELETE (which is what the SAP GW expects).

 

Any thoughts, or guidance in how to change the http verb?

 

Thank


Viewing all articles
Browse latest Browse all 325


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>