Creating webservice server and client using NuSOAP

Brief description of NuSOAP:

NuSOAP is a rewrite of SOAPx4, provided by NuSphere and Dietrich Ayala. It is a set of PHP classes – no PHP extensions required – that allow developers to create and consume web services based on SOAP 1.1, WSDL 1.1 and HTTP 1.0/1.1.

Why using NuSOAP? PHP5 already has soapServer and soapClient implementation

  • it’s easy to implement and fast, no need to create WSDL document by yourself (this is my main reason why I choose NuSOAP)
  • compatibility, no special PHP extension need (I didn’t test it if still works on PHP4, but it does work flawlessly on PHP 5.0)

First, download NuSOAP from here:

The Server

We will create a SOAP server with two entry points (=function). One function take one parameter and output a string while the other one take two parameters and output a complex result (an array/struct). The codes with commentary:

Suppose that you save the codes in ws.php, you can see your neat webservice description by accessing the URL:
Try click on one of your webservice entry point! NuSOAP will show you a description about it, see screenshot:

webservice entry point description using NuSOAP

example of entry point description generated by NuSOAP

for WSDL XML document, you can see it at:

The client

The code is quite simple, all the code need is your webservice WSDL URL.

That’s it! Creating webservice server and client using NuSOAP is fast and simple. šŸ™‚

Leave a comment ?


  1. thanks

  2. I am beggineer.i want to develop a webservice for wall share.
    plz send me code.

  3. Kapil Gulati

    Great Job! I like this very much!! Thank you very much

  4. Hello,

    I want to upload images using nusoap. have you any suggestion regrading it?

    Thanks & regards

  5. Nusoap Authentifizierungs Problem - - pingback on 2014/03/08 at 23:29
  6. Nice Job!

    Do you know how to use setCredentials for username and password? On my local machine I can use $client->setCredentials(“Benutzer”,”Passwort”, “basic”); But not online on my webspace.

    Do you know the reason?


  7. For paying through the e-shop of my organization, the bank wants the ticketing(handshake) to be performed using nusoap xml file. I don’t understand if I have to have a server running in my domain or I just run a php client file where I have to declare a client and make a call to the server of the bank’s server. Thank you.

  8. thanx helped me a lot but would have been better if some explanation was there šŸ™‚

  9. in localhost this work, but when i put in a external server, and i try do access to server from my localhost, i don’t have any result.

  10. Merci beaucoup pour l exemple, simple complet et sans erreur

Leave a Reply

Trackbacks and Pingbacks:

%d bloggers like this: