MarkusJ Posted June 10, 2013 Share Posted June 10, 2013 Hi, I have spent the last few hours trying to consume a .NET webservice (.asmx) from a php page. I have tried all sorts of recommendations but I am still getting the following error SoapClient->__call('LogUser', Array) #1 /home/mywebsite/public_html/sitefun.com/wp-content/themes/supermodne/functions.php(18): SoapClient->LogUser(Object(stdClass)) The actual .NET webservice that I am trying to call is an extremely simple .asmx webservice (not WCF) and the method is very simple (interface is below) [WebMethod] public string LogUser(string IPAddress, string Key, string ID, string Referrer) { This is the code that I am using to call the webservice in php $client = new SoapClient('http://services.mywebsite.net/webservices/visitorlog.asmx?WSDL'); $requestvar = $_SERVER['REMOTE_ADDR']; $requestKey = 'guid'; $requestID = '6' $referrer = $_SERVER['HTTP_REFERER']; if (!empty($_SERVER['HTTP_REFERER'])) { $parameters = array('IPAddress'=>$requestvar,'Key'=>$requestKey,'ID'=>$requestID,'Referrer'=>$referrer); $result = $client->LogUser($parameters); // This is the line that is causing the error I must be doing something silly as I am new to php / services so I would appreciate any help Best wishes and thanks in advance Mark Quote Link to comment https://forums.phpfreaks.com/topic/278977-calling-a-net-webservice-from-php-wordpress/ Share on other sites More sharing options...
trq Posted June 10, 2013 Share Posted June 10, 2013 You haven't actually described your problem. Quote Link to comment https://forums.phpfreaks.com/topic/278977-calling-a-net-webservice-from-php-wordpress/#findComment-1435086 Share on other sites More sharing options...
MarkusJ Posted June 10, 2013 Author Share Posted June 10, 2013 LOL, sorry; you are correct (wood for the trees!) I am getting an "Object not set to an instance of an object" error when I call the line $result = $client->LogUser($parameters); // This is the line that is causing the error Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/278977-calling-a-net-webservice-from-php-wordpress/#findComment-1435089 Share on other sites More sharing options...
trq Posted June 10, 2013 Share Posted June 10, 2013 Have you tried var dumping $client to see what it is? Quote Link to comment https://forums.phpfreaks.com/topic/278977-calling-a-net-webservice-from-php-wordpress/#findComment-1435090 Share on other sites More sharing options...
MarkusJ Posted June 10, 2013 Author Share Posted June 10, 2013 Hi, if I simply do an echo var_dump($client) I get the following object(SoapClient)#173 (2) { ["_soap_version"]=> int(1) ["sdl"]=> resource(95) of type (Unknown) } thanks again Quote Link to comment https://forums.phpfreaks.com/topic/278977-calling-a-net-webservice-from-php-wordpress/#findComment-1435091 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.