Issues

ZF-1364: Zend_XmlRpc_Client forces faultCode and faultString on response

Issue Type: Improvement Created: 2007-05-08T11:28:25.000+0000 Last Updated: 2007-07-05T14:44:09.000+0000 Status: Resolved Fix version(s): - 1.0.0 RC3 (23/Jun/07)

Reporter: Till Klampaeckel (till) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_XmlRpc_Client

Related issues: Attachments:

Description

The faultCode/faultString in the response should be optional and not considered mandatory.

For example from Java a standard exception has no code what so ever, hence, the field faultCode in the response is empty, which leads to a Zend_XmlRpc_Client_Exception.

Comments

Posted by Bill Karwin (bkarwin) on 2007-05-12T12:23:03.000+0000

Assigning to Matthew.

Posted by Till Klampaeckel (till) on 2007-05-12T13:00:00.000+0000

Just to give feedback, if this is mandatory indeed (I found and read the www.xmlrpc.com/spec" rel="nofollow">spec in the meantime and it's not so clear on this) this may be a week implementation in the Java-based XML-RPC service I have to query. What would be your advice then?

Posted by Matthew Weier O'Phinney (matthew) on 2007-05-17T11:03:19.000+0000

Can you give an example fault response payload that triggers the exception? Zend_XmlRpc_Fault::loadXml() only throws exceptions for the following conditions:

  • malformed XML
  • malformed fault response, which means that it doesn't minimally have structure
  • BOTH code AND message missing from the fault struct

In the case of a missing code, it simply sets it to '404', and uses the message provided. My inclination is that the response you're getting back is so far different from a typical XML-RPC response as to be unrecognizable.

Posted by Till Klampaeckel (till) on 2007-05-23T06:51:35.000+0000

Apologies for the delay - this is what I get when I dump:

<pre class="highlight">
$httpResponse = $http->request(Zend_Http_Client::POST);

Response:

<pre class="highlight">
<?xml version="1.0"?>
faultStringjava.lang.ClassCastException: java.lang.IntegerfaultCode0

Exception: Fault code and string required

Posted by Matthew Weier O'Phinney (matthew) on 2007-05-23T07:55:00.000+0000

The problem is with the XML, in particular, the faultString value; it's missing the tag indicating the value type. Instead of:

<pre class="highlight">
java.lang.ClassCastException: java.lang.Integer

it should be reading:

<pre class="highlight">
java.lang.ClassCastException: java.lang.Integer

The only way to fix this is to intercept the XML as it arrives and insert the tag (can be done using either regexp, DOM, or SimpleXML).

Posted by Matthew Weier O'Phinney (matthew) on 2007-05-23T07:56:01.000+0000

Fault response returned from third-party server does not conform to XML-RPC spec; not an issue of ZF.

Posted by Till Klampaeckel (till) on 2007-05-29T05:52:44.000+0000

The XML-RPC spec states that if no type supplied, "string" is assumed. So this fault is not so far away from the standard. ;-)

http://www.xmlrpc.com/spec https://issues.apache.org/jira/browse/…

Posted by Matthew Weier O'Phinney (matthew) on 2007-06-13T09:21:09.000+0000

Zend_XmlRpc_Value is correctly defaulting to using strings if no type is provided; however, Zend_XmlRpc_Fault is not using Zend_XmlRpc_Value to pull the fault struct.

Posted by Matthew Weier O'Phinney (matthew) on 2007-06-13T09:21:30.000+0000

Resolved in r5279.

Posted by Till Klampaeckel (till) on 2007-06-13T11:24:09.000+0000

Thanks!

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts