tags:

views:

18

answers:

1

I have the following XML data. How do I track the error tag in case of an invalid request or input?

If it is possible then can you please provide me proper code for this?

Login Request:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <Signin xmlns="http://tempuri.org/"&gt;
  <card_number> 123/321 </ card_number >
   <dob>MM|DD|YYYY </dob >
    </Signin>
  </soap:Body>
</soap:Envelope>

Response:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <SigninResponse xmlns="http://tempuri.org/"&gt;
      <user>
        <user_id>long</user_id>
        <current_balance>string</current_balance>
        <card_iamge><![CDATA[string]]></card_iamge>
      </user>
    </SigninResponse>
  </soap:Body>
</soap:Envelope>

Transaction History Request:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <TransactionHistory xmlns="http://tempuri.org/"&gt;
  < user_id >1/2 </ user_id >


    </TransactionHistory>
  </soap:Body>
</soap:Envelope>

Response:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <TransactionHistoryResponse xmlns="http://tempuri.org/"&gt;
      <transactions>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
        <transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
<transaction>
  <date><![CDATA[08/30/2010]]></date>
  <amt>$10.50</amt>
  <card>ASYU763543</card>
      </transaction>
      </transactions>
    </TransactionHistoryResponse>
  </soap:Body>
</soap:Envelope>

Error:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <*Response xmlns="http://tempuri.org/"&gt;
  < error> string </ error >
    </<*Response>
  </soap:Body>
</soap:Envelope>
A: 

Have a look at this http://androidosbeginning.blogspot.com/2010/09/generic-xml-parsing-in-android.html

probably this could solve your problem.

success_anil