ablunier
ablunier

Reputation: 23

Symfony FOSRestBundle body listener conflict with SOAP WebService

I developed a Symfony2 application with a SOAP WebService (with the PHP SoapServer class) for receiving data of a third application and now I'm developing an API with FOSRestBundle for the user interface. The problem is that with the configuration that I set for the REST bundle my SOAP WebService doesn't work throwing the following error:

'Invalid xml message received (400 Bad Request)' by 'FOS\RestBundle\EventListener\BodyListener' at line 71.

Here is my FOSRestBundle configuration:

fos_rest:
    param_fetcher_listener: true
    body_listener: true
    format_listener: true
    view:
        view_response_listener: 'force'
        formats:
            xml: true
            json : true
        templating_formats:
            html: true
        force_redirects:
            html: true
        failed_validation: HTTP_BAD_REQUEST
        default_engine: twig
    routing_loader:
        default_format: json
    serializer:
        serialize_null: true

If I set body_listener to false the SOAP WebService works fine, but I need set it to true for my RESTful API PUT requests. I tried out different configuration combinations but I can't fix the problem.

Thanks in advance for your help.

Upvotes: 1

Views: 1954

Answers (1)

Rene Terstegen
Rene Terstegen

Reputation: 8046

The following line in the bodylistener does not return an array, that's why it fails:

$data = $decoder->decode($content, $format);

Either the header for your request is invalid or the content your sending is not wel formatted.

Upvotes: 0

Related Questions