Real Software Forums
http://forums.realsoftware.com/

What is the best way to do XML-RPC?
http://forums.realsoftware.com/viewtopic.php?f=2&t=34895
Page 1 of 2

Author:  bcorwin [ Tue Aug 03, 2010 2:10 pm ]
Post subject:  What is the best way to do XML-RPC?

According to xmlrpc.com realStudio can do xml-rpc. However, when I search help and this forum I don't get anything. I need my app (written in realStudio) to communicate with another app on same machine via xml-rpc. Can realStudio do this naturally, or do I need a plug-in?

Thank you.

Author:  silverpie [ Thu Aug 05, 2010 12:29 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

Implementing XML-RPC requires four steps: creating messages, transmitting them, receiving them, and reading them. You can build the messages either as strings or as an XMLDocument, and read the ones from the other side by either of those two means or with an XMLReader. For the sending and receiving, you'll need an HTTPSocket (if you're the caller), one of the various RB webserver classes out there (if you're the receiver), or one of each.

Author:  Thom McGrath [ Thu Aug 05, 2010 1:10 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

If you only need client functionality, then here's your answer: http://thezaz.com/opensource/realbasic/xml/rpc/client/. If you need client and server, then why not implement your own protocol?

The classes above are the same classes that our Feedback app uses to do all of its communication, so they're pretty robust.

Author:  bcorwin [ Thu Aug 12, 2010 3:53 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

Thom McGrath wrote:
If you only need client functionality, then here's your answer: http://thezaz.com/opensource/realbasic/xml/rpc/client/. If you need client and server, then why not implement your own protocol?

The classes above are the same classes that our Feedback app uses to do all of its communication, so they're pretty robust.


I am using the zaz stuff as you suggested. However, I must be missing something. I create a message using the various AddParam_x methods. The server gets what I send and then some. It appears that there is always a null parameter at the end of each message. This is in the up event of an UpDownArrow:

dim m as new xmlrpc.message
dim v0 as Variant
dim v1 as variant

self.count = self.count + 1
v0 = self.count
v1 = 0

txText.text = str( self.count )

m.methodname = "mcastRpc"

m.addparam "\x00\x00\x02" // &h000002 // our address
m.addparam 1 // group
m.addparam 2 // (ttl) time to live (hips)
m.addparam "setButtonCount"
m.addparam_array array( v0, v1 ) //setButtonCount arg

client1.rpcserver = "http://localhost:8080"
client1.sendmessage m

Here is what the server recieves:
mcastRpc(\x00\x00\x02, 1, 2, setButtonCount, [5, 0], )

The last comma (], ) should not be there.

I realize this may be out of your coverage. Just thought you might see something obvious.

Thank you.

Author:  Thom McGrath [ Thu Aug 12, 2010 3:59 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

Very interesting, I've never seen such a thing happen. There should be no extra parameters.

Author:  bcorwin [ Thu Aug 12, 2010 4:14 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

Just for completeness; I am using the demo version right now until I prove I can pull this off. When I run my program I get a cautionary dialog that says:

Professional License Required
Professional & Studio features encountered during compile.
plugin:RBSSL.rbx:0 is an exclusive feature of REAL Studio Professional and Enterprise Editions.
Since you are running REAL Studio Personal Edition, this application will be built as a time-limited demo. Your app will run for 5 min .........


Could this have anything to do withe my issue.

Author:  Thom McGrath [ Thu Aug 12, 2010 4:14 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

No

Author:  bcorwin [ Thu Aug 12, 2010 5:59 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

I think I have a clue. The first param I add is an address that needs to be in base64. From the zaz doc:

AddParam will attempt to guess the correct parameter type, and usually, it will be correct. It will not be able to detect binary/base64 data correctly, however, and will set the parameter type to a string. To make certain your parameters are added to the message properly, there are a series of AddParam_* methods: Array, Binary, Boolean, Date, Dictionary, Double, Integer, and String.

My address needs to be x00.x00.x02. Any idea how to go about adding this param?

Author:  tkmedia [ Mon Feb 25, 2013 1:41 am ]
Post subject:  Re: What is the best way to do XML-RPC?

I am trying to add an array parameter and I am getting a type mismatch

dim wp_post() As String
wp_post=Array("post","publish","My Title","1","excerpt","My new wp api post")
m.AddParam_Array(wp_post)

Thoughts anyone?

Thanks

Tim

m.AddParam_Array(wp_post())
gives same type mismatch error

Author:  Thom McGrath [ Mon Feb 25, 2013 1:44 am ]
Post subject:  Re: What is the best way to do XML-RPC?

Dim the array as variant.

Author:  tkmedia [ Mon Feb 25, 2013 2:22 am ]
Post subject:  Re: What is the best way to do XML-RPC?

Still no go
1 dim wp_post() As variant
2 wp_post()=Array ("post","publish","My Title","1","excerpt","My new wp api post")
3 m.AddParam_Array(wp_post)

Type mismatch error Expected Variant(), but got string() for line 2


Tim

Author:  tkmedia [ Mon Feb 25, 2013 2:27 am ]
Post subject:  Re: What is the best way to do XML-RPC?

Got further there was a space between Array and The (
and had to get rid of the quotes around the number
Thanks

Tim

Author:  tkmedia [ Mon Feb 25, 2013 3:06 am ]
Post subject:  Re: What is the best way to do XML-RPC?

Now I am getting a nill object when trying to serailize the data

Params.Append kDataType_Array : values
has correct values but when reviewing the params the values for the array are missing so I get a nill object exception.

Thanks for the help

Tim

Author:  Thom McGrath [ Mon Feb 25, 2013 10:05 am ]
Post subject:  Re: What is the best way to do XML-RPC?

I'm pretty sure you can't use the Array() shorthand for defining a variant array. It'll return a String() array, rather than a Variant() array and cause your type mismatch.

Author:  tkmedia [ Mon Feb 25, 2013 12:06 pm ]
Post subject:  Re: What is the best way to do XML-RPC?

dim wp_post() As variant
wp_post.Append("post")
wp_post.Append("publish")
wp_post.Append("My Title")
wp_post.Append(1)
wp_post.Append("excerpt")
wp_post.Append("My new wp api post")
m.AddParam_Array(wp_post())

gives me the same error

How should I define the array then?


Thanks

Tim

Page 1 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/