• Hi,
    I have to implement a WordPress hook that:
    – receives a SOAP request (based on a given WSDL),
    – reads the XML content of the request,
    – saves some data,
    – returns a simple string.

    Which is the suggested way to do this?
    Should I use the PHP SoapServer class?
    Are the other solutions?

    Thank you very much for your help.

    Claudio

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    This may be of some help:

    https://generatewp.com/snippet/PGwz7V2/

    It looks old, but it may be a good starting point for your needs.

    Thread Starter IoClaudio

    (@ioclaudio)

    Hi,
    I’ve used this code to read the XML message.
    It seems to work:

    
    $result   = trim( file_get_contents( 'php://input' ) );
    $xml      = preg_replace( '/(<\/?)(\w+):([^>]*>)/', '$1$2$3', $result );
    $xml      = simplexml_load_string( $xml );
    $json     = wp_json_encode( $xml );
    $response = json_decode( $json, true );
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to read a SOAP request?’ is closed to new replies.