Jump to content

Calling a .NET webservice from PHP (Wordpress)


MarkusJ

Recommended Posts

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


                  

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.