Obtaining XML file from remote resource with Drupal 7

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Mark_L6n's picture

Hello, I am using Drupal 7, am new to Services and would like to ask if Services is the right tool for the task below, and if so where to get documentation related to the task.

I need to simply obtain an XML file from another resource. This involves sending an XML file to it, receiving an XML file back with a code embedded, extracting that code and using it in another another XML request, and then receiving the desired XML file.

Specifically, here is what I need to do:

1) Send XML in this format to [URL]submit.rest :

<?xml version="1.0" encoding="UTF-8" ?>
<TestSubmitRequest>
  <Credentials>
    <AccountName>Account</AccountName>
    <UserName>User</UserName>
    <Password>Password</Password>
  </Credentials>
</TestSubmitRequest>

2) Receive this response:

<?xml version="1.0" encoding="UTF-8" ?>
<TestSubmitReply AccountName="Account" Type="Attribute">
  <TestKey>xyz123abc789</TestKey>
</TestSubmitReply>

3) Send this back:

<?xml version="1.0" encoding="UTF-8" ?>
<TestVerifyRequest>
  <Credentials Key="xyz123abc789">
    <AccountName>Account</AccountName>
    <UserName>User</UserName>
    <Password>Password</Password>
  </Credentials>
</TestVerifyRequest>

4) Receive this back:

<?xml version="1.0" encoding="UTF-8" ?>
<TestVerifyReply AccountName="Account" >
  <ActiveKey>987qwerty</ActiveKey>
</TestVerifyReply>

Is using Services appropriate for this task? Is there another module for doing this that is more appropriate?

If so, could anyone outline how to go about this and where to find documentation/screencasts etc. for Drupal 7?

Comments

i think you don't need to use

mojzis's picture

i think you don't need to use services to do this. Check drupal_http_request

Thanks! However, I was

Mark_L6n's picture

Thanks! However, I was hoping for a higher-level and more ready-to-use solution than drupal_http_request. Any other ideas?

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week