I know how to call a SAP webservice from PHP, but how can I send parameters with my request?
I tried the following:
#Define Authentication
$SOAP_AUTH = array( 'login' => 'user',
'password' => 'password');
#Specify WSDL
$WSDL = "http://xxxxxx/sap/bc/srt/wsdl/bndg_E417CA96FB8A5FF1B4A8000C293C9303/wsdl11/allinone/standard/document?sap-client=100";
#Create Client Object, download and parse WSDL
$client = new SoapClient($WSDL,$SOAP_AUTH);
$HEAD_DATA = new stdClass();
$HEAD_DATA->Material = 'WM-999996';
$HEAD_DATA->IndSector = 'M';
$HEAD_DATA->MatlType = 'FERT';
$HEAD_DATA->BasicView = 'X';
#Setup input parameters (SAP Likes to Capitalise the parameter names)
$params = array(
'HEADDATA' => $HEAD_DATA
);
#Call Operation (Function). Catch and display any errors
try
{
$result = $client->StandardMaterialSaveData($params);
}
catch (SoapFault $exception)
{
print "***Caught Exception***\n";
print_r($exception);
print "***END Exception***\n";
die();
}
#Out the results
print_r($result);
But it gives me the following error:
SOAP-ERROR: Encoding: object has no 'HeadData' property
I think that the following lines are wrong:
$HEAD_DATA = new stdClass();
$HEAD_DATA->Material = 'WM-999996';
$HEAD_DATA->IndSector = 'M';
$HEAD_DATA->MatlType = 'FERT';
$HEAD_DATA->BasicView = 'X';
Can anyone please help me and tell me how to add the HEAD_DATA variable correctly onto the webservice call?