Hi,
I need to consume a webservice via XML-RPC for a private project.
I found a XML-RPC Testserver on the web (http://gggeek.raprap.it/debugger/
and deciced to call its functions.
The code I wrote is
Code:
<cfset xmlRPCCall = "<?xml version=""1.0""?>">
<cfset xmlRPCCall = xmlRPCCall & "<methodCall>">
<cfset xmlRPCCall = xmlRPCCall & "<methodName>system.listMethods</methodName>">
<cfset xmlRPCCall = xmlRPCCall & "<params>">
<cfset xmlRPCCall = xmlRPCCall & "</params>">
<cfset xmlRPCCall = xmlRPCCall & "</methodCall>">
<cfhttp url="http://phpxmlrpc.sourceforge.net/server.php" method="post">
<cfhttpparam type="HEADER" name="Content-Length" value="#len(xmlRPCCall)#">
<cfhttpparam type="XML" value="#xmlRPCCall#">
</cfhttp>
<cfdump var="#cfhttp#">
OK, when I call the script, the webservice returns the following message:
faultCode 103 faultString XML error: no element found at line 1, column 0
This is pretty weird, because the message says, that there is no body-data in the HTTP-Request. But as you can see in the script above, I send my XML-Code as type "XML" with the cfhttpparam-Tag.
OK, maybe Smith doesn't have implemented the type "XML" yet. So I tried the following code:
Code:
<cfset xmlRPCCall = "<?xml version=""1.0""?>">
<cfset xmlRPCCall = xmlRPCCall & "<methodCall>">
<cfset xmlRPCCall = xmlRPCCall & "<methodName>system.listMethods</methodName>">
<cfset xmlRPCCall = xmlRPCCall & "<params>">
<cfset xmlRPCCall = xmlRPCCall & "</params>">
<cfset xmlRPCCall = xmlRPCCall & "</methodCall>">
<cfhttp url="http://phpxmlrpc.sourceforge.net/server.php" method="post">
<cfhttpparam type="HEADER" name="Content-Length" value="#len(xmlRPCCall)#">
<cfhttpparam type="HEADER" name="Content-TYPE" value="text/xml">
<cfhttpparam type="BODY" value="#xmlRPCCall#">
</cfhttp>
<cfdump var="#cfhttp#">
Now I'm sending my XML-Code in the Body-Type of the HTTP-Request while indicating the content-type as text/xml. When I start this script, I get the same error as above:
faultCode 103 faultString XML error: no element found at line 1, column 0
This means, the script doesn't send the body-text to the XML-RPC Testserver, too.
Then I looked for another free ColdFusion Server on the web and found "Railo". In installed it and tried the same scripts (both) listed above..... and it worked! I received the correct Message from the XML-RPC Testserver.
So, my question... Is there a bug on the smith-server? Do you know, why the script doesn't send the Body-Message with CFHTTP on Smith? Or is there a mistake in my listed code?
Please help me, because I need the CFHTTP-Function and don't want to switch to a Non-Open-Source Server..
Thank you in advance,
and sorry for my bad english (I'm german ;-)