Skip to content

Commit

Permalink
2.11.22 Update web service
Browse files Browse the repository at this point in the history
  • Loading branch information
webpwnized committed Oct 8, 2024
1 parent dde12f4 commit 5762f92
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions src/webservices/soap/ws-hello-world.php
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
<?php
// Pull in the NuSOAP code
require_once('./lib/nusoap.php');
// Create the server instance
// Pull in the NuSOAP library
use nusoap_server;

// Assuming nusoap_server is the class you need from the nusoap library
require_once './lib/nusoap.php';

// Create the SOAP server instance
$server = new soap_server();
// Initialize WSDL support

// Initialize WSDL (Web Service Definition Language) support
$server->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
<br/><br/>
Sample Request (Copy and paste into Burp Repeater)<br/>
<br/>POST /mutillidae/webservices/soap/ws-hello-world.php HTTP/1.1
<br/>Accept-Encoding: gzip,deflate
<br/>Content-Type: text/xml;charset=UTF-8
<br/>SOAPAction: &quot;urn:hellowsdl#hello&quot;
<br/>Content-Length: 438
<br/>Host: localhost
<br/>Connection: Keep-Alive
<br/>User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<br/>
<br/>&lt;soapenv:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn=&quot;urn:hellowsdl&quot;&gt;
<br/> &lt;soapenv:Header/&gt;
<br/> &lt;soapenv:Body&gt;
<br/> &lt;urn:hello soapenv:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;
<br/> &lt;name xsi:type=&quot;xsd:string&quot;&gt;Fred&lt;/name&gt;
<br/> &lt;/urn:hello&gt;
<br/> &lt;/soapenv:Body&gt;
<br/>&lt;/soapenv:Envelope&gt;' // end documentation
<br/><br/>
Sample Request (Copy and paste into Burp Repeater)<br/>
<br/>POST /mutillidae/webservices/soap/ws-hello-world.php HTTP/1.1
<br/>Accept-Encoding: gzip,deflate
<br/>Content-Type: text/xml;charset=UTF-8
<br/>SOAPAction: &quot;urn:hellowsdl#hello&quot;
<br/>Content-Length: 438
<br/>Host: localhost
<br/>Connection: Keep-Alive
<br/>User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<br/>
<br/>&lt;soapenv:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn=&quot;urn:hellowsdl&quot;&gt;
<br/> &lt;soapenv:Header/&gt;
<br/> &lt;soapenv:Body&gt;
<br/> &lt;urn:hello soapenv:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;
<br/> &lt;name xsi:type=&quot;xsd:string&quot;&gt;Fred&lt;/name&gt;
<br/> &lt;/urn:hello&gt;
<br/> &lt;/soapenv:Body&gt;
<br/>&lt;/soapenv:Envelope&gt;' // 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());
}
?>

0 comments on commit 5762f92

Please sign in to comment.