I'm trying to use the XMLRPC/client to consume an XMLRPC resource; unfortunately it does not conform to standards. So the XML content I have to send to the XMLRPC server needs to be formatted like so; <?xml version="1.0" ?> <FileRequest> <QuerySub> <FileId>_number_</FileId> </QuerySub> </FileRequest> Of course the call2 method of class XMLRPC::Client uses this create().methodCall(method, *args); which generates this request: <?xml version="1.0" ?> <methodCall> <methodName>QuerySub</methodName> <params> <param> <value><string>100001647</string></value> </param> </params> </methodCall> The response from the XMLRPC source is also non-standard; Can anyone offer any advice on how I can use the Ruby XMLRPC library and still format my requests to fit this custom solution? Any advice on how I can go about this?
on 2012-12-12 21:11
on 2012-12-12 22:57
I think you probably won't have any luck using an XML-RPC client to talk to a non-XML-RPC server (just a server which happens to talk XML). You may need to just DIY the request with a normal HTTP library.
on 2012-12-13 16:31
So you wouldn't suggest overriding methodCall to produce my own flavor of XML wrapper? Instead using an HTTP library and maybe nokogiri for parsing? I'm open to suggestions here; I wanna do what makes the most sense. Not only to solve the problem now but also for future self or future other developer.
on 2012-12-13 21:08
XMLRPC is a protocol. Yet, you don't seem to be heeding the XMLRPC protocol, so one can only wonder why you think using the XMLRPC library is appropriate. Is it your believe that if you are conversing with a server in XML, then that means that you are conforming to the XMLRPC protocol?
on 2012-12-13 21:38
7stud -- wrote in post #1089019: No, I think you are misunderstanding what I said above. I know it is a non-conforming system to the XMLRPC protocol. I did not build the system; I just have to utilize it. My question was the XMLRPC::Client class builds a lot of the functionality you need without writing your own. XMLRPC utilizes the NET::HTTP library; it builds the XML request and parses the response. So my only question was, would it be a good idea to override MethodCall, creating the needed request XML format and then override the parser to consume the response OR should I just go ahead and roll my own. I was looking for best practices; not only for my future self but also for other developers down the road to maintain this. Yes, it sucks that the API manufacturer did not follow the standards, but I can't muck around with that I just need to find a solution. If you have any input on the initial question, please post 'em. Thanks again!
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.