sca-php-examples-php-obtaining-wsdl-4

  • Examples
  • Obtaining the WSDL for an SCA component offering
    a Service as a Web service

  • Obtaining the WSDL for an SCA component offering a Service as a
    Web service
  • Obtaining the WSDL for an SCA component offering
    a Service as a Web service

    Obtaining the WSDL for an SCA component offering
    a Service as a Web service

    SCA components that expose a Web service interface
    (i.e. have an @binding.soap annotation) will return their WSDL
    definition in response to an HTTP request with a get parameter of
    “wsdl”. The usual way to obtain this is with “?wsdl” on the end of
    a URL. The example below uses file_get_contents() to obtain WSDL from a
    service and writes it to a temporary file before then obtaining a
    proxy for the service in the usual way. You could of course also
    obtain the WSDL in a browser, or by some other means, and save the
    file yourself.

    Example #1 Generated WSDL

    <?php
    $wsdl = file_get_contents('http://www.example.com/Services/Example.php?wsdl');
    file_put_contents("service.wsdl",$wsdl); //write the wsdl to a file
    $service = SCA::getService('service.wsdl'); 
    ?>
    

    NOTE: If the wsdl requires imported xsds, these
    will need to be fetched separately.