Hello all!
First let me say that I have searched the net all over but I cannot find an answer, that is why I am trying here, hoping some of you PHP gurus might know something 🙂
I work as a PHP programmer and recently I got the task of connecting (in PHP5) to a .NET webservice using wsdl and datasets. Now, after a week of frustration and hard work I am really stuck.
Here is my problem. My task is to save user variables in the webservice using a method called ‘Save’. I can connect fine and also generate the required ID for the operation, the problem comes when I try to save the variables, I can create the dataset via a method called GetNew but how can I access it after creating it? If I assign a variable to the GetNew call I get a fairly large array, but populating it and sending it into the webservice won’ t work.
I guess what I am trying to ask is if it is possible to use, in PHP, a remote .NET webservice using datasets to save rows in its database.
Here is my code:
I connect to the webservice using NuSOAP:
$url = 'http://webservice.address.here.com/WebService/folder/Main.asmx?wsdl';
$client = new soapclient($url, true);
This works fine, next step is to authenticate myself, this also works fine:
$headers = '<SoapAuthenticator xmlns="'http://webservice.address.here.com/WebService/folder/"><UserId>xxxx</UserId><Password>xxxxx</Password></SoapAuthenticator>';
$client->setHeaders($headers);
Next step is to generate a unique id using a method called GenerateSFDDBGID, again this works fine:
$GetID = array('strGIDPrefix'=>$adr);
$GID = $client->call('GenerateSFDDBGID', array('parameters'=>$GetID));
Now we come to the tricky part, creating, populating and saving the dataset, here is the code in .NET:
DataSet dsCKDB = ws.GetNew("DATASET_IDENTIFIER");
I try to recreate the above code by doing this:
$param_init= ' DATASET_IDENTIFIER';
$GetNew = array('strTransactionId'=>$param_init);
$ds = $client->call('GetNew', array('parameters'=>$GetNew));
This give me a large array filled with values… the next line is what is driving me crazy:
//New row
DataRow drLogCKDB = dsCKDB.Tables["Log"].NewRow();
How can I recreate the NewRow() call in PHP?
rest of the .NET code here:
//Add extern source values
drLogCKDB["AdrGID"] = "XXXXXXXXXXXXXXXXXXXXX";
drLogCKDB["Datum"] = DateTime.Now;
drLogCKDB["Text"] = "CKDB WS Devnet - " + DateTime.Now.ToString();
drLogCKDB["ClassGID"] = "CLS_LOG_FRITEXT";
//Add Row
dsCKDB.Tables["Log"].Rows.Add(drLogCKDB);
//Save
dsCKDB = ws.Save("DATASET_IDENTIFIER ", intDBSpace, dsCKDB);
Anyhow, thanks for reading this post and If you know anything about .NET datasets and PHP please reply. I would like to know if it is even possible, been wasting a lot of time on this :/
Have a nice day!
Best regards
/Fredrik