What is the purpose of using pseudo-xml as a Soap response in PHP?

Using pseudo-xml as a Soap response in PHP can be useful when dealing with SOAP services that require XML data but do not have a proper WSDL file. By formatting the response as pseudo-xml, we can still send and receive data in a structured manner without the need for a full WSDL definition. This can be particularly helpful in situations where the SOAP service is not fully compliant or when working with legacy systems.

// Create a SoapServer instance with pseudo-xml response
$server = new SoapServer(null, array('uri' => 'http://localhost/soap-server'));
$server->addFunction('someFunction');

// Define the function to be called
function someFunction($param) {
    // Process the input parameter
    $result = doSomething($param);

    // Format the response as pseudo-xml
    $response = '<response>';
    $response .= '<result>' . $result . '</result>';
    $response .= '</response>';

    return $response;
}

// Handle the SOAP request
$server->handle();