Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 15, 2017 7:23 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: What is the best way to do XML-RPC?
PostPosted: Tue Aug 03, 2010 2:10 pm 
Offline

Joined: Tue Aug 03, 2010 1:52 pm
Posts: 5
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 05, 2010 12:29 pm 
Offline

Joined: Sat Oct 01, 2005 9:55 am
Posts: 527
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 05, 2010 1:10 pm 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
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.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 12, 2010 3:53 pm 
Offline

Joined: Tue Aug 03, 2010 1:52 pm
Posts: 5
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 12, 2010 3:59 pm 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
Very interesting, I've never seen such a thing happen. There should be no extra parameters.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 12, 2010 4:14 pm 
Offline

Joined: Tue Aug 03, 2010 1:52 pm
Posts: 5
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 12, 2010 4:14 pm 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
No

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Thu Aug 12, 2010 5:59 pm 
Offline

Joined: Tue Aug 03, 2010 1:52 pm
Posts: 5
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 1:41 am 
Offline

Joined: Wed Dec 21, 2011 11:31 pm
Posts: 13
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


Last edited by tkmedia on Mon Feb 25, 2013 2:13 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 1:44 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
Dim the array as variant.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 2:22 am 
Offline

Joined: Wed Dec 21, 2011 11:31 pm
Posts: 13
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


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 2:27 am 
Offline

Joined: Wed Dec 21, 2011 11:31 pm
Posts: 13
Got further there was a space between Array and The (
and had to get rid of the quotes around the number
Thanks

Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 3:06 am 
Offline

Joined: Wed Dec 21, 2011 11:31 pm
Posts: 13
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


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 10:05 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
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.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: What is the best way to do XML-RPC?
PostPosted: Mon Feb 25, 2013 12:06 pm 
Offline

Joined: Wed Dec 21, 2011 11:31 pm
Posts: 13
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group