Web Services Tutorial 3 SOAP & REST Tutorial

Get the Code Here :

Web Services 1 :
Web Services 2 :

In this part of my web services tutorial, I provide both a non-WSDL SOAP server and a REST Web Service Example program. The goal is to keep everything simple and easy to understand because many people are confused by both.

I decided to avoid covering WSDL (Web Service Description Language) because it is very common for these to be generated by software. I also decided to focus on just the GET method with REST because it is most commonly used.






49 responses to “Web Services Tutorial 3 SOAP & REST Tutorial”

  1. Yiğit Kılıçaslan Avatar

    Your code is looking so good

  2. Neil Murphy Avatar

    Upvote for Twin Peaks references.

  3. zulkar nain Avatar

    how to host these on real server

  4. hdjksa52 Avatar

    LOL……YEAH SOMEONE IS Twin Peaks fan!!!!!!
    thanks for showing us REST.

  5. Francis Lavazelli Avatar

    Derek, in regard to HATEOS, would it be a better practice to pass the URI of each individual student resource in the response rather than building out the href in the front end? Let me know your thoughts.


  6. Mark Watney Avatar

    Hey, are you a Twin Peaks fan, too?

  7. khouloud fatnassi Avatar

    how can i get wsdl file with this example plz

  8. murali nice Avatar

    super bro thank you.

  9. SMS 1980 Avatar

    Your channel is quite awesome!

  10. Chirag Kumar Avatar

    Good but don't you think the voice of the person speaking is not proper.

  11. MichaelRyanMichael Avatar

    What exactly is the uri => '..' in the SoapClient options for? When it's a non-empty string it seems to work…

  12. Benito Camelas Avatar

    why arrays of arrays? not array of objects

  13. Mathaalbhai Avatar

    Nice and simple example. I wish you can make one with WSDL and Mysql example. Thanks!

  14. Andrew Ritter Avatar

    Great tutorials, thanks for putting these together.

  15. Charles Kangai Avatar

    Cool man, great stuff!

  16. braulio cortés Avatar

    Really great tutorial……you´re the best XD
    Greetings from Chile

  17. Walter Zulu Avatar

    great video i learn a lot. can you help me on REST API security specifically API KEYS and minimum requests. Thanks a lot

  18. 老丞 Eason Avatar

    Is it possible to send a restful request to a soap server(opc server)?

  19. Matthew Clancy Avatar

    Excellent approach and clarity… Thanks for taking the time to put the videos together!

  20. Matthew Clancy Avatar

    option = options? 🙂

  21. Itzik Ben Hutta Avatar

    Thanks for your awesome videos. It really helps me.
    Please correct me if I'm wrong. I would build an API if I want to make my website a mobile app, I want another app to connect to my site or I just want to use frameworks like Angular to fetch data from the API instead of using PHP directly.
    Am I missing something?
    I was always afraid of API'S, but I guess it's all about returning JSON, and mostly that's it.

  22. Labyrinthman Avatar

    Dear Derek,

    Thank you for wonderfull tutorial as always.
    I apreciate this tutorial for SOAP and REST but I can't help but wonder how is REST diferent from ordinary getting and presenting data ?

  23. Lazzarini Avatar

    Nice vid, let me ask u something, i need to create a mini social network using web services, but, i cant understand how to!! can u help me? starting from the login and register form using web service, please :S

  24. Dan Cairns Avatar

    Thank you very helpful.

  25. Jai-Liel Williams Avatar

    I get an error that says I need an xml file. Do you have any suggestions of what might solve this? here is the error: SoapFault: looks like we got no XML document in clientfilename

  26. Sglow Avatar

    I've never heard anyone pronounce 'Yakima' (ya-kee-ma) the way you did (spent most my life in Central Washington). Everyone here says "Ya-ka-ma" or "ya-ka-maw" (Sometimes "yak-uh-ma/w" even.), in my experience. Wikipedia seems to say "Ya-kee-ma" also, but I've never once heard it before today haha. Anyways this is a pointless comment, just thought it was interesting.

  27. nd0307 Avatar

    i kept receiving this error: object(SoapFault)#2 (10) { ["message":protected]=> string(33) "looks like we got no XML document"….

    i solved it by going to php.ini and uncommenting the line "always_populate_raw_post_data = -1"

    make sure to restart your web-server after doing this

  28. camuz06 Avatar

    hello again, as always thanks for the tutorial, maybe you have an example for the conexion of this webservice with C#  as you don't use WSDL I cant connect them? I can't resolve my problem with that… thanks again

  29. Jeffrey Jensen Avatar

    Quick Tip: 
    Instead of <?php echo $student_info["first_name"] ?>
    You can put <?= $student_info["first_name"] ?>

  30. Risteard O'B Avatar

    If anyone has any problems running the above projects watch out for your UTF settings. I copied the code from Dereks website into my editor and for some reason the default in my editor changed to UTF with BOM. This meant that some strange characters, that FF doesn't even display, were messing up my code. Anyway, the solution is to make sure that your text editor (mine is Notepad ++) is set to UTF8 without BOM.

  31. Risteard O'B Avatar

    Hi Derek, I keep getting the following error when I run your code: Invalid argument supplied for foreach() in C:wampwwwrestexamplerest_client.php on line 47
    It's to do with the foreach statement but I'm not sure what's wrong. I've copied your code from your website and the only thing I've changed is the url where I have the files in a different named folder

  32. kagebun Avatar

    I thought it might be more concise to do something like:
    static $student_info = array(
        array("first_name" => "Dale" ,  "last_name" => "Cooper", …),
        array("first_name" => "Harry", "last_name" => "Truman", …),
    if(in_array($id, $student_info)){
        return $student_info[$id];
    } else {
        return "Student id: $id not foundn";

    but then you'd probably have to explain static which diverts from the video.
    Probably should have thrown in a default case though:
        $student_info = array("NA" => "No student exists with that id");

  33. marvan momen Avatar

    thanks for sharing knowledge  , can possible upload video tutorial send data from html form to mysql database and retrieve
    data from database to html form

  34. Doug Cassidy Avatar

    It's 'YEAH-kih-Mah'  not 'ya-KEEM-ah'  😉

  35. Keodina Chey Avatar

    In your REST sample code you just show only GET method. How about POST, PUT and DELETE they are different right?

  36. TRU Avatar

    +Derek Banas 
    Ok I mostly here that the GET request is most vulnerable to attacks , specifically CSRF and POST is much safer. You are the first to say the opposite. In your opinion why is GET safer?

  37. Tim Broders Avatar

     Just really curious, when we ask for a tutorial. Do you literally just read up on a book, learn the material, and make a tutorial? 

  38. Brandon Dewey Avatar

    another great tutorial Derek. Some tutorial requests: hadoop, openflow, openstack.

  39. devnand Avatar

    Hi derek!
    please make this same tutorial in Java!

  40. Jyrik Gauldurson Avatar

    nice video, I have a question if anybody can elaborate.

    Concerning the restful application. In this case, does the api.php contain the services that the client.php is calling? For instance, can the rest API can be written in java ee or another language and then be consumed by a php client? 

  41. Angelina Jolie Avatar

    Hi Derek! Why did you use array of arrays in the get_student_list function?

  42. Angelina Jolie Avatar

    Derek this explanation of wsdl compares it with a traditional programming language.

  43. wjrasmussen666 Avatar

    Per your request, here is a comment asking for more on the wsdl file stuff!

  44. Angelina Jolie Avatar

    Hi Derek ! is the translation web service next?

  45. Stefan Buica Avatar

    Derek, will you cover computer vision in the near future ? I am interested in medical imaging.

  46. Azlan Jamal Avatar

    Hi, do you have any tutorial on android login and registration with php mysql as the backend web service? Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *