I am new to rails and looking someone to point me in the right
direction in how to accomplish the following:-

I need to communicate with an external api by either passing an XML
document directly
into the cgi (https://api.domain.com/v1/method.cgi) and set the
content-type to "text/xml", or pass it as a parameter and set the
content-type to "text/plain"

I supposedly get an XML response back instead of the HTML response, so
no need to download the HTML response, store it, then render a local
copy for the user; nor will i need to stick the XML document within a
parameter of a locally generated HTML form to submit it via the
browser to avoid downloading the HTML.

Each API method has example xml code for (Sending, The Response, DTD,
Schema)

What is the best tools/techniques to accomplish this !??

One of their simpler methods is as follows :-

**SEND**

<?xml version="1.0" encoding="utf-8" ?>
<SoftwareAPI>
<Method>ListUsers</Method>
<APIKey>123</APIKey>
<Account>
    <UserName>admin</UserName>
    <Password>Password</Password>
</Account>
</SoftwareAPI>

**RESPONSE**

<?xml version="1.0" encoding="utf-8" ?>
<SoftwareAPIResponse>
    <TimeNow>2012-01-23T16:44:00Z</TimeNow>
    <ResponseId>01-23-1232729040-23456</ResponseId>
    <ListUsersResponse>
        <User>
            <Team>team</Team>
            <Office>office</Office>
            <UserName>Joe.Bloggs</UserName>
            <Password>Password123</Password>
            <FullName>Joe Bloggs</FullName>
            <Language>Auto-Detect</Language>
            <Telephone>+44 207 123 456 789</Telephone>
            <ResponseEmail>[email protected]</ResponseEmail>
        </User>
    </ListUsersResponse>
</SoftwareAPIResponse>

This API method needs no interaction from the user or view, should the
coding be done from the controller or should I create a model for all
the api methods ?

How do I perform a post to the cgi url with the specified XML above
and process the response XML and display in a view ?

What are the best practices for accomplishing this ?


Many Thanks in Advance

Jonny

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to