What potential pitfalls should be considered when using SOAP in PHP for web services like WSRP?

Potential pitfalls when using SOAP in PHP for web services like WSRP include performance issues due to the XML parsing overhead, potential security vulnerabilities if not properly configured, and compatibility issues with different SOAP implementations. To address these pitfalls, consider optimizing your SOAP requests, implementing proper security measures such as SSL/TLS encryption, and testing your SOAP services across different platforms.

// Example of optimizing SOAP request by caching the WSDL file
$options = array(
    'cache_wsdl' => WSDL_CACHE_DISK,
    'trace' => true,
);

$client = new SoapClient("http://example.com/service.wsdl", $options);