diff --git a/src/webservices/soap/ws-hello-world.php b/src/webservices/soap/ws-hello-world.php index e13343e..fff201f 100755 --- a/src/webservices/soap/ws-hello-world.php +++ b/src/webservices/soap/ws-hello-world.php @@ -1,52 +1,58 @@ configureWSDL('hellowsdl', 'urn:hellowsdl'); -// Register the method to expose -$server->register('hello', // method name - array('name' => 'xsd:string'), // input parameters - array('return' => 'xsd:string'), // output parameters - 'urn:hellowsdl', // namespace - 'urn:hellowsdl#hello', // soapaction - 'rpc', // style - 'encoded', // use + +// Register the "hello" method to expose as a SOAP function +$server->register( + 'hello', // method name + array('name' => 'xsd:string'), // input parameter + array('return' => 'xsd:string'), // output parameter + 'urn:hellowsdl', // namespace + 'urn:hellowsdl#hello', // SOAP action + 'rpc', // style + 'encoded', // use 'Says hello to the caller -

- Sample Request (Copy and paste into Burp Repeater)
-
POST /mutillidae/webservices/soap/ws-hello-world.php HTTP/1.1 -
Accept-Encoding: gzip,deflate -
Content-Type: text/xml;charset=UTF-8 -
SOAPAction: "urn:hellowsdl#hello" -
Content-Length: 438 -
Host: localhost -
Connection: Keep-Alive -
User-Agent: Apache-HttpClient/4.1.1 (java 1.5) -
-
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:hellowsdl"> -
<soapenv:Header/> -
<soapenv:Body> -
<urn:hello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> -
<name xsi:type="xsd:string">Fred</name> -
</urn:hello> -
</soapenv:Body> -
</soapenv:Envelope>' // end documentation +

+ Sample Request (Copy and paste into Burp Repeater)
+
POST /mutillidae/webservices/soap/ws-hello-world.php HTTP/1.1 +
Accept-Encoding: gzip,deflate +
Content-Type: text/xml;charset=UTF-8 +
SOAPAction: "urn:hellowsdl#hello" +
Content-Length: 438 +
Host: localhost +
Connection: Keep-Alive +
User-Agent: Apache-HttpClient/4.1.1 (java 1.5) +
+
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:hellowsdl"> +
<soapenv:Header/> +
<soapenv:Body> +
<urn:hello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> +
<name xsi:type="xsd:string">Fred</name> +
</urn:hello> +
</soapenv:Body> +
</soapenv:Envelope>' // end documentation ); -// Define the method as a PHP function +// Define the "hello" method function hello($name) { - return 'Hello, ' . $name; + return 'Hello, ' . $name; } // Handle the SOAP request with error handling try { - // Use the request to (try to) invoke the service + // Process the incoming SOAP request $server->service(file_get_contents("php://input")); } catch (Exception $e) { - error_log("SOAP Server Error: " . $e->getMessage()); // Log the error for debugging - // Optionally send a fault response back to the client - $server->fault('Server', "SOAP Server Error: " . $e->getMessage()); + // Send a fault response back to the client + $server->fault('Server', "SOAP Service Error: " . $e->getMessage()); } ?>