New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fault. Code: 2, Reason: Invalid return payload: enable debugging to examine incoming payload xmlrpc element STRiNG cannot be child of VALUE #59

Open
bunalng opened this Issue Nov 7, 2017 · 12 comments

Comments

Projects
None yet
2 participants
@bunalng

bunalng commented Nov 7, 2017

i want to run a cron job. my script working on www browser. but on console give me this error:
Fault. Code: 2, Reason: Invalid return payload: enable debugging to examine incoming payload xmlrpc element STRiNG cannot be child of VALUE
how can i solve this?

@gggeek

This comment has been minimized.

Show comment
Hide comment
@gggeek

gggeek Nov 11, 2017

Owner

Hello.

The first thing to do would be to enable the debug mode of the client, so that you can see exactly the xml payload received in the response.

However, I just noticed the funny casing of the word 'STRiNG' in your error message.
That leads me to think that the response that you are getting is generated not via a widely-used xmlrpc library but some ad-hoc code, which produces a slightly wrong xml, which is not compatible with the phpxmlrpc lib. If that is proven to be the case, I would suggest fixing the server-side, if at all possible...

Owner

gggeek commented Nov 11, 2017

Hello.

The first thing to do would be to enable the debug mode of the client, so that you can see exactly the xml payload received in the response.

However, I just noticed the funny casing of the word 'STRiNG' in your error message.
That leads me to think that the response that you are getting is generated not via a widely-used xmlrpc library but some ad-hoc code, which produces a slightly wrong xml, which is not compatible with the phpxmlrpc lib. If that is proven to be the case, I would suggest fixing the server-side, if at all possible...

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 13, 2017

but if i run same code on browser it works perfect. if i run on console generate this error.

bunalng commented Nov 13, 2017

but if i run same code on browser it works perfect. if i run on console generate this error.

@gggeek

This comment has been minimized.

Show comment
Hide comment
@gggeek

gggeek Nov 13, 2017

Owner

When you say "on browser", I assume that you mean that you have a web page written in php that uses the phpxmlrpc library to make a call to an external server?

If so, the best I can say is as above: add a call $client->setDebug(2) in your code to get a complete dump of the HTTP communication, so that we can inspect in detail what is going on

Owner

gggeek commented Nov 13, 2017

When you say "on browser", I assume that you mean that you have a web page written in php that uses the phpxmlrpc library to make a call to an external server?

If so, the best I can say is as above: add a call $client->setDebug(2) in your code to get a complete dump of the HTTP communication, so that we can inspect in detail what is going on

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 13, 2017

---SENDING---
<?xml version="1.0"?>
<methodCall>
<methodName>listAccounts</methodName>
<params>
<param>
<value><struct>
<member><name>limit</name>
<value><int>1</int></value>
</member>
</struct></value>
</param>
</params>
</methodCall>
---END---
*   Trying a.b.c.d...
* TCP_NODELAY set
* Connected to a.b.c.d (a.b.c.d) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=example.com
*  start date: Sep 27 00:00:00 2016 GMT
*  expire date: Nov 26 23:59:59 2017 GMT
*  issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Server auth using Digest with user 'USERNAME'
> POST /xmlapi/xmlapi HTTP/1.1
Host: a.b.c.d
User-Agent: XML-RPC for PHP 4.3.0
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Length: 0

