OK, since I have managed to resolve the previous issue, here is the next one. I need to find a way to transmit information using XML-RPC to a remote server and retrieve information and parse it for my website. However, in a twist, the data is transferred in the form of a “struct”, which I cannot read. I cannot find any information about this online anywhere – and I am clearly not happy about it. (The Classified section was nearly perfect otherwise).
The clues I have, for the time being, are all old, from 2002 – clearly useless… And then I found this
Update
OK here is the first update. I have created the same “struct” arguement from that website.
Dimensions = Struct.new( “Dimensions”, :category, :dimension );
It doesn’t work though. It gives me this error: “SyntaxError in controller not set # action not set”. It follows up with this:
dynamic constant assignment
Something weird for sure. Dynamic Constant Assignment/ ? How can dimensiosn change as a result..? Hrm.
Update
Ok that was sorta obvious. Get rid of the dimensions = blah blah and just leave it as struct.new. This was an error that was induced by the textbook itself. Erm, wait. Getting rid of it gives us just another error. Sigh. This was the sort of bullshit I tried to get away from by learning Ruby..
Update
OK I found the answer on Andy Lo A Fo’s blog. Would you guess it… a CAPITALIZATION PROBLEM. WHAT-THE-!(*@$. This is the biggest idiocy ever, I thought the entire benefit of Ruby was an absence of these ridiculous problems which cannot be tracked down. Feel free to check out the documentation online – nothing shows how to resolve this issue properly. Great way to sell books though.
Update
OK new problem. I try to send a message to the website, and get stuck with this:
Wrong content-type:
That’s it, nothing else. Great error message :/
Update
I think I know the cause of the issue. This is a message from the server informing me that I am transmitting the wrong information (!!). Gotta love it, very precise. Let me see if I can fix it.
Update
I managed to get help from the search result supplying company – great news for me
The call statement has to be changed a bit.
begin
return server.call(“function”,
@variable1,
@variable2,
@variable3,
….
@variablen,
)
rescue XMLRPC::FaultException => e
puts “Error:”
puts e.faultCode
puts e.faultString
end
My mistake really, but great news for me. My fundamental error was confusing Ruby Structs with XMLRPC structs and then trying to transmit everything in one string. I had also missed one entry in the transmission array; hence, the problems I was having with “Wrong content-type: “. It would be nice to know if the message was local or coming from the server, but thankfully everything worked out in the end.


