Hi Richard - any string can be used in the XmlRpcMethod attribute
constructor to specify the name of the XML-RPC method to be called,
for example:
class SumAndDiffProxy : XmlRpcClientProtocol
{
[XmlRpcMethod("samples.sumAndDifference")]
SumAndDiffValue SumAndDifference(int x, int y)
{
return (SumAndDiffValue)Invoke("SumAndDifference",
new Object[]{ x, y });
}
}
In this case the resulting XML-RPC request XML document will contain:
<methodName>samples.sumAndDifference</methodName>
So you should not have a problem with XML-RPC method names such
as 'Send.SMS' and 'Create.Fleet'.
- Charles
--- In XMLRPCNET@y..., "Richard Thurbin" <richard.thurbin@a...> wrote:
> Thanks Charles for the pointers on where I was going wrong.
>
> I sorted it by making all the 'Login' keywords to be the same:
>
> <XmlRpcMethod("Login")> Public Function Login(ByVal Username As
String,
> ByVal Password As String) As String
> Return xmlRpcClient.Invoke(Me, "Login", New Object()
{Username,
> Password})
> End Function
>
>
> The company we are RPC'ing to has called all its method names
things like
> 'Send.SMS' and 'Create.Fleet'. Am I right in thinking that the '.'
in the
> method names means it is not compatible with allowed .NET method
names, and
> do you know if I can work around this?
>
>
> Thanks for your help.
>
> Thanks,
> Richard Thurbin
> Software Developer
> Phone: 01223 728 718
> Mail: richard.thurbin@a...
> Web: www.acis-cam.uk.com
>
> ACIS Research and Development
> Deanland House
> 2nd Floor
> Cowley Road
> Cambridge CB4 0DL
>
> -----Original Message-----
> From: charlescookuk [mailto:charlescook@u...]
> Sent: 11 July 2002 21:05
> To: XMLRPCNET@y...
> Subject: [XMLRPCNET] Re: Please help: System.Exception: Invoke on
> non-existent proxy method
>
>
> Hi Richard - could you confirm that the first parameter passed to
> Invoke is the name of the proxy method, and not the name of the XML-
> RPC method being called (if different) or just mis-spelt?
>
> - Charles
>
>
> --- In XMLRPCNET@y..., "Richard Thurbin" <richard.thurbin@a...>
wrote:
> > I am getting the following error when trying to call a RPC.
> >
> > Unhandled Exception: The thread 'MainGFRLoop' (0x310) has exited
> with code 0
> > (0x0).
> > System.Exception: Invoke on non-existent proxy method
> > at CookComputing.XmlRpc.XmlRpcClientProtocol.GetRpcMethodName
> (Object
> > clientObj, String MethodName)
> > at CookComputing.XmlRpc.XmlRpcClientProtocol.MakeXmlRpcRequest
> (WebRequest
> > webReq, String methodName, Object[] parameters, Object clientObj)
> > at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object
> clientObj,
> > String methodName, Object[] parameters)
> > at SMSClient.SMSLocaVista.LoginSMS(String Username, String
> Password) in
> > D:\Source\SMSClient\SMSLocaVista.vb:line 88
> > at SMSClient.SMSLocaVista.SortOutLogin() in
> > D:\Source\SMSClient\SMSLocaVista.vb:line 235
> > at SMSClient.SMSLocaVista.MainLVLoop() in
> > D:\Source\SMSClient\SMSLocaVista.vb:line 114
> >
> > Am I right in thinking this is not a method implemented at the
> other end?
> >
> > Thanks,
> > Richard Thurbin
> > Software Developer
> > Phone: 01223 728 718
> > Mail: richard.thurbin@a...
> > Web: www.acis-cam.uk.com
> >
> > ACIS Research and Development
> > Deanland House
> > 2nd Floor
> > Cowley Road
> > Cambridge CB4 0DL
>
>
> Yahoo! Groups Sponsor
>
>
> To unsubscribe from this group, send an email to:
> XMLRPCNET-unsubscribe@y...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Thanks Charles for the pointers on where I was going wrong.
I sorted it by making all the 'Login' keywords to be the same:
<XmlRpcMethod("Login")> Public Function Login(ByVal Username As String,
ByVal Password As String) As String
Return xmlRpcClient.Invoke(Me, "Login", New Object() {Username,
Password})
End Function
The company we are RPC'ing to has called all its method names things like
'Send.SMS' and 'Create.Fleet'. Am I right in thinking that the '.' in the
method names means it is not compatible with allowed .NET method names, and
do you know if I can work around this?
Thanks for your help.
Thanks,
Richard Thurbin
Software Developer
Phone: 01223 728 718
Mail: richard.thurbin@...
Web: www.acis-cam.uk.com
ACIS Research and Development
Deanland House
2nd Floor
Cowley Road
Cambridge CB4 0DL
-----Original Message-----
From: charlescookuk [mailto:charlescook@...]
Sent: 11 July 2002 21:05
To: XMLRPCNET@yahoogroups.com
Subject: [XMLRPCNET] Re: Please help: System.Exception: Invoke on
non-existent proxy method
Hi Richard - could you confirm that the first parameter passed to
Invoke is the name of the proxy method, and not the name of the XML-
RPC method being called (if different) or just mis-spelt?
- Charles
--- In XMLRPCNET@y..., "Richard Thurbin" <richard.thurbin@a...> wrote:
> I am getting the following error when trying to call a RPC.
>
> Unhandled Exception: The thread 'MainGFRLoop' (0x310) has exited
with code 0
> (0x0).
> System.Exception: Invoke on non-existent proxy method
> at CookComputing.XmlRpc.XmlRpcClientProtocol.GetRpcMethodName
(Object
> clientObj, String MethodName)
> at CookComputing.XmlRpc.XmlRpcClientProtocol.MakeXmlRpcRequest
(WebRequest
> webReq, String methodName, Object[] parameters, Object clientObj)
> at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object
clientObj,
> String methodName, Object[] parameters)
> at SMSClient.SMSLocaVista.LoginSMS(String Username, String
Password) in
> D:\Source\SMSClient\SMSLocaVista.vb:line 88
> at SMSClient.SMSLocaVista.SortOutLogin() in
> D:\Source\SMSClient\SMSLocaVista.vb:line 235
> at SMSClient.SMSLocaVista.MainLVLoop() in
> D:\Source\SMSClient\SMSLocaVista.vb:line 114
>
> Am I right in thinking this is not a method implemented at the
other end?
>
> Thanks,
> Richard Thurbin
> Software Developer
> Phone: 01223 728 718
> Mail: richard.thurbin@a...
> Web: www.acis-cam.uk.com
>
> ACIS Research and Development
> Deanland House
> 2nd Floor
> Cowley Road
> Cambridge CB4 0DL
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
XMLRPCNET-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Hi Richard - could you confirm that the first parameter passed to
Invoke is the name of the proxy method, and not the name of the XML-
RPC method being called (if different) or just mis-spelt?
- Charles
--- In XMLRPCNET@y..., "Richard Thurbin" <richard.thurbin@a...> wrote:
> I am getting the following error when trying to call a RPC.
>
> Unhandled Exception: The thread 'MainGFRLoop' (0x310) has exited
with code 0
> (0x0).
> System.Exception: Invoke on non-existent proxy method
> at CookComputing.XmlRpc.XmlRpcClientProtocol.GetRpcMethodName
(Object
> clientObj, String MethodName)
> at CookComputing.XmlRpc.XmlRpcClientProtocol.MakeXmlRpcRequest
(WebRequest
> webReq, String methodName, Object[] parameters, Object clientObj)
> at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object
clientObj,
> String methodName, Object[] parameters)
> at SMSClient.SMSLocaVista.LoginSMS(String Username, String
Password) in
> D:\Source\SMSClient\SMSLocaVista.vb:line 88
> at SMSClient.SMSLocaVista.SortOutLogin() in
> D:\Source\SMSClient\SMSLocaVista.vb:line 235
> at SMSClient.SMSLocaVista.MainLVLoop() in
> D:\Source\SMSClient\SMSLocaVista.vb:line 114
>
> Am I right in thinking this is not a method implemented at the
other end?
>
> Thanks,
> Richard Thurbin
> Software Developer
> Phone: 01223 728 718
> Mail: richard.thurbin@a...
> Web: www.acis-cam.uk.com
>
> ACIS Research and Development
> Deanland House
> 2nd Floor
> Cowley Road
> Cambridge CB4 0DL
I am getting the following error when trying to call a RPC.
Unhandled Exception: The thread 'MainGFRLoop' (0x310) has exited with code 0
(0x0).
System.Exception: Invoke on non-existent proxy method
at CookComputing.XmlRpc.XmlRpcClientProtocol.GetRpcMethodName(Object
clientObj, String MethodName)
at CookComputing.XmlRpc.XmlRpcClientProtocol.MakeXmlRpcRequest(WebRequest
webReq, String methodName, Object[] parameters, Object clientObj)
at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj,
String methodName, Object[] parameters)
at SMSClient.SMSLocaVista.LoginSMS(String Username, String Password) in
D:\Source\SMSClient\SMSLocaVista.vb:line 88
at SMSClient.SMSLocaVista.SortOutLogin() in
D:\Source\SMSClient\SMSLocaVista.vb:line 235
at SMSClient.SMSLocaVista.MainLVLoop() in
D:\Source\SMSClient\SMSLocaVista.vb:line 114
Am I right in thinking this is not a method implemented at the other end?
Thanks,
Richard Thurbin
Software Developer
Phone: 01223 728 718
Mail: richard.thurbin@...
Web: www.acis-cam.uk.com
ACIS Research and Development
Deanland House
2nd Floor
Cowley Road
Cambridge CB4 0DL
If you use XML-RPC.NET please note the following bug.
If an array occurs in a position in an XML-RPC request or response
where the type of its elements is not known <b>AND</b> one or more of
its elements is a string specified without the <string> element, an
exception is incorrectly thrown by the deserializer. The response
below is an example of where the problem occurs.
The two string instances are in an array member of a struct and no
type information is available to the serializer. (In this case the
array should be parsed into an array of type Object[].)
I'll release a fix for this in the next day or two.
<?xml version="1.0" encoding="ISO-8859-1"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>key3</name>
<value>
<array>
<data>
<value>New Milk</value>
<value>Old Milk</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
This line causes the problem:
Dim param(1) As Object
It actually defines a 2 element array! The 2nd element ends up
containing null when Invoke is called. The following works:
Dim param(0) As Object
I've made a note to handle this VB.NET quirk in the next version of
the library.
- Charles
--- In XMLRPCNET@y..., "perry_ismangil" <ismangil@a...> wrote:
>
> I am trying to access Xindice from VB.NET, via XML-RPC.
>
> I have tested the Xindice-XMLRPC using Java clients and it works.
>
> I am now trying with XMLRPC.Net and all I got was Null pointers
> exception when I do 'Invoke'. Here is the code:
>
> <CookComputing.XmlRpc.XmlRpcUrl("http://localhost:4080/")> _
> Public Class Xindice
> Inherits CookComputing.XmlRpc.XmlRpcClientProtocol
>
> <CookComputing.XmlRpc.XmlRpcMethod("db.listCollections")> _
> Public Function listCollections(ByVal name As String) As String()
> Dim coll() As String = {}
> Dim param(1) As Object
> Dim result As Object()
>
> param(0) = New String(name)
>
> Invoke("listCollections", param)
>
>
> Return coll
>
> End Function
>
> Thanks
I am trying to access Xindice from VB.NET, via XML-RPC.
I have tested the Xindice-XMLRPC using Java clients and it works.
I am now trying with XMLRPC.Net and all I got was Null pointers
exception when I do 'Invoke'. Here is the code:
<CookComputing.XmlRpc.XmlRpcUrl("http://localhost:4080/")> _
Public Class Xindice
Inherits CookComputing.XmlRpc.XmlRpcClientProtocol
<CookComputing.XmlRpc.XmlRpcMethod("db.listCollections")> _
Public Function listCollections(ByVal name As String) As String()
Dim coll() As String = {}
Dim param(1) As Object
Dim result As Object()
param(0) = New String(name)
Invoke("listCollections", param)
Return coll
End Function
Thanks
Hi Simon - the XML-RPC spec is a bit vague in this area, to say the
least. It says the dateTime format is ISO 8601 but does not take into
account that this standard specfies several different formats.
My understanding is that dateTimes in XML-RPC should always be of this
format:
YYYYMMDDTHH:mm:SS
i.e. without timezone, and no hyphens between YYYYMMDD (which is
allowed by ISO 8601). This is the position taken in the book
"Programming Web Services with XML-RPC".
So the current XML-RPC.NET implementation is strictly adhering to the
XML-RPC standard. I suppose I should really implement XML-RPC.NET to
accept different formats but only output the format above.
- Charles
--- In XMLRPCNET@y..., "simonfell99" <soap@z...> wrote:
> I'm trying to send a dateTime to a XML-RPC.NET server as
> <dateTime.iso8601>2002-05-11T12:48:37Z</dateTime.iso8601>
>
> but i get this error
> HTTP/1.1 400 dateTime element is invalid.
>
> AFAICS Its a valid iso8601 date, is it not expecting to get a TZ
> trailer ? [i notice the examples in the spec don't show timezones]
>
> Thanks
> Simon
I'm trying to send a dateTime to a XML-RPC.NET server as
<dateTime.iso8601>2002-05-11T12:48:37Z</dateTime.iso8601>
but i get this error
HTTP/1.1 400 dateTime element is invalid.
AFAICS Its a valid iso8601 date, is it not expecting to get a TZ
trailer ? [i notice the examples in the spec don't show timezones]
Thanks
Simon
I've received a couple of emails about a missing key file if you try
to build XML-RPC.NET from the distribution. The problem is that I've
generated my own key file using sn.exe (Strong Name Utility) and I
want to reserve this for use only with assemblies I distribute.
Therefore CookComputing.key is not included in the distribution. The
workaround is to either generate your own key file using sn.exe or
comment out the following line in AssemblyInfo.cs:
[assembly: AssemblyKeyFile("..\\..\\..\\CookComputing.key")]
Re earlier posting about generating proxies automatically using the
RealProxy class, it won't work unless the code is running with extra
security permissions or full trust. Issues described in more detail
here:
http://www.cookcomputing.com/archive/2002_05_01_archive.html#76222164
I received Ingo Rammer's excellent book Advanced .NET Remoting from
Amazon a few days ago and this was the spur I needed to experiment
with .NET Remoting. After a couple of long coding sessions this
weekend I've released version 0.5.0 of XML-RPC.NET which contains XML-
RPC client and server formatter sinks. These enable the .NET remoting
infrastructure to be used to implement both XML-RPC clients and
servers. In addition, the server-side formatter can be configured so
that a server can simultaneously support both XML-RPC and SOAP
requests. If the XML-RPC formatter detects an incoming request is a
SOAP request, it forwards the request to the default SOAP formatter;
otherwise it processes the request as an XML-RPC request.
Some preliminary documentation on .NET Remoting is included on the
Samples page. It should be noted that the XML-RPC formatter is not
intended to replace SOAP when making calls between .NET clients. The
XML-RPC serialization code is designed for use with XML-RPC
parameters and is not as comprehensive as the built-in SOAP
serialization code, so there wouldn't be much point in using XML-RPC
in this scenario.The XML-RPC formatter is instead intended to be used
where either client or server is not based on .NET Remoting and XML-
RPC is being used, or where a server is required to handle both SOAP
and XML-RPC requests.
http://www.cookcomputing.com/xmlrpc/http://www.cookcomputing.com/xmlrpc/xmlrpcsamples.html
When using a .NET struct type as a parameter or return value, the
members of the struct must be declared as public or else they will be
ignored. For example, both the members in this struct will be
serialized/deserialized:
public struct myStructA
{
public int x;
public string s;
}
but only member x will be serialized/deserialized in this struct:
public struct myStructB
{
public int x;
string s;
}
This is because XML-RPC.NET uses the System.Type.GetMembers method to
determine which member variables should be serialized/deserialized
from/to a struct and this method only returns information about
public members.
I believe it is possible to reflect on private members but I think
that requires extra security permissions which, for example, means
that the XML-RPC.NET assembly could not be used in the default
Internet security zone (say as a component used by a
downloadable "smart client", or by a control on a web page).
Given that Blogger is probably the most interesting public XML-RPC
service available, here is a sample proxy class. A test client using
this proxy will follow shortly.
I'm not having much luck with the GetUserInfo method at the moment.
The Blogger service returns a fault response describing a Java
exception.
using System;
using CookComputing.XmlRpc;
namespace CookComputing.XmlRpc.BloggerAPI
{
public struct UserBlog
{
public string blogid;
public string blogName;
public string url;
}
public struct UserInfo
{
public string userid;
public string firstname;
public string lastname;
public string nickname;
public string email;
public string url;
}
public struct RecentPost
{
public DateTime dateCreated;
public string userid;
public string postid;
public string content;
}
[XmlRpcUrl("http://plant.blogger.com/api/RPC2")]
public class BloggerAPI : XmlRpcClientProtocol
{
[XmlRpcMethod("blogger.newPost")]
public string NewPost(
string appkey,
string blogid,
string username,
string password,
string contents,
bool publish)
{
return (string)Invoke("NewPost", new object[]
{appkey, blogid, username, password, contents, publish});
}
[XmlRpcMethod("blogger.editPost")]
public bool EditPost(
string appkey,
string postid,
string username,
string password,
string contents,
bool publish)
{
return (bool)Invoke("EditPost", new object[]
{appkey, postid, username, password, contents, publish});
}
[XmlRpcMethod("blogger.getUsersBlogs")]
public UserBlog[] GetUsersBlogs(
string appkey,
string username,
string password)
{
return (UserBlog[])Invoke("GetUsersBlogs", new object[]
{appkey, username, password});
}
[XmlRpcMethod("blogger.getUserInfo")]
public UserInfo GetUserInfo(
string appkey,
string username,
string password)
{
return (UserInfo)Invoke("GetUserInfo", new object[]
{appkey, username, password});
}
[XmlRpcMethod("blogger.getTemplate")]
public string GetTemplate(
string appkey,
string blogid,
string username,
string password,
string templateType)
{
return (string)Invoke("GetTemplate", new object[]
{appkey, blogid, username, password, templateType});
}
[XmlRpcMethod("blogger.setTemplate")]
public string SetTemplate(
string appkey,
string blogid,
string username,
string password,
string template,
string templateType)
{
return (string)Invoke("SetTemplate", new object[]
{appkey, blogid, username, password,
template, templateType});
}
[XmlRpcMethod("blogger.getRecentPosts")]
public RecentPost[] GetRecentPosts(
string appkey,
string blogid,
string username,
string password,
int numberOfPosts)
{
return (RecentPost[])Invoke("GetRecentPosts", new object[]
{appkey, blogid, username, password, numberOfPosts});
}
}
}
I've been experimenting with the idea of using the .NET framework
class RealProxy to automatically generate a proxy which implements
the required interface.
To implement an XmlRpc client two tasks would be required:
(1) Define an interface representing the methods exposed by the
server endpoint. For example:
interface IStateName
{
string GetStateName(int StateNumber);
}
(2) Create an instance of the interface:
XmlRpcClientProtocol cp = new XmlRpcClientProtocol();
IStateName isn = (IStateName)cp.CreateProxy(typeof(IStateName));
This saves having to implement the methods (i.e. calling Invoke for
each method) and feels better because it emphasises the abstract
definition of the interaction with the server.
This is the sample code I've used to investigate this idea. The
intermediate class derived from SmartProxy is required because we can
only use single inheritance (the actual XmlRpcClientProtocol class
already derives from WebClientProtocol).
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
interface IStateName
{
string GetStateName(int StateNumber);
}
class XmlRpcClientProtocol
{
public object CreateProxy(Type t)
{
XmlRpcRealProxy rp = new XmlRpcRealProxy(this, t);
return rp.GetTransparentProxy();
}
public object Invoke(string method, object[] args)
{
if (method == "GetStateName")
{
int stateNumber = (int) args[0];
return String.Format("StateName_{0}", stateNumber);
}
throw new Exception("unsupported method");
}
}
class XmlRpcRealProxy : RealProxy
{
public XmlRpcRealProxy (XmlRpcClientProtocol cp, Type t)
: base (t)
{
clientProtocol = cp;
}
public override IMessage Invoke (IMessage msg)
{
IMethodCallMessage mcm = (IMethodCallMessage) msg;
object retObj = clientProtocol.Invoke(mcm.MethodName, mcm.InArgs);
IMethodReturnMessage mr
= new ReturnMessage (retObj, null, 0, null, mcm);
return mr;
}
XmlRpcClientProtocol clientProtocol;
}
class _
{
static void Main ()
{
XmlRpcClientProtocol cp = new XmlRpcClientProtocol();
IStateName isn = (IStateName)cp.CreateProxy(typeof(IStateName));
Console.WriteLine (isn.GetStateName(1));
}
}
This sample illustrates how the XmlRpcSerializer class can be used to
serialize and deserialize XML-RPC requests and responses between
instance of the XmlRpcRequest/XmlRpcResponse classes and XML
documents in streams. The output from this sample program is included
below.
using System;
using System.IO;
using CookComputing.XmlRpc;
class App
{
static void Main(string[] args)
{
XmlRpcSerializer slr = new XmlRpcSerializer();
// package parameters to call as object array
object[] parms = new object[] { 1234 };
// stream to contain the serialized request
Stream reqStm = new MemoryStream();
// create a request - method name and parameters
XmlRpcRequest req1 = new XmlRpcRequest("echo", parms);
// serialize request to the stream
slr.SerializeRequest(reqStm, req1);
Console.WriteLine("Request XML document is:");
DumpStream(reqStm);
// deserialize back to a request - don't pass class type
// for mapping structs and arrays more accurately
reqStm.Position = 0;
XmlRpcRequest req2 = slr.DeserializeRequest(reqStm, null);
Console.WriteLine("Request contains: {0} {1}",
req2.args[0].GetType(), req2.args[0]);
// return value is always a single object
object retValue = "1234";
// stream to contain the serialized request
Stream respStm = new MemoryStream();
// create a request - just the return value
XmlRpcResponse resp1 = new XmlRpcResponse(retValue);
// serialize response to the stream
slr.SerializeResponse(respStm, resp1);
Console.WriteLine("Response XML document is:");
DumpStream(respStm);
// deserialize back to a response - don't pass class type
// for mapping structs and arrays more accurately
respStm.Position = 0;
XmlRpcResponse resp2 = slr.DeserializeResponse(respStm, null);
Console.WriteLine("Response contains: {0} {1}",
resp2.retVal.GetType(), resp2.retVal);
}
static void DumpStream(Stream stm)
{
stm.Position = 0;
StreamReader srdr = new StreamReader(stm);
string s = srdr.ReadLine();
while (s != null)
{
Console.WriteLine(s);
s = srdr.ReadLine();
}
}
}
Request XML document is:
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>echo</methodName>
<params>
<param>
<value>
<i4>1234</i4>
</value>
</param>
</params>
</methodCall>
Request contains: System.Int32 1234
Response XML document is:
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
<params>
<param>
<value>
<string>1234</string>
</value>
</param>
</params>
</methodResponse>
Response contains: System.String 1234
Version 0.4.3 of XML-RPC.NET is now available. Its an interim release
with a few bug fixes, mainly in the serialization/deserialization
code.
http://www.cookcomputing.com/xmlrpc/index.html
> > http://groups.yahoo.com/group/XMLRPCNET/messages?rss=1&viscount=15
> > This and 7000 other RSS feeds can be found at http://www.syndic8.com
> > There's an XML-RPC interface into it as well.
That's excellent, thanks! That RSS file is now in the database:
http://www.syndic8.com/feedinfo.php?FeedID=7263
I've been doing quite a bit of XML-RPC work on Syndic8. It's providing a pretty
convenient way to keep the database updated with info. Lately I've been pushing
geographic data into it via xml-rpc calls. It's not as efficient as, say, bulk
updates, but it's a lot more convenient.
If anyone's interested in doing .Net integration with it let me know. I'd be
interested in talking about it.
-Bill Kearney
Done.
--- In XMLRPCNET@y..., "Bill Kearney" <wkearney99@h...> wrote:
...
> You need to make one more change. The archives must be readable by
everyone,
> not just members.
>
> Once that change is made the RSS file for the group will be
readable via this
> URL:
> http://groups.yahoo.com/group/XMLRPCNET/messages?
rss=1&viscount=15
>
> This and 7000 other RSS feeds can be found at http://www.syndic8.com
>
> There's an XML-RPC interface into it as well.
>
> -Bill Kearney
Sounds great!, I am looking forward to the release. If you would like me
to test it beforehand, I can do that. But it seems like you have it
wrapped up.
I appreciate your work on this project, it's allowed me to experiment
with .NET in a context which I enjoy.
- Jevon
-
-----Original Message-----
From: charlescookuk [mailto:charlescook@...]
Sent: Friday, April 05, 2002 12:57 PM
To: XMLRPCNET@yahoogroups.com
Subject: [XMLRPCNET] Re: XmlRpcStruct into my own Struct
I just checked the diffs for the deserialization code and spotted a
change I made following the last release (the RTM version of .NET
requires a change in the code that gets the Type object from the name
of a type). I'll put out a release tomorrow with this fix tomorrow.
- Charles
--- In XMLRPCNET@y..., "Jevon MacDonald" <jevon@m...> wrote:
>
>
> I should have been more clear and said that I had gone the route as
> well.
>
[Non-text portions of this message have been removed]
> At Bill Kearney's suggestion I am changing the policy of the group to
> allow anyone to post and view the items. This allows the group to be
> read in RSS format. I have also changed the moderation policy to be
> unmoderated but moderated for new members, i.e. when someone joins
> the groups their postings have to be moderated until I change their
> individual setting to unmoderated. This is intended to catch spam
> merchants.
You need to make one more change. The archives must be readable by everyone,
not just members.
Once that change is made the RSS file for the group will be readable via this
URL:
http://groups.yahoo.com/group/XMLRPCNET/messages?rss=1&viscount=15
This and 7000 other RSS feeds can be found at http://www.syndic8.com
There's an XML-RPC interface into it as well.
-Bill Kearney
I just checked the diffs for the deserialization code and spotted a
change I made following the last release (the RTM version of .NET
requires a change in the code that gets the Type object from the name
of a type). I'll put out a release tomorrow with this fix tomorrow.
- Charles
--- In XMLRPCNET@y..., "Jevon MacDonald" <jevon@m...> wrote:
>
>
> I should have been more clear and said that I had gone the route as
> well.
>
I should have been more clear and said that I had gone the route as
well.
Whenever I try to return a blogStruct[] (with the blogStruct 's elements
triple checked against what is being returned), I get an error that says
"Object cannot be stored in array of this type."
-----Original Message-----
From: charlescook@... [mailto:charlescook@...]
Sent: Friday, April 05, 2002 8:27 AM
To: XMLRPCNET@yahoogroups.com
Subject: Re: [XMLRPCNET] XmlRpcStruct into my own Struct
Your GetUsersBlogs function should return an
array of blogStruct:
[XmlRpcMethod("blogger.getUsersBlogs")]
public blogStruct[] GetUsersBlogs()
{
...
}
This works because as long as the members in
blogStruct have the same names and compatible
types as the members in the struct in the
response, XML-RPC.NET can automatically map
values between the two (I think this is the case
with this method). In the next release or two I'm
adding an optional attribute which allows you to
define a different mapping, for example:
[XmlRpcMethod("blogger.getUsersBlogs")]
public blogStruct[] GetUsersBlogs()
{
[XmlRpcMember("isAdmin")
public bool m_bAdmin;
...
}
This would be necessary, for example, if the XML-
RPC struct member name was not CLS-compliant.
XmlRpcStruct has to be used where some of the
members are not necessarily returned in the
response or where you want to pass structs
without a fixed set of members (as in the Web Bug
Simulator example). Conversely, where a response
returns a struct with members not defined in
the .NET struct, XML-RPC.NET will simply ignore
these members; useful if an API is extended by
adding struct members, as in this case where the
isAdmin member has been added to the struct
returned by getUsersBlogs.
A couple of other points. First, from the point
of view of the proxy code you don't need to
define the constructor in blogStruct (of course,
you may need this for other reasons). Second, my
personal approach to proxy code is to keep the
parameters as close as possible to the XML-RPC
method parameters and not use variables from a
scope outside the proxy function. Makes the proxy
code more reusable I suppose.
- Charles
Quoting jevonmac <jevon@...>:
> Hello everyone;
>
> I am playing with the blogger API (an XML-RPC
service).
>
> I can take an Array of XmlRpcStruct properly,
but I would like to
> access the XmlRpcStruct like this
>
> XmlRpcStruct[1].keyInStruct
>
>
> How is this possible?
>
> I currently have
>
> public struct blogStruct
> {
> public bool isAdmin;
> public int blogid;
> public string blogName;
> public string url;
>
> public blogStruct(bool isAdmin,
int blogid, string
> blogName, string url)
> {
> this.isAdmin = isAdmin;
> this.blogid = blogid;
> this.blogName = blogName;
> this.url = url;
> }
> }
>
> [... and ...]
>
> [XmlRpcMethod
("blogger.getUsersBlogs")]
> public XmlRpcStruct[]
GetUsersBlogs()
> {
> return (XmlRpcStruct[])
this.Invoke
> ("GetUsersBlogs", new object[] {"appkey",
> bIntUser.bloggerUsername ,
bIntUser.bloggerPassword});
> }
>
-------------------------------------------------
This mail sent through UK Online webmail
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://rd.yahoo.com/M=215002.1954253.3462811.1261774/D=egroupweb/S=1707
281942:HM/A=1000239/R=0/*http:/ads.x10.com/?bHlhaG9vaG0xLmRhd=1018009640
%3eM=215002.1954253.3462811.1261774/D=egroupweb/S=1707281942:HM/A=100023
9/R=1>
<http://us.adserver.yahoo.com/l?M=215002.1954253.3462811.1261774/D=egrou
pmail/S=1707281942:HM/A=1000239/rand=603719726>
To unsubscribe from this group, send an email to:
XMLRPCNET-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo!
<http://docs.yahoo.com/info/terms/> Terms of Service.
[Non-text portions of this message have been removed]
At Bill Kearney's suggestion I am changing the policy of the group to
allow anyone to post and view the items. This allows the group to be
read in RSS format. I have also changed the moderation policy to be
unmoderated but moderated for new members, i.e. when someone joins
the groups their postings have to be moderated until I change their
individual setting to unmoderated. This is intended to catch spam
merchants.
- Charles
Just noticed some cut&paste that went haywire.
The example code for XmlRpcMember attribute
should have been:
public blogStruct
{
[XmlRpcMember("isAdmin")]
public bool m_bAdmin;
...
}
- Charles
-------------------------------------------------
This mail sent through UK Online webmail
Your GetUsersBlogs function should return an
array of blogStruct:
[XmlRpcMethod("blogger.getUsersBlogs")]
public blogStruct[] GetUsersBlogs()
{
...
}
This works because as long as the members in
blogStruct have the same names and compatible
types as the members in the struct in the
response, XML-RPC.NET can automatically map
values between the two (I think this is the case
with this method). In the next release or two I'm
adding an optional attribute which allows you to
define a different mapping, for example:
[XmlRpcMethod("blogger.getUsersBlogs")]
public blogStruct[] GetUsersBlogs()
{
[XmlRpcMember("isAdmin")
public bool m_bAdmin;
...
}
This would be necessary, for example, if the XML-
RPC struct member name was not CLS-compliant.
XmlRpcStruct has to be used where some of the
members are not necessarily returned in the
response or where you want to pass structs
without a fixed set of members (as in the Web Bug
Simulator example). Conversely, where a response
returns a struct with members not defined in
the .NET struct, XML-RPC.NET will simply ignore
these members; useful if an API is extended by
adding struct members, as in this case where the
isAdmin member has been added to the struct
returned by getUsersBlogs.
A couple of other points. First, from the point
of view of the proxy code you don't need to
define the constructor in blogStruct (of course,
you may need this for other reasons). Second, my
personal approach to proxy code is to keep the
parameters as close as possible to the XML-RPC
method parameters and not use variables from a
scope outside the proxy function. Makes the proxy
code more reusable I suppose.
- Charles
Quoting jevonmac <jevon@...>:
> Hello everyone;
>
> I am playing with the blogger API (an XML-RPC
service).
>
> I can take an Array of XmlRpcStruct properly,
but I would like to
> access the XmlRpcStruct like this
>
> XmlRpcStruct[1].keyInStruct
>
>
> How is this possible?
>
> I currently have
>
> public struct blogStruct
> {
> public bool isAdmin;
> public int blogid;
> public string blogName;
> public string url;
>
> public blogStruct(bool isAdmin,
int blogid, string
> blogName, string url)
> {
> this.isAdmin = isAdmin;
> this.blogid = blogid;
> this.blogName = blogName;
> this.url = url;
> }
> }
>
> [... and ...]
>
> [XmlRpcMethod
("blogger.getUsersBlogs")]
> public XmlRpcStruct[]
GetUsersBlogs()
> {
> return (XmlRpcStruct[])
this.Invoke
> ("GetUsersBlogs", new object[] {"appkey",
> bIntUser.bloggerUsername ,
bIntUser.bloggerPassword});
> }
>
-------------------------------------------------
This mail sent through UK Online webmail
Hello everyone;
I am playing with the blogger API (an XML-RPC service).
I can take an Array of XmlRpcStruct properly, but I would like to
access the XmlRpcStruct like this
XmlRpcStruct[1].keyInStruct
How is this possible?
I currently have
public struct blogStruct
{
public bool isAdmin;
public int blogid;
public string blogName;
public string url;
public blogStruct(bool isAdmin, int blogid, string
blogName, string url)
{
this.isAdmin = isAdmin;
this.blogid = blogid;
this.blogName = blogName;
this.url = url;
}
}
[... and ...]
[XmlRpcMethod("blogger.getUsersBlogs")]
public XmlRpcStruct[] GetUsersBlogs()
{
return (XmlRpcStruct[]) this.Invoke
("GetUsersBlogs", new object[] {"appkey",
bIntUser.bloggerUsername , bIntUser.bloggerPassword});
}
First of a series of samples based on some of the publicly used XML-
RPC APIs.
Technical background to the Web Bug Simulator described at:
http://www.xmlrpc.com/howTheWebBugSimulatorWorks
////////////////
// proxy Code
////////////////
using System;
using CookComputing.XmlRpc;
[XmlRpcUrl("http://subhonker6.userland.com/RPC2")]
class WebBugSimProxy : XmlRpcClientProtocol
{
[XmlRpcMethod("weblogStats.ping")]
public bool Ping(
string rss,
string title,
string url,
XmlRpcStruct theStruct)
{
return (bool)Invoke("Ping",
new object[] {rss, title, url, theStruct});
}
}
struct Feed
{
public int ctnewstories;
public string title;
public Feed(int CtNewStories, string Title)
{
ctnewstories = CtNewStories;
title = Title;
}
}
////////////////
// sample client
////////////////
class App
{
[STAThread]
static void Main(string[] args)
{
XmlRpcStruct feeds = new XmlRpcStruct();
feeds.Add("http://radio.weblogs.com/0001015/rss.xml",
new Feed(1, "Dave's Handsome Radio Blog!"));
feeds.Add("http://www.pocketsoap.com/weblog/rss.xml",
new Feed(1, "Simon Fell"));
WebBugSimProxy proxy = new WebBugSimProxy();
bool result = proxy.Ping("rss",
"Cook Computing",
@"http://www.cookcomputing.com/",
feeds);
Console.WriteLine("Result = {0}", result);
}
}