Soap & wsdl

Discussion in 'PHP' started by grutland, Oct 15, 2010.

  1. #1
    Hi,

    The company I work for are looking into creating an API for their clients and I have set off on the task on researching what the best approach is.
    Only to find out after a bit of discussion, I'm to use SOAP.

    I've got my head around the SoapClient class and fairly confident I can get that side working.

    What I'm having troubles with is the SoapServer and the creation of WSDL files.
    I've been searching round the internet for about 2 hours now looking for a descent tutorial, or even just any information on how it all ties together with no joy.

    Can any one explain to me how WSDL files are created, and if it's possible, how to generate them while using SoapServer.

    Cheer.
     
    grutland, Oct 15, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    WSDL isn't too bad, once you get your head around it.... (who am i kidding.......)

    http://www.w3.org/TR/wsdl

    You're not going to find a much better resource than that, but to be fair, its a lot to take in.

    Basically, the WSDL is a resource to identify the services provided. If you are using the PHP SOAP server
    class, then functionality isnt built in by default.

    [for reference]

    http://php.net/manual/en/book.soap.php
    http://www.php.net/manual/en/soapserver.getfunctions.php

    There are some workarounds to this however; you can create your own class to do this, but any errors in the
    WSDL will cause you more grief than it's probably worth. There are quite a few other work arounds offered
    elsewhere, such as;

    http://www.brainbell.com/tutorials/php/Creating_A_Web_Service_With_PHP_5's_SOAP_Extension.htm

    Im not sure if any of these would be suitable, however, in your scenario. (Of course, this will no doubt become 'a feature' of the php soap lib sooner rather than later)
     
    lukeg32, Oct 15, 2010 IP
  3. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    I've got to admit, this SOAP thing is giving me a headache.
    I suggested maybe using OAuth instead, but it was dismissed as we've integrated as a client to other SOAP services.

    Don't suppose you have any suggestions/idea/opinions on what the best approach would be?
     
    grutland, Oct 15, 2010 IP
  4. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #4
    If your hands are tied then SOAP it is :( You should, at the very least, take a look at the WSDL generators mentioned
    in the above link because they do work, and they aren't overly difficult to get working. (which also means you don't have
    to go about debugging the WSDL)

    There are of course a few other ways to implement an API (REST, XMLRPC etc) but it doesn't sound like you are able to use either of those.
     
    lukeg32, Oct 15, 2010 IP
  5. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #5
    Sorry, what generators mentioned?
     
    grutland, Oct 15, 2010 IP
  6. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #6
    lukeg32, Oct 15, 2010 IP