XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2003, 10:07 PM
antoan antoan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: London
Posts: 2 antoan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to antoan
Question Xml - Rpc Js && Php

Hi,

Has anyone built a JS client making XML RPC calls to PHP PRC enabled server?

I can invoke server methods with the client using the xmlrpc-epi-php library OK
But not with js.

More specifically if I use js Microsoft.XMLHTTP activeX object and send the server replies:
faultString server error. method not found. faultCode -32601

If this looks familiar please respond : )

xmlhttp.send("<?xml version='1.0' encoding='iso-8859-1' ?> <methodCall>echo1<methodName> </methodName><params> <param> <value> <string>HELLO</string> </value> </param></params></methodCall>");


Thanx

Reply With Quote
  #2  
Old October 2nd, 2003, 02:34 PM
antoan antoan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: London
Posts: 2 antoan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to antoan
Well I managed to work it out by my self so there! : )

Here is a sample code of how I do it 4 anyone that needs to know:

JS client making a RPC call to a PHP server:

The server method "echo" simply returns the parameter massed to it.



<script language="JavaScript">

// Creating an MS XMLHTTP request object - get the latest SDK for v4.0
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");

//Open the connection
xmlhttp.Open("POST","/server_xmlrpc.php", false);

// Define the XML Header
xmlhttp.setRequestHeader("User-Agent", "xmlrpc-epi-php/0.2 (PHP)");
xmlhttp.setRequestHeader("Content-Type", "text/xml");


// Define ther xml request into a string
var xml_request = "<?xml version='1.0' ?>"+
"<methodCall>"+
"<methodName>echo</methodName>"+
"<params>"+
"<param>"+
"<value>"+
"<string>I've done it at last!</string>"+
"</value>"+
"</param>"+
"</params>"+
"</methodCall>";

// set the xml content length
var length = xml_request.length;
xmlhttp.setRequestHeader("Content-length", length);

// send the request
xmlhttp.send(xml_request);

// retreive output from the server
var out = xmlhttp.responseText;
document.write(out);

</script>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Xml - Rpc Js && Php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT