0

I want to consume a simple SOAP request from this Webservice:

http://www.webservicex.net/geoipservice.asmx

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at WebserviceX.Service.Adapter.IPAdapter.CheckIP(String IP) at WebserviceX.Service.GeoIPService.GetGeoIP(String IPAddress)

This is the Exception I get from the Webservice and this is my code:

    $wsdl = 'http://www.webservicex.net/geoipservice.asmx?WSDL';
    $soap = new SoapClient($wsdl);

    $functions = $soap->__getFunctions();
    $types = $soap->__getTypes();

    $parameters = array("IPAddress"=> "exampleIPAddress");
    $response = $soap->GetGeoIP($parameters);

with a real ip-address instead of "exampleIPAddress", of course.

Thanks

6
  • where do u check this code on local server or remote server. If local server what operating system are you using? Commented Sep 6, 2014 at 15:14
  • this code runs on my local vm on Ubuntu. I thought the advantage of soap was, that it doesnt depend on the os? The other function on this Webservice doenst need any parameters, which works perfectly! Commented Sep 6, 2014 at 15:20
  • yes but I wanted to confirm that SOAP extension is enabled that was the reason I asked for OS, u can navigate to php.ini file and check Commented Sep 6, 2014 at 15:25
  • i just checked it by calling: extension_loaded('soap). it gave me true Commented Sep 6, 2014 at 15:30
  • 1
    That error sounds like it is coming from the remote (soap) server, not from your php server. Try it as is (with "exampleIPAddress") does it fail the same or do you get a response that includes "Invalid IP address"? Commented Sep 6, 2014 at 15:35

1 Answer 1

1

It seems there is an error on the soap-server side (thanks James). I tried another IP-Address and its working great. Maybe some ip-areas are not supported :D

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.