Why doesn't this code send the sruct?
"dgavinb" <[email protected]> Thu, 28 Feb 2008 00:39:27 -0000
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
Thanks in advance for any help you can provide!
What I'm trying to do seems so simple but, despite all my attempts, I
can't seem to find a solution.
*Here is what I want my client to send:
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>order</methodName>
<params>
<param>
<value>
<struct>
<member><name>username</name><value><string>TEST</string></value></member>
<member><name>password</name><value><string>TESTER</string></value></member>
<member><name>order_type</name><value><string>realAssessment</string></value></member>
<member><name>loan_number</name><value><string>ABC321</string></value></member>
<member><name>property_address</name><value><string>123 MAIN
ST</string></value></member>
<member><name>property_city</name><value><string>Buffalo</string></value></member>
<member><name>property_state</name><value><string>NY</string></value></member>
<member><name>property_zip</name><value><string>14224</string></value></member>
</struct>
</value>
</param>
</params>
</methodCall>
*Here is the PHP code I am trying to use to send it:
<html>
<head>
<title>XML-RPC PHP Demo</title>
</head>
<body>
<h1>XML-RPC PHP Demo</h1>
<?php
include 'xmlrpc.inc';
// Make an object to represent our server.
$server = new xmlrpc_client('http://webapp.real-info.com/xml/order.asp');
// Send a message to the server.
$myArray = new xmlrpcval(
array(
'username'=>new xmlrpcval('TEST', 'string'),
'password'=>new xmlrpcval('TESTER', 'string'),
'order_type'=>new xmlrpcval('realAssessment', 'string'),
'loan_number'=>new xmlrpcval('0033', 'string'),
'property_address'=>new xmlrpcval('123 MAIN ST', 'string'),
'property_city'=>new xmlrpcval('Buffalo', 'string'),
'property_state'=>new xmlrpcval('NY', 'string'),
'property_zip'=>new xmlrpcval('14224', 'string')
),
'struct');
$message = new xmlrpcmsg('order', $myArray);
$server->setdebug(2);
$result = $server->send($message);
// Process the response.
if (!$result) {
print "<p>Could not connect to HTTP server.</p>";
} elseif ($result->faultCode()) {
print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
$result->faultString();
} else {
$outString = $result->serialize();
print $outString;
}
?>
</body></html>
*Why doesn't this code send the sruct? Here is the result of my debug
code and response from the server:
---SENDING---
POST /xml/order.asp HTTP/1.0
User-Agent: XML-RPC for PHP 2.2
Host: webapp.real-info.com:80
Accept-Encoding: gzip, deflate
Accept-Charset: UTF-8,ISO-8859-1,US-ASCII
Content-Type: text/xml
Content-Length: 98
<?xml version="1.0"?>
<methodCall>
<methodName>order</methodName>
<params>
</params>
</methodCall>
---END---
---GOT---
HTTP/1.1 200 OK
Date: Thu, 28 Feb 2008 00:31:47 GMT
Server: REAL-INFO Web Server/1.0.0
Connection: close
Content-Type: text/xml
Content-Encoding: gzip
Content-Length: 238
������`Kj1÷9
uw
çÝôÁEb?<CÓÓ×&Ú@Wú$ëñËÂã§`"áë·/P8GëÂåÐ9Ýîu¿é»£^¡§|ö$Å
Tɰñ¢Wp§"Fª(ÇsJ±ÿ
¾;ÁxÒÄÕÌ-¾TWÏ
¬÷=ªj[zÈ@õØô
'/¿f`eWýæD
!�a¬Ö8&â|c-"È"[bÈ·D÷/PµNÿj&ªð\©z:`VÒ>~ÉBÕnÔ@*ý¼è7-}IØ��
---END---
HEADER: date: Thu, 28 Feb 2008 00:31:47 GMT
HEADER: server: REAL-INFO Web Server/1.0.0
HEADER: connection: close
HEADER: content-type: text/xml
HEADER: content-encoding: gzip
HEADER: content-length: 238
---INFLATED RESPONSE---[527 chars]---
<?xml version="1.0" encoding="iso-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>error</name>
<value>
<int>91</int>
</value>
</member>
<member>
<name>err_msg</name>
<value>
<string>Missing loan number, property address, order type or
property zip</string>
</value>
</member>
<member>
<name>avm_name</name>
<value>
<string/>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
---END---
---PARSED---
xmlrpcval::__set_state(array(
'me' =>
array (
'struct' =>
array (
'error' =>
xmlrpcval::__set_state(array(
'me' =>
array (
'int' => 91,
),
'mytype' => 1,
'_php_class' => NULL,
)),
'err_msg' =>
xmlrpcval::__set_state(array(
'me' =>
array (
'string' => 'Missing loan number, property address, order
type or property zip',
),
'mytype' => 1,
'_php_class' => NULL,
)),
'avm_name' =>
xmlrpcval::__set_state(array(
'me' =>
array (
'string' => '',
),
'mytype' => 1,
'_php_class' => NULL,
)),
),
),
'mytype' => 3,
'_php_class' => NULL,
))
---END---
error 91 err_msg Missing loan number, property address, order type or
property zip avm_name
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/xml-rpc/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/