xmlrpc Failed to parse response

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

xmlrpc Failed to parse response

waigani-2
Hi, My xmlrpc client returns 'Failed to parse response', even though the logs from the server look correct.

On the client side $conn->getLastResponse()->__toString() returns the following:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><value><nil/></value></params></methodResponse>

Client, Server and logs below.


// Server

$server = new Zend_XmlRpc_Server();
$server->setClass('Hs_Service', 'service');
$response = $server->handle();
$request  = $server->getRequest();

        $path = Zend_Registry::get('pathToFramework');
  $log = new Zend_Log(new Zend_Log_Writer_Stream($path . '_tmp/xmlrpc.log'));
   
$log->info("Incoming request:\n" . $request->saveXML() .
"\nResponse:\n" . $response);

echo $response;


//Client

$conn  = new Hs_XmlRpc_Client('…');

        try {
            $result = $conn->call('service.hello');
            echo $result, "\n\n";
        } catch (Zend_XmlRpc_Exception $e) {
            echo $e->getMessage() . "\n\n";
        }
        echo $conn->getLastResponse()->__toString();

//logs

2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
<?xml version="1.0" encoding="UTF-8"?>
<methodCall><methodName>service.hello</methodName></methodCall>

Response:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><value><string>hello</string></value></params></methodResponse>

Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

weierophinney
Administrator
-- Waigani <[hidden email]> wrote
(on Wednesday, 18 June 2008, 07:59 PM -0700):

> Hi, My xmlrpc client returns 'Failed to parse response', even though the logs
> from the server look correct.
>
> On the client side $conn->getLastResponse()->__toString() returns the
> following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><nil/></value></params></methodResponse>
>
> Client, Server and logs below.
>
>
> // Server
>
> $server = new Zend_XmlRpc_Server();
> $server->setClass('Hs_Service', 'service');
> $response = $server->handle();
> $request  = $server->getRequest();
>
> $path = Zend_Registry::get('pathToFramework');
>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> '_tmp/xmlrpc.log'));
>    
> $log->info("Incoming request:\n" . $request->saveXML() .
> "\nResponse:\n" . $response);
>
> echo $response;
>
>
> //Client
>
> $conn  = new Hs_XmlRpc_Client('…');
>
>         try {
>             $result = $conn->call('service.hello');
>             echo $result, "\n\n";
>         } catch (Zend_XmlRpc_Exception $e) {
>             echo $e->getMessage() . "\n\n";
>         }
>         echo $conn->getLastResponse()->__toString();
>
> //logs
>
> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodCall><methodName>service.hello</methodName></methodCall>
>
> Response:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
>
> Any ideas?

First, posting the same issue three times is unnecessary; be patient
when waiting for replies.

The logged response does indeed look correct. The only thing I can think
of is that there are additional artifacts in the HTTP payload. You
should log the HTTP response received by the XML-RPC client to determine
that this may be. You can do that by pulling the HTTP client from the
XML-RPC client, and then pulling the last response:

    $httpClient = $client->getHttpClient();
    $response   = $httpClient->getLastResponse();
    foreach ($response->getHeaders() as $header) {
        echo $header, "\n";
    }
    echo $response->getBody();

This should give you more information on debugging. Often, PHP warning
notices and such will be returned as part of the payload, which will
invalidate the XML returned from the server. This is why the
XmlRpc_Server documentation recommends disabling display_errors.

--
Matthew Weier O'Phinney
Software Architect       | [hidden email]
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

waigani-2
Apologies for the duplicates, they were unintentional. I am posting this via the nabble forum. I deleted my original post in order to post a more succinct version not realising that I'd be chocking up the emails.

The xmlrpc server works as expected when outside of MVC. When I take the same code and put it in a controller action, it does not return the expected result and I get the 'Failed to parse response' error.

Matthew Weier O'Phinney-3 wrote
-- Waigani <jesse.meek@otago.ac.nz> wrote
(on Wednesday, 18 June 2008, 07:59 PM -0700):
> Hi, My xmlrpc client returns 'Failed to parse response', even though the logs
> from the server look correct.
>
> On the client side $conn->getLastResponse()->__toString() returns the
> following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><nil/></value></params></methodResponse>
>
> Client, Server and logs below.
>
>
> // Server
>
> $server = new Zend_XmlRpc_Server();
> $server->setClass('Hs_Service', 'service');
> $response = $server->handle();
> $request  = $server->getRequest();
>
> $path = Zend_Registry::get('pathToFramework');
>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> '_tmp/xmlrpc.log'));
>    
> $log->info("Incoming request:\n" . $request->saveXML() .
> "\nResponse:\n" . $response);
>
> echo $response;
>
>
> //Client
>
> $conn  = new Hs_XmlRpc_Client('…');
>
>         try {
>             $result = $conn->call('service.hello');
>             echo $result, "\n\n";
>         } catch (Zend_XmlRpc_Exception $e) {
>             echo $e->getMessage() . "\n\n";
>         }
>         echo $conn->getLastResponse()->__toString();
>
> //logs
>
> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodCall><methodName>service.hello</methodName></methodCall>
>
> Response:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
>
> Any ideas?

First, posting the same issue three times is unnecessary; be patient
when waiting for replies.

The logged response does indeed look correct. The only thing I can think
of is that there are additional artifacts in the HTTP payload. You
should log the HTTP response received by the XML-RPC client to determine
that this may be. You can do that by pulling the HTTP client from the
XML-RPC client, and then pulling the last response:

    $httpClient = $client->getHttpClient();
    $response   = $httpClient->getLastResponse();
    foreach ($response->getHeaders() as $header) {
        echo $header, "\n";
    }
    echo $response->getBody();

This should give you more information on debugging. Often, PHP warning
notices and such will be returned as part of the payload, which will
invalidate the XML returned from the server. This is why the
XmlRpc_Server documentation recommends disabling display_errors.

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

waigani-2
I tried the debugging script. $httpClient->getLastResponse() returns NULL.

Waigani wrote
Apologies for the duplicates, they were unintentional. I am posting this via the nabble forum. I deleted my original post in order to post a more succinct version not realising that I'd be chocking up the emails.

The xmlrpc server works as expected when outside of MVC. When I take the same code and put it in a controller action, it does not return the expected result and I get the 'Failed to parse response' error.

Matthew Weier O'Phinney-3 wrote
-- Waigani <jesse.meek@otago.ac.nz> wrote
(on Wednesday, 18 June 2008, 07:59 PM -0700):
> Hi, My xmlrpc client returns 'Failed to parse response', even though the logs
> from the server look correct.
>
> On the client side $conn->getLastResponse()->__toString() returns the
> following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><nil/></value></params></methodResponse>
>
> Client, Server and logs below.
>
>
> // Server
>
> $server = new Zend_XmlRpc_Server();
> $server->setClass('Hs_Service', 'service');
> $response = $server->handle();
> $request  = $server->getRequest();
>
> $path = Zend_Registry::get('pathToFramework');
>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> '_tmp/xmlrpc.log'));
>    
> $log->info("Incoming request:\n" . $request->saveXML() .
> "\nResponse:\n" . $response);
>
> echo $response;
>
>
> //Client
>
> $conn  = new Hs_XmlRpc_Client('…');
>
>         try {
>             $result = $conn->call('service.hello');
>             echo $result, "\n\n";
>         } catch (Zend_XmlRpc_Exception $e) {
>             echo $e->getMessage() . "\n\n";
>         }
>         echo $conn->getLastResponse()->__toString();
>
> //logs
>
> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodCall><methodName>service.hello</methodName></methodCall>
>
> Response:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
>
> Any ideas?

First, posting the same issue three times is unnecessary; be patient
when waiting for replies.

The logged response does indeed look correct. The only thing I can think
of is that there are additional artifacts in the HTTP payload. You
should log the HTTP response received by the XML-RPC client to determine
that this may be. You can do that by pulling the HTTP client from the
XML-RPC client, and then pulling the last response:

    $httpClient = $client->getHttpClient();
    $response   = $httpClient->getLastResponse();
    foreach ($response->getHeaders() as $header) {
        echo $header, "\n";
    }
    echo $response->getBody();

This should give you more information on debugging. Often, PHP warning
notices and such will be returned as part of the payload, which will
invalidate the XML returned from the server. This is why the
XmlRpc_Server documentation recommends disabling display_errors.

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

weierophinney
Administrator
In reply to this post by waigani-2
-- Waigani <[hidden email]> wrote
(on Thursday, 19 June 2008, 02:00 PM -0700):
>
> Apologies for the duplicates, they were unintentional. I am posting this via
> the nabble forum. I deleted my original post in order to post a more
> succinct version not realising that I'd be chocking up the emails.
>
> The xmlrpc server works as expected when outside of MVC. When I take the
> same code and put it in a controller action, it does not return the expected
> result and I get the 'Failed to parse response' error.

Did you disable layouts and the view renderer?


> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Waigani <[hidden email]> wrote
> > (on Wednesday, 18 June 2008, 07:59 PM -0700):
> >> Hi, My xmlrpc client returns 'Failed to parse response', even though the
> >> logs
> >> from the server look correct.
> >>
> >> On the client side $conn->getLastResponse()->__toString() returns the
> >> following:
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodResponse><params><value><nil/></value></params></methodResponse>
> >>
> >> Client, Server and logs below.
> >>
> >>
> >> // Server
> >>
> >> $server = new Zend_XmlRpc_Server();
> >> $server->setClass('Hs_Service', 'service');
> >> $response = $server->handle();
> >> $request  = $server->getRequest();
> >>
> >> $path = Zend_Registry::get('pathToFramework');
> >>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> >> '_tmp/xmlrpc.log'));
> >>    
> >> $log->info("Incoming request:\n" . $request->saveXML() .
> >> "\nResponse:\n" . $response);
> >>
> >> echo $response;
> >>
> >>
> >> //Client
> >>
> >> $conn  = new Hs_XmlRpc_Client('…');
> >>
> >>         try {
> >>             $result = $conn->call('service.hello');
> >>             echo $result, "\n\n";
> >>         } catch (Zend_XmlRpc_Exception $e) {
> >>             echo $e->getMessage() . "\n\n";
> >>         }
> >>         echo $conn->getLastResponse()->__toString();
> >>
> >> //logs
> >>
> >> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodCall><methodName>service.hello</methodName></methodCall>
> >>
> >> Response:
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
> >>
> >> Any ideas?
> >
> > First, posting the same issue three times is unnecessary; be patient
> > when waiting for replies.
> >
> > The logged response does indeed look correct. The only thing I can think
> > of is that there are additional artifacts in the HTTP payload. You
> > should log the HTTP response received by the XML-RPC client to determine
> > that this may be. You can do that by pulling the HTTP client from the
> > XML-RPC client, and then pulling the last response:
> >
> >     $httpClient = $client->getHttpClient();
> >     $response   = $httpClient->getLastResponse();
> >     foreach ($response->getHeaders() as $header) {
> >         echo $header, "\n";
> >     }
> >     echo $response->getBody();
> >
> > This should give you more information on debugging. Often, PHP warning
> > notices and such will be returned as part of the payload, which will
> > invalidate the XML returned from the server. This is why the
> > XmlRpc_Server documentation recommends disabling display_errors.
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect       | [hidden email]
> > Zend Framework           | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18018062.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Software Architect       | [hidden email]
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

waigani-2
View render is disabled and I have not enabled layouts.


Matthew Weier O'Phinney-3 wrote
-- Waigani <jesse.meek@otago.ac.nz> wrote
(on Thursday, 19 June 2008, 02:00 PM -0700):
>
> Apologies for the duplicates, they were unintentional. I am posting this via
> the nabble forum. I deleted my original post in order to post a more
> succinct version not realising that I'd be chocking up the emails.
>
> The xmlrpc server works as expected when outside of MVC. When I take the
> same code and put it in a controller action, it does not return the expected
> result and I get the 'Failed to parse response' error.

Did you disable layouts and the view renderer?


> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Waigani <jesse.meek@otago.ac.nz> wrote
> > (on Wednesday, 18 June 2008, 07:59 PM -0700):
> >> Hi, My xmlrpc client returns 'Failed to parse response', even though the
> >> logs
> >> from the server look correct.
> >>
> >> On the client side $conn->getLastResponse()->__toString() returns the
> >> following:
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodResponse><params><value><nil/></value></params></methodResponse>
> >>
> >> Client, Server and logs below.
> >>
> >>
> >> // Server
> >>
> >> $server = new Zend_XmlRpc_Server();
> >> $server->setClass('Hs_Service', 'service');
> >> $response = $server->handle();
> >> $request  = $server->getRequest();
> >>
> >> $path = Zend_Registry::get('pathToFramework');
> >>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> >> '_tmp/xmlrpc.log'));
> >>    
> >> $log->info("Incoming request:\n" . $request->saveXML() .
> >> "\nResponse:\n" . $response);
> >>
> >> echo $response;
> >>
> >>
> >> //Client
> >>
> >> $conn  = new Hs_XmlRpc_Client('…');
> >>
> >>         try {
> >>             $result = $conn->call('service.hello');
> >>             echo $result, "\n\n";
> >>         } catch (Zend_XmlRpc_Exception $e) {
> >>             echo $e->getMessage() . "\n\n";
> >>         }
> >>         echo $conn->getLastResponse()->__toString();
> >>
> >> //logs
> >>
> >> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodCall><methodName>service.hello</methodName></methodCall>
> >>
> >> Response:
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
> >>
> >> Any ideas?
> >
> > First, posting the same issue three times is unnecessary; be patient
> > when waiting for replies.
> >
> > The logged response does indeed look correct. The only thing I can think
> > of is that there are additional artifacts in the HTTP payload. You
> > should log the HTTP response received by the XML-RPC client to determine
> > that this may be. You can do that by pulling the HTTP client from the
> > XML-RPC client, and then pulling the last response:
> >
> >     $httpClient = $client->getHttpClient();
> >     $response   = $httpClient->getLastResponse();
> >     foreach ($response->getHeaders() as $header) {
> >         echo $header, "\n";
> >     }
> >     echo $response->getBody();
> >
> > This should give you more information on debugging. Often, PHP warning
> > notices and such will be returned as part of the payload, which will
> > invalidate the XML returned from the server. This is why the
> > XmlRpc_Server documentation recommends disabling display_errors.
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect       | matthew@zend.com
> > Zend Framework           | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18018062.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

weierophinney
Administrator
-- Waigani <[hidden email]> wrote
(on Sunday, 22 June 2008, 10:17 PM -0700):
>
> View render is disabled and I have not enabled layouts.

Next: is display_errors off?

    ini_set('display_errors', false);


> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Waigani <[hidden email]> wrote
> > (on Thursday, 19 June 2008, 02:00 PM -0700):
> >>
> >> Apologies for the duplicates, they were unintentional. I am posting this
> >> via
> >> the nabble forum. I deleted my original post in order to post a more
> >> succinct version not realising that I'd be chocking up the emails.
> >>
> >> The xmlrpc server works as expected when outside of MVC. When I take the
> >> same code and put it in a controller action, it does not return the
> >> expected
> >> result and I get the 'Failed to parse response' error.
> >
> > Did you disable layouts and the view renderer?
> >
> >
> >> Matthew Weier O'Phinney-3 wrote:
> >> >
> >> > -- Waigani <[hidden email]> wrote
> >> > (on Wednesday, 18 June 2008, 07:59 PM -0700):
> >> >> Hi, My xmlrpc client returns 'Failed to parse response', even though
> >> the
> >> >> logs
> >> >> from the server look correct.
> >> >>
> >> >> On the client side $conn->getLastResponse()->__toString() returns the
> >> >> following:
> >> >>
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >>
> >> <methodResponse><params><value><nil/></value></params></methodResponse>
> >> >>
> >> >> Client, Server and logs below.
> >> >>
> >> >>
> >> >> // Server
> >> >>
> >> >> $server = new Zend_XmlRpc_Server();
> >> >> $server->setClass('Hs_Service', 'service');
> >> >> $response = $server->handle();
> >> >> $request  = $server->getRequest();
> >> >>
> >> >> $path = Zend_Registry::get('pathToFramework');
> >> >>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> >> >> '_tmp/xmlrpc.log'));
> >> >>    
> >> >> $log->info("Incoming request:\n" . $request->saveXML() .
> >> >> "\nResponse:\n" . $response);
> >> >>
> >> >> echo $response;
> >> >>
> >> >>
> >> >> //Client
> >> >>
> >> >> $conn  = new Hs_XmlRpc_Client('…');
> >> >>
> >> >>         try {
> >> >>             $result = $conn->call('service.hello');
> >> >>             echo $result, "\n\n";
> >> >>         } catch (Zend_XmlRpc_Exception $e) {
> >> >>             echo $e->getMessage() . "\n\n";
> >> >>         }
> >> >>         echo $conn->getLastResponse()->__toString();
> >> >>
> >> >> //logs
> >> >>
> >> >> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >> <methodCall><methodName>service.hello</methodName></methodCall>
> >> >>
> >> >> Response:
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >>
> >> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
> >> >>
> >> >> Any ideas?
> >> >
> >> > First, posting the same issue three times is unnecessary; be patient
> >> > when waiting for replies.
> >> >
> >> > The logged response does indeed look correct. The only thing I can
> >> think
> >> > of is that there are additional artifacts in the HTTP payload. You
> >> > should log the HTTP response received by the XML-RPC client to
> >> determine
> >> > that this may be. You can do that by pulling the HTTP client from the
> >> > XML-RPC client, and then pulling the last response:
> >> >
> >> >     $httpClient = $client->getHttpClient();
> >> >     $response   = $httpClient->getLastResponse();
> >> >     foreach ($response->getHeaders() as $header) {
> >> >         echo $header, "\n";
> >> >     }
> >> >     echo $response->getBody();
> >> >
> >> > This should give you more information on debugging. Often, PHP warning
> >> > notices and such will be returned as part of the payload, which will
> >> > invalidate the XML returned from the server. This is why the
> >> > XmlRpc_Server documentation recommends disabling display_errors.
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Software Architect       | [hidden email]
> >> > Zend Framework           | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18018062.html
> >> Sent from the Zend Web Services mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect       | [hidden email]
> > Zend Framework           | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18062752.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Software Architect       | [hidden email]
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

till
On Mon, Jun 23, 2008 at 9:50 AM, Matthew Weier O'Phinney
<[hidden email]> wrote:
> -- Waigani <[hidden email]> wrote
> (on Sunday, 22 June 2008, 10:17 PM -0700):
>>
>> View render is disabled and I have not enabled layouts.
>
> Next: is display_errors off?
>
>    ini_set('display_errors', false);

Preferrably enable log_errors and set error_log. ;-)

Till
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

waigani-2
In reply to this post by weierophinney
Yes display_errors is off (sorry for the slow reply).

Matthew Weier O'Phinney-3 wrote
-- Waigani <jesse.meek@otago.ac.nz> wrote
(on Sunday, 22 June 2008, 10:17 PM -0700):
>
> View render is disabled and I have not enabled layouts.

Next: is display_errors off?

    ini_set('display_errors', false);


> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Waigani <jesse.meek@otago.ac.nz> wrote
> > (on Thursday, 19 June 2008, 02:00 PM -0700):
> >>
> >> Apologies for the duplicates, they were unintentional. I am posting this
> >> via
> >> the nabble forum. I deleted my original post in order to post a more
> >> succinct version not realising that I'd be chocking up the emails.
> >>
> >> The xmlrpc server works as expected when outside of MVC. When I take the
> >> same code and put it in a controller action, it does not return the
> >> expected
> >> result and I get the 'Failed to parse response' error.
> >
> > Did you disable layouts and the view renderer?
> >
> >
> >> Matthew Weier O'Phinney-3 wrote:
> >> >
> >> > -- Waigani <jesse.meek@otago.ac.nz> wrote
> >> > (on Wednesday, 18 June 2008, 07:59 PM -0700):
> >> >> Hi, My xmlrpc client returns 'Failed to parse response', even though
> >> the
> >> >> logs
> >> >> from the server look correct.
> >> >>
> >> >> On the client side $conn->getLastResponse()->__toString() returns the
> >> >> following:
> >> >>
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >>
> >> <methodResponse><params><value><nil/></value></params></methodResponse>
> >> >>
> >> >> Client, Server and logs below.
> >> >>
> >> >>
> >> >> // Server
> >> >>
> >> >> $server = new Zend_XmlRpc_Server();
> >> >> $server->setClass('Hs_Service', 'service');
> >> >> $response = $server->handle();
> >> >> $request  = $server->getRequest();
> >> >>
> >> >> $path = Zend_Registry::get('pathToFramework');
> >> >>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> >> >> '_tmp/xmlrpc.log'));
> >> >>    
> >> >> $log->info("Incoming request:\n" . $request->saveXML() .
> >> >> "\nResponse:\n" . $response);
> >> >>
> >> >> echo $response;
> >> >>
> >> >>
> >> >> //Client
> >> >>
> >> >> $conn  = new Hs_XmlRpc_Client('…');
> >> >>
> >> >>         try {
> >> >>             $result = $conn->call('service.hello');
> >> >>             echo $result, "\n\n";
> >> >>         } catch (Zend_XmlRpc_Exception $e) {
> >> >>             echo $e->getMessage() . "\n\n";
> >> >>         }
> >> >>         echo $conn->getLastResponse()->__toString();
> >> >>
> >> >> //logs
> >> >>
> >> >> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >> <methodCall><methodName>service.hello</methodName></methodCall>
> >> >>
> >> >> Response:
> >> >> <?xml version="1.0" encoding="UTF-8"?>
> >> >>
> >> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
> >> >>
> >> >> Any ideas?
> >> >
> >> > First, posting the same issue three times is unnecessary; be patient
> >> > when waiting for replies.
> >> >
> >> > The logged response does indeed look correct. The only thing I can
> >> think
> >> > of is that there are additional artifacts in the HTTP payload. You
> >> > should log the HTTP response received by the XML-RPC client to
> >> determine
> >> > that this may be. You can do that by pulling the HTTP client from the
> >> > XML-RPC client, and then pulling the last response:
> >> >
> >> >     $httpClient = $client->getHttpClient();
> >> >     $response   = $httpClient->getLastResponse();
> >> >     foreach ($response->getHeaders() as $header) {
> >> >         echo $header, "\n";
> >> >     }
> >> >     echo $response->getBody();
> >> >
> >> > This should give you more information on debugging. Often, PHP warning
> >> > notices and such will be returned as part of the payload, which will
> >> > invalidate the XML returned from the server. This is why the
> >> > XmlRpc_Server documentation recommends disabling display_errors.
> >> >
> >> > --
> >> > Matthew Weier O'Phinney
> >> > Software Architect       | matthew@zend.com
> >> > Zend Framework           | http://framework.zend.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18018062.html
> >> Sent from the Zend Web Services mailing list archive at Nabble.com.
> >>
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect       | matthew@zend.com
> > Zend Framework           | http://framework.zend.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/xmlrpc-Failed-to-parse-response-tp17996437p18062752.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: xmlrpc Failed to parse response

alesl
In reply to this post by waigani-2
Hi,

I had similar problems. Everything worked fine on dev maschine, but
error 'Failed to parse request' accoured when moved code to staging server.

I've chaged my code:

$client = new Zend_XmlRpc_Client(...);
$result = $client->call(service.hello);
...

to
$connection = new Zend_XmlRpc_Client(...);
$client = $connection->getProxy();
$client->service->hello();

After that everything worked just fine.

LP, AlesL


Waigani wrote:

> Hi, My xmlrpc client returns 'Failed to parse response', even though the logs
> from the server look correct.
>
> On the client side $conn->getLastResponse()->__toString() returns the
> following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><nil/></value></params></methodResponse>
>
> Client, Server and logs below.
>
>
> // Server
>
> $server = new Zend_XmlRpc_Server();
> $server->setClass('Hs_Service', 'service');
> $response = $server->handle();
> $request  = $server->getRequest();
>
> $path = Zend_Registry::get('pathToFramework');
>   $log = new Zend_Log(new Zend_Log_Writer_Stream($path .
> '_tmp/xmlrpc.log'));
>    
> $log->info("Incoming request:\n" . $request->saveXML() .
> "\nResponse:\n" . $response);
>
> echo $response;
>
>
> //Client
>
> $conn  = new Hs_XmlRpc_Client('…');
>
>         try {
>             $result = $conn->call('service.hello');
>             echo $result, "\n\n";
>         } catch (Zend_XmlRpc_Exception $e) {
>             echo $e->getMessage() . "\n\n";
>         }
>         echo $conn->getLastResponse()->__toString();
>
> //logs
>
> 2008-06-19T14:20:18+12:00 INFO (6): Incoming request:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodCall><methodName>service.hello</methodName></methodCall>
>
> Response:
> <?xml version="1.0" encoding="UTF-8"?>
> <methodResponse><params><value><string>hello</string></value></params></methodResponse>
>
> Any ideas?
>