< HTTP/1.1 401 Unauthorized
< Date: Mon, 13 Nov 2017 13:04:28 GMT
< Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
< WWW-Authenticate: Digest nonce="<removed>", opaque="<removed>", realm="XML API", qop="auth"
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: text/plain; charset=utf-8
< 
* Ignoring the response-body
* Curl_http_done: called premature == 0
* Connection #0 to host a.b.c.d left intact
* Issue another request to this URL: 'https://a.b.c.d:443/xmlapi/xmlapi'
* Found bundle for host a.b.c.d: 0x5614d84cfa80 [can pipeline]
* Re-using existing connection! (#0) with host a.b.c.d
* Connected to a.b.c.d (a.b.c.d) port 443 (#0)
* Server auth using Digest with user 'USERNAME'
> POST /xmlapi/xmlapi HTTP/1.1
Host: a.b.c.d
Authorization: Digest username="USERNAME", realm="XML API", nonce="<removed>", uri="/xmlapi/xmlapi", cnonce="<removed>", nc=00000001, qop=auth, response="<removed>", opaque="<removed>"
User-Agent: XML-RPC for PHP 4.3.0
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Length: 221

* upload completely sent off: 221 out of 221 bytes
< HTTP/1.1 200 OK
< Date: Mon, 13 Nov 2017 13:04:28 GMT
< Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: text/xml
< 
* Curl_http_done: called premature == 0
* Connection #0 to host a.b.c.d left intact

---CURL INFO---
url: https://a.b.c.d:443/xmlapi/xmlapi
content_type: text/xml
http_code: 200
header_size: 666
request_size: 952
filetime: -1
ssl_verify_result: 20
redirect_count: 1
total_time: 0.533197
namelookup_time: 5.4E-5
connect_time: 5.6E-5
pretransfer_time: 0.000277
size_upload: 221
size_download: 365
speed_download: 684
speed_upload: 414
download_content_length: -1
upload_content_length: 221
starttransfer_time: 0.143867
redirect_time: 0.389067
redirect_url: 
primary_ip: a.b.c.d
certinfo: 
primary_port: 443
local_ip: 192.168.1.11
local_port: 57784
---END---

---GOT---
HTTP/1.1 401 Unauthorized
Date: Mon, 13 Nov 2017 13:04:28 GMT
Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
WWW-Authenticate: Digest nonce="<removed>", opaque="<removed>", realm="XML API", qop="auth"
Vary: Accept-Encoding
Content-Encoding: gzip
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8

HTTP/1.1 200 OK
Date: Mon, 13 Nov 2017 13:04:28 GMT
Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
Vary: Accept-Encoding
Content-Encoding: gzip
Transfer-Encoding: chunked
Content-Type: text/xml

<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><struct>
<member>
<name>accounts</name>
<value><array><data>
<value><struct>
<member>
<name>username</name>
<value><string>1234567890</string></value>
</member>
<member>
<name>credit_limit</name>
<value><double>9.0</double></value>
</member>
<member>
<name>description</name>
<value><string>Acme Co.</string></value>
</member>
<member>
<name>i_account</name>
<value><int>9645615649</int></value>
</member>
<member>
<name>base_currency</name>
<value><string>BTC</string></value>
</member>
<member>
<name>balance</name>
<value><double>-1.02571465</double></value>
</member>
<member>
<name>expired</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>registration_status</name>
<value><nil/></value></member>
<member>
<name>blocked</name>
<value><boolean>0</boolean></value>
</member>
</struct></value>
</data></array></value>
</member>
<member>
<name>result</name>
<value><string>OK</string></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>


---END---

HEADER: date: Mon, 13 Nov 2017 13:04:28 GMT
HEADER: server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
HEADER: vary: Accept-Encoding
HEADER: content-encoding: gzip
HEADER: transfer-encoding: chunked
HEADER: content-type: text/xml

Fault. Code: 2, Reason: Invalid return payload: enable debugging to examine incoming payload xmlrpc element STRiNG cannot be child of VALUE

bunalng commented Nov 13, 2017

---SENDING---
<?xml version="1.0"?>
<methodCall>
<methodName>listAccounts</methodName>
<params>
<param>
<value><struct>
<member><name>limit</name>
<value><int>1</int></value>
</member>
</struct></value>
</param>
</params>
</methodCall>
---END---
*   Trying a.b.c.d...
* TCP_NODELAY set
* Connected to a.b.c.d (a.b.c.d) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=example.com
*  start date: Sep 27 00:00:00 2016 GMT
*  expire date: Nov 26 23:59:59 2017 GMT
*  issuer: C=US; O=GeoTrust Inc.; CN=RapidSSL SHA256 CA
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Server auth using Digest with user 'USERNAME'
> POST /xmlapi/xmlapi HTTP/1.1
Host: a.b.c.d
User-Agent: XML-RPC for PHP 4.3.0
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Length: 0

< HTTP/1.1 401 Unauthorized
< Date: Mon, 13 Nov 2017 13:04:28 GMT
< Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
< WWW-Authenticate: Digest nonce="<removed>", opaque="<removed>", realm="XML API", qop="auth"
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: text/plain; charset=utf-8
< 
* Ignoring the response-body
* Curl_http_done: called premature == 0
* Connection #0 to host a.b.c.d left intact
* Issue another request to this URL: 'https://a.b.c.d:443/xmlapi/xmlapi'
* Found bundle for host a.b.c.d: 0x5614d84cfa80 [can pipeline]
* Re-using existing connection! (#0) with host a.b.c.d
* Connected to a.b.c.d (a.b.c.d) port 443 (#0)
* Server auth using Digest with user 'USERNAME'
> POST /xmlapi/xmlapi HTTP/1.1
Host: a.b.c.d
Authorization: Digest username="USERNAME", realm="XML API", nonce="<removed>", uri="/xmlapi/xmlapi", cnonce="<removed>", nc=00000001, qop=auth, response="<removed>", opaque="<removed>"
User-Agent: XML-RPC for PHP 4.3.0
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: text/xml
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Length: 221

* upload completely sent off: 221 out of 221 bytes
< HTTP/1.1 200 OK
< Date: Mon, 13 Nov 2017 13:04:28 GMT
< Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
< Vary: Accept-Encoding
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< Content-Type: text/xml
< 
* Curl_http_done: called premature == 0
* Connection #0 to host a.b.c.d left intact

---CURL INFO---
url: https://a.b.c.d:443/xmlapi/xmlapi
content_type: text/xml
http_code: 200
header_size: 666
request_size: 952
filetime: -1
ssl_verify_result: 20
redirect_count: 1
total_time: 0.533197
namelookup_time: 5.4E-5
connect_time: 5.6E-5
pretransfer_time: 0.000277
size_upload: 221
size_download: 365
speed_download: 684
speed_upload: 414
download_content_length: -1
upload_content_length: 221
starttransfer_time: 0.143867
redirect_time: 0.389067
redirect_url: 
primary_ip: a.b.c.d
certinfo: 
primary_port: 443
local_ip: 192.168.1.11
local_port: 57784
---END---

---GOT---
HTTP/1.1 401 Unauthorized
Date: Mon, 13 Nov 2017 13:04:28 GMT
Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
WWW-Authenticate: Digest nonce="<removed>", opaque="<removed>", realm="XML API", qop="auth"
Vary: Accept-Encoding
Content-Encoding: gzip
Transfer-Encoding: chunked
Content-Type: text/plain; charset=utf-8

HTTP/1.1 200 OK
Date: Mon, 13 Nov 2017 13:04:28 GMT
Server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
Vary: Accept-Encoding
Content-Encoding: gzip
Transfer-Encoding: chunked
Content-Type: text/xml

<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><struct>
<member>
<name>accounts</name>
<value><array><data>
<value><struct>
<member>
<name>username</name>
<value><string>1234567890</string></value>
</member>
<member>
<name>credit_limit</name>
<value><double>9.0</double></value>
</member>
<member>
<name>description</name>
<value><string>Acme Co.</string></value>
</member>
<member>
<name>i_account</name>
<value><int>9645615649</int></value>
</member>
<member>
<name>base_currency</name>
<value><string>BTC</string></value>
</member>
<member>
<name>balance</name>
<value><double>-1.02571465</double></value>
</member>
<member>
<name>expired</name>
<value><boolean>0</boolean></value>
</member>
<member>
<name>registration_status</name>
<value><nil/></value></member>
<member>
<name>blocked</name>
<value><boolean>0</boolean></value>
</member>
</struct></value>
</data></array></value>
</member>
<member>
<name>result</name>
<value><string>OK</string></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>


---END---

HEADER: date: Mon, 13 Nov 2017 13:04:28 GMT
HEADER: server: Apache/2.2.22 (FreeBSD) mod_wsgi/2.8 Python/2.7.2 mod_ssl/2.2.22 OpenSSL/0.9.8q DAV/2
HEADER: vary: Accept-Encoding
HEADER: content-encoding: gzip
HEADER: transfer-encoding: chunked
HEADER: content-type: text/xml

Fault. Code: 2, Reason: Invalid return payload: enable debugging to examine incoming payload xmlrpc element STRiNG cannot be child of VALUE
@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 13, 2017

error produced at line 320 on Request.php

bunalng commented Nov 13, 2017

error produced at line 320 on Request.php

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 14, 2017

error produces only while running on console:
php script.php
when i run with elinks there is no error:
elinks https://localhost/script.php

bunalng commented Nov 14, 2017

error produces only while running on console:
php script.php
when i run with elinks there is no error:
elinks https://localhost/script.php

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 17, 2017

interesting! when i run my codes in debian there is this error. but same codes run perfectly in my mac. (mac php71 apache24 with brew)

bunalng commented Nov 17, 2017

interesting! when i run my codes in debian there is this error. but same codes run perfectly in my mac. (mac php71 apache24 with brew)

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 22, 2017

any news?

bunalng commented Nov 22, 2017

any news?

@gggeek

This comment has been minimized.

Show comment
Hide comment
@gggeek

gggeek Nov 22, 2017

Owner

Sorry, busy times. I will try to takea look at this before end of week.

Owner

gggeek commented Nov 22, 2017

Sorry, busy times. I will try to takea look at this before end of week.

@gggeek

This comment has been minimized.

Show comment
Hide comment
@gggeek

gggeek Nov 23, 2017

Owner

I have tested the following code on both Win 8.1 and Debian 8:

<?php
include('./lib/xmlrpc.inc');
$string = file_get_contents('./test.response');
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_extension = true;
$req = new \PhpXmlRpc\Request('hi');
$resp = $req->parseResponse($string, true);
var_dump($resp);

where test.response I have copied and pasted from your comments above.

In both cases it worked.

I suspect that in fact you might be executing more than 1 single xmlrpc call here (or at least parsing more than 1 response), and the error seen might not be related to the debug output that you pasted.

I am afraid that the only way for me to investigate more would be for you to send me the whole php script that is executing the call (and, if it needs a bigger framework to run, even better the whole app).

Owner

gggeek commented Nov 23, 2017

I have tested the following code on both Win 8.1 and Debian 8:

<?php
include('./lib/xmlrpc.inc');
$string = file_get_contents('./test.response');
\PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_extension = true;
$req = new \PhpXmlRpc\Request('hi');
$resp = $req->parseResponse($string, true);
var_dump($resp);

where test.response I have copied and pasted from your comments above.

In both cases it worked.

I suspect that in fact you might be executing more than 1 single xmlrpc call here (or at least parsing more than 1 response), and the error seen might not be related to the debug output that you pasted.

I am afraid that the only way for me to investigate more would be for you to send me the whole php script that is executing the call (and, if it needs a bigger framework to run, even better the whole app).

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 29, 2017

Firstly, thanks for your interest.
I run only 1 single xmlrpc call. In console there is this error. In browser there is no error and worked perfectly. I run with links but i did not like this method. If i found anything i will inform you.

thanks again...

bunalng commented Nov 29, 2017

Firstly, thanks for your interest.
I run only 1 single xmlrpc call. In console there is this error. In browser there is no error and worked perfectly. I run with links but i did not like this method. If i found anything i will inform you.

thanks again...

@bunalng

This comment has been minimized.

Show comment
Hide comment
@bunalng

bunalng Nov 29, 2017

error came from request.php ine 319 and 320:

            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
                PhpXmlRpc::$xmlrpcstr['invalid_return'] . $xmlRpcParser->_xh['isf_reason']);

bunalng commented Nov 29, 2017

error came from request.php ine 319 and 320:

            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
                PhpXmlRpc::$xmlrpcstr['invalid_return'] . $xmlRpcParser->_xh['isf_reason']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment