I am running rails version 2.3.2 on my website domain and I am having a huge problem with wrapping my head around how this works:
I have my website running a RoR app on my domain development server. It is just a sample scaffold that allows you to type in your name, zip, state, etc. I am using ruby 1.8.2, and have a mysql server also.
I want to consume this data into my windows phone 7 through SOAP (I don’t know if I even have one to begin with), but here is where I have problems.
In using visual studio, it cannot locate my server when i direct it over to my url. It gives the error saying that there was nothing in the correct format.
Maybe I don’t have a server running? I want to have the data be parsed out into XML for the phone to consume, but I have no idea how to set this up!
Basically, I have the domain, and the phone, but no knowledge of the steps inbetween.
Can anyone help me get this up and running?
A few things to try:
First – have you actually started the server? eg by running “script/server” ?
You can test that the server is up and running by using “curl” (google for it to install/download” which is a very simple (and very commonly used) application for testing this stuff easily.
if you run curl and type in the url that you’d be accessing via your windows phone… and it responds with something (probably html), then the server is up and running. You can later use CURL to test if it responds to an xml request too.
Second: go look in the controller. See if it has a section such as:
it’s the “respond_to” and “xml” bits that matter if you are going to get your system to consume xml. They should be present in every action in your controller. If not – you will have to go a research how to do this for your code – alternatively, using a later version of rails will let you use the up-to-date scaffold generators that should include these as standard.
Third: it is possible that your Windows phone app is just not requesting the resources in xml format and so Rails is returning html (which your SOAP parser won’t understand). I don’t know how you can check this, but what rails requires is for the HTML-header: “Accept” to be set to “application/xml” or “text/xml”
You can also test this for any given URL with curl by using eg: “curl -H ‘Accept: text/xml’ 127.0.0.1/myapp” – if it continues to spit out html (and not xml) then obviously it’s not producing xml for that URL.