Android: Handling error responses

I'm working on an app that makes use of a public api that sends back xml responses.  When everything goes well, air handles the xml and creates as components to turn the results into typed objects.  The problem arises when submitting information to the api that results in an api error.  The xml payload is completely reformatted.  How do I set up flashbuilder (burrito) so that it recognizes when a server error is returned?

Hi,
Using function module 'FORMAT_MESSAGE' you can capture the messages.
Here is a sample of the program code for that:
  LOOP AT it_messtab.
  CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
      id     = it_messtab-msgid
      lang   = it_messtab-msgspra
      no     = it_messtab-msgnr
      v1     = it_messtab-msgv1
      v2     = it_messtab-msgv2
    IMPORTING
    msg    =  g_msg
  EXCEPTIONS
      OTHERS = 0.
  IF it_messtab-msgtyp = 'S'.
    it_sucess-sucess_rec = g_msg.
    it_sucess-lifnr = it_header-lifnr." Based on your field
    it_sucess-tabix = v_lines.
    APPEND it_sucess.
  ELSEIF it_messtab-msgtyp = 'E'.
    it_error-error_rec = g_msg.
    it_error-lifnr = it_header-lifnr.
    it_error-tabix = v_lines.
    APPEND it_error.
  ELSE.
    it_info-info_rec = g_msg.
    it_info-lifnr    = it_header-lifnr.
    it_info-tabix    = v_lines.
    APPEND it_info.
  ENDIF.
ENDLOOP.
Hope this helps.
Reward if helpful.
Regards,
Sipra

Similar Messages

  • Can you Ignore Error Response Code in HttpUrlConnection?

    I have a problem with a HttpUrlConnection object throwing an IOException when it gets an HTTP Error Response code. Especially when there is an actual response from the server sent back that has more details in it that are actually helpful.
    I would like to just tell the HttpUrlConnection ot ignore HTTP error responses and just pass along the page or data that was returned instead. I need to handle this myself.
    The reason if it matters, is I am sending SOAP Envelopes, and if the Web Service doesn't like it, it will send an HTTP 500 Response Code, but it also sends a response SOAP Envelope that tells me exactly what is wrong.
    Right now to get this response I have to use a Sniffer, or worse since it is HTTPS (ssl) i have to use the jvm's SSL debug mode, and pull the response out of the hex code.
    I couldn't find anything about this, so I am afraid I am SOL, just hoping that there might be an obscure "feature" or "property" that can deal with this, that I can't find.
    ** 10 Duke Dollars to first person to provide a solution that works **

    Just call the getErrorStream() method to read the error response. Eg.
    HttpURLConnection conn = null;
    try {
      conn = (HttpURLConnection)
        new URL("http://www.google.com/givemea404").openConnection();
    } catch (Exception e) {
      InputStream in = conn.getErrorStream();
      int i = in.read();
      while (i != -1) {
        System.out.print((char) i);
        i = in.read();
    }

  • File To Proxy : Handle the response from ECC to send mail without BPM

    Hi,
    Scenario: FILE To Proxy
    Requirement: We are receiving xml acknowledgement file from bank with IDoc number and status in SAP PI and the file is used to send the status number, message and and IDoc number to ECC. After request is received in ECC BAPI is executed to update the original status of outbound IDOC.
    There would be multiple records in file and PI will send all IDoc acknowledgement to ECC to update the IDoc status.
    Issue: Since PI send all records to ecc, if any single IDoc status update is failing in ECC how would it can be communicated to support.
    ECC can send success or error response in proxy but how we can use the same in PI to send mail to support. Or is there any better error handling we can go for in such scenario.
    Thanks,
    Vertika

    Hi everyone
    thanks for response.
    Interface 1: IDoc (ECC) to File (Bank) --> Done
    Interface 2: Acknowledgment File (Bank) to BAPI (ECC) where BAPI will update the status of IDoc sent in first interface.
    For Interface 2 : PI will receive file from Bank with multiple records i.e multiple IDoc numbers and their status. PI will invoke proxy to send the IDoc number and status number (eg 16) for all the records together. Now if BAPI fails to update status of any single IDoc in that file how support team will know that the particular record is failed. To handle this error ECC is saying they can send Error and Success back to PI. But the problem is how we can use that response in PI in the same interface to send emails to support team. Bank does not want any response back in this case. This is just to ensure proper error handling since this is bank related interface.
    Splitting the interface in two interfaces will definitely help. But is there some way which can be used in same interface and based on error response from ECC mail is triggered.
    If any one has better suggestion for such kind of error handling, please post the same.
    Thanks,
    Vertika

  • Handle errors when makeing doc.submitForm()

    Hello,
    I am trying to submit PDF form by method doc.submitForm, example:
    doc.submitForm
            cURL: "http://localhost/reader_test.php?name=" + name.rawValue,
            cSubmitAs: "XML"
    A) With this approach, is it possible to handle connection errors and display custom error message (and cancel the original one) ?
    I have tried something like
    try{  doc.submitForm(...); } catch(e) { //handle code }
    but it seems to be run asynchronously.
    B) Is it possible to add custom HTTP headers to the POST ?
    I saw that FormCalc can do it in Post() funciton, but when using Post() function, the Reader displays Yello-bar security dialog, that made our previous SOAP-based solution too complicated for the end user.
    Appreciate any help.
    Radek

    Sofar I have not found the way how to handle errors when using doc.submitForms(), but there may be following workaround (mey be?):
    The server returns as a response to a submitForms() call a pdf content, which is displayed as a document in a new Reader's window. Is it possible to place some javascript into this new window, that would refer to parent window and send to it some message ? Or at least to detect at the "parent" window, that a "child" window was opened ?
    So is there any relation between the newly opened document with the response from server and the original document, that initiated calling of doc.submitForms()?
    Thanks.

  • How to handle soap responses

    I am following this tutorial to handle SOAP responses but it does not work http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_6.html
    using code blew I am trying to parse the following soap response.
        <?xml version="1.0" encoding="utf-8"?>
        <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                         xmlns:s="library://ns.adobe.com/flex/spark"
                                         xmlns:mx="library://ns.adobe.com/flex/mx"
                                         xmlns:components="components.*"
                                         xmlns:hellos="services.hellos.*"
                                         height="957"  creationComplete="initApp()" >
                  <fx:Style source="Styles.css"/>
                  <fx:Script>
                            <![CDATA[
                                      import mx.controls.Alert;
                                      private namespace invesbot = "http://Services.com";
                                      use namespace invesbot;
                                      private namespace a = "http://schemas.xmlsoap.org/soap/envelope/";
                                      private namespace b = "http://www.w3.org/2001/XMLSchema";
                                      private namespace c = "http://www.w3.org/2001/XMLSchema-instance";
                                      use namespace a;
                                      use namespace b;
                                      use namespace c;
                                      [Bindable]
                                      var _result:*
                                      private function initApp():void
                                                myService.mycustomers();
                            ]]>
                  </fx:Script>
                  <fx:Declarations>
                            <mx:WebService id="myService" wsdl="http://localhost:8081/WebServiceTest/services/Hellos?wsdl"
                                                             showBusyCursor="true"
                                                             fault="Alert.show(event.fault.faultString), 'Error'">
                                      <mx:operation name="mycustomers" resultFormat="e4x">
                                                <mx:request>
                                                </mx:request>
                                      </mx:operation>
                            </mx:WebService>
                  </fx:Declarations>
        <mx:HBox>
                            <mx:Text
                                      text="{myService.mycustomers.lastResult.mycustomersReturn.name}"
                                      />
                  </mx:HBox>
        </s:Application>
    The SOAP response is as following
        <?xml version="1.0" encoding="UTF-8"?>
        <soapenv:Envelope
          xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <soapenv:Body>
            <mycustomersResponse xmlns="http://Services.com">
              <mycustomersReturn>
                <age>28</age>
                <name>John</name>
              </mycustomersReturn>
              <mycustomersReturn>
                <age>29</age>
                <name>Alex</name>
              </mycustomersReturn>
              <mycustomersReturn>
                <age>30</age>
                <name>Jack</name>
              </mycustomersReturn>
            </mycustomersResponse>
          </soapenv:Body>
        </soapenv:Envelope>
    Using the above code the output will be
        <name xmlns="http://Services.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">John</name>
        <name xmlns="http://Services.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Alex</name>
        <name xmlns="http://Services.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Jack</name>
    but when I use the following code to put the result in dropdown box it gives the following error
        <s:FormItem label="Employee:">
                            <s:DropDownList id="dropDownList3"
                                                                    labelField="name"
                                                                    dataProvider ="{myService.mycustomers.lastResult.mycustomersReturn}"/>
                  </s:FormItem>
    TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@106e9af1 to mx.collections.IList.

    Hi Ashish,
    You can use Catch All error handler within scope of InvokeService action. By specifying SOAP Fault variable name there, response soap fault will be populated in variable.
    In 11g(As per observation), split joins are strict towards definition of input and output message based on WSDL of target service which causes exception for invalidMessage in InvokeService action.
    Hope this helps.

  • Invalid Handle Error

    Is anyone who is current on NCF updates still seeing the Invalid Handle error or is having any other difficulties when opening either the Log Viewer or Auto Update?
    You're current if your aupdhist.log file has an entry for "New package dated 02.26.2004 [ID=20040226_1142] "
    We've closed this defect as it seemed to get fixed with the changes we made in Update 1 that allow you to limit the log file size. Was kind of a "free" bug fix, if you will. Got resolved accidentally. ;) But I just wanted to poll the room and make sure everyone's ok on this issue.
    Thanks,
    Scott

    Scott,
    It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at http://support.novell.com in both the "free product support" and "paid product support" drop down boxes.
    - You could also try posting your message again. Make sure it is posted in the correct newsgroup. (http://support.novell.com/forums)
    If this is a reply to a duplicate posting, please ignore and accept our apologies and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • How to handle errors in data templates

    Hi
    What is the recommended way to handle errors for example if one of your SQL statement in a data template returned no data how and where would you be able to create an error message for the user to find and read.
    Thanks,
    Mark

    The closest I have come to doing this is to put conditional statements into the format template. If a value matches an expected (ex. is null) you can return a message (in the report) via the format template (ex. "No Data Found").
    I am not sure this really answers your question as this is in the format template, but I generally view them as a matched pair that work together. I try to stick with data extraction in the data define, and do all my conditional stuff in the format templates.
    Scott

  • How do I fix this error response?

    When I bought my new Macbook Pro, replacing my old Macbook Pro, I can't open alot of documents now that I used to be able to before and they're just .doc documents.  I get this error response:
    "You can't open the application Microsoft Word because PowerPC applications are no longer supported."

    You have Word 2004.  Update to Office 2011.
    In the meantime, open Text Edit in your Applications Folder and in Preferences, check RICH TEXT.
    Now you should be able to open your formatted .doc documents.

  • A message will pop up (Exc in ev handl: Error: Bad NPObject as private data!) and the tab I was on will close out and reopen in a new window. Why is it happening and how do I stop it?

    Okay, I will have a window open with 4 tabs open. At first, everything is fine, but after a day or so, a message will pop up on screen saying "'''Exc in ev handl: Error: Bad NPObject as private data!'''" and after you close it out, the tab you were on will close and reopen in it's own window. I then have to shut down all both old and new windows and open a new window with my original 4 tabs again. It will work fine until a few days pass and it starts over again.

    This issue can be caused by the McAfee Site Advisor extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • After updating Firefox I am getting this message any time I do anything "Exc in ev handl:Error: Bad NPObject as private data"

    This error happens each time I use Mozilla. especially when I click on an extension or try to work in any of my e-mail accounts (Yahoo, Gmail, or RCN). Sometimes I am able to continue by just clicking OK and other times it prevents me from completing my task. This started happening right after I downloaded and installed your latest version of Firefox. I see others are having the same problem. Error message is "Exc in ev handl:Error: Bad NPObject as private data"

    That issue can be caused by the McAfee Site Advisor extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • How to handle errors in a file at sender side?

    Hi
    I have done a file to proxy scenario.
    I know how to handle errors on proxy.
    But on sender side when picking the file if one the record have worng fomat its throwing mapping error and its not processing any record..
    I wanted to process the records which have right format and data and  all remaining recrods which have wromg format should be send back to the sender as file.
    How to do this.
    How to handle error in sender file.
    Regards
    Sowmya

    Hello Sowmya,
    In your scenario Three ways you can validate the data.
    1) Before the data reaches into SAP system ie in XI system during Mapping or before mapping i,e in Adapter Module in the Sender side
    2) this option, is in the receiver applications side. ie. Validations will be taken care in the SAP system i.e in ABAP server proxy code.
    3)Through BPM, If Mapping Exception Occures then through exception Branch you can send bad formate file to sender again.
    Generally, it is prefer to more business critical validations in the Application System ie Receiver Application System (ABAP Server Proxy)
    In this, you can have more flexibility of the validations as you are validating some of the SAP payroll informations as Personal ID etc.
    Based on the complexity and flexibility of the requirement, you can either do this in the XI (if XI, ie Sender Adapter Module or Mapping) or in the ABAP proxy
    Thanks'
    Sunil Singh

  • WSRM Adapter replaced with soap in PO7.4. Getting error "Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error"

    Hello All,
    We have scenario proxy->pi->webservice. In older versions of PI system they used wsrm adapter at receiver side and it's working fine.
    Receiver interface is asynchronous. So no response structute is present and receiver service is business component(since receiver is a third party).
    During migration, we have replaced the receiver adapter with SOAP adapter and used message protocol as SOAP 1.1 but the message is failing and in communication channel it is showing error "Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error". In this case the receiver interface is stateless xi 3.0 compatible(re using the old), after changing it to just stateless also issue persists.
    In target url field if i prefix the url with "http" then above mentioned error is occurring otherwise if i use the hostname:port/path.. then it is giving error
    "soap: Call failed: com.sap.aii.af.sdk.xi.srt.BubbleException: Unsupported protocol". So maintaing the url as http://hostname:port/pat.....
    As in old channel wsrm channel there is no userid and password, i haven't given any userid/pwd in receiver channel.
    used the bean sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean with  parameters
    Module Key  =  soap
      Parameter Name  =  noSOAPMakeSysErrFromResponseFault
    Parameter Value  =  false
    and
    xmbws.No SOAPIgnoreStatus = true
    but not successful.
    Please help me. I got stcuk here.

    Hello Jannus,
    The connectivity is working fine. Network team has confirmed it. I doubt that any strucutre(header) difference might be present in message when sending with wsrm adapter compared to sending with soap adapter.
    Please let me know the exact difference between soap and wsrm functionality in receiving end.
    By considering the structure issue, i have checked the "do not use soap envelope" check box, then i got error "Response message contains an errorXIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 415 Unsupported Media Type"
    Then i used message transform bean, but not successful.
    Regards,
    Ch.Venkat.

  • Can't open PDF's on my Mac coming in on MS Outlook 2010. Reinstalled Adobe software 4 x and still get "Adobe PDF Preview Handler" error message.

    Can't open PDF's on my Mac coming in on MS Outlook 2010. Reinstalled Adobe software 4 x and still get "Adobe PDF Preview Handler" error message.

    No. Reader will not damage files. It is only meant to read pdf files. PDF files are frequently damaged when sent as email due to encoding issues.

  • Custom Error Responses - S1WS 6.1

    Hello
    Iam trying to create custom error responses. I did this thru Admin , Class Manager.
    I gave the absoulte path to file which contains error messages for the HTTPcodes (Not Found, Unauthorized etc)..
    When i did testing, the browser still gets 404 back. I did verify whether obj.conf has the settings. I also restared the web server. The setting was selected for "Entire Web Server".
    Please help.
    Thanks
    ssk

    I'm not sure I understand. Even if you specify a custom error page, the server will continue to send a response with a 404 HTTP status code. It will use the contents of your page for the body, but the HTTP status code will still be 404.
    If you're not really concerned about the HTTP status code but rather the body of the response, check the log files:
    1. Check the errors log. Is the server trying to tell you something?
    2. Check the access log. Is the server getting the request? Is the server sending your file (check the response size, it should match the size of your file)?
    If there's nothing in errors and access suggests the server is sending your file, the browser may be choosing not to display your error page. Microsoft Internet Explorer does this when the page is below a certain size. Try increasing the size of your error page.

  • How to handle utl_http response

    Hi,
    I use the below code to call a https using POST method
    utl_http.set_proxy(apex_application.g_proxy_server, NULL);
    utl_http.set_persistent_conn_support(TRUE);
    utl_http.set_transfer_timeout(300);
    utl_http.set_wallet(p_wallet, p_wallet_pwd);
    l_http_req := utl_http.begin_request(p_api_url, 'POST');
    utl_http.set_header(l_http_req, 'Proxy-Connection', 'Keep-Alive');
    utl_http.set_header(l_http_req, 'Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
    utl_http.set_header(l_http_req, 'Content-Length', length(l_post));
    utl_http.write_text(l_http_req, l_post);
    l_http_resp := utl_http.get_response(l_http_req);
    utl_http.read_text(l_http_resp, l_response);
    The url return a respose with below l_response content
    <html>
    <head>
    <META HTTP-EQUIV='content-type' CONTENT='text/html; charset=UTF8'>
    </head>
    <title>Payment Page</title>
         <form method="POST" name="ePayment" action="http://www.testing.com">
         <input type="hidden" name="MerchantCode" value="M01247"><br>
         <input type="hidden" name="PaymentId" value="2"><br>
         <input type="hidden" name="RefNo" value="0001"><br>
         <input type="hidden" name="Amount" value="1"><br>
         <input type="hidden" name="Currency" value="MYR"><br>
         <input type="hidden" name="Remark" value="Testing1"><br>
         <input type="hidden" name="TransId" value=""><br>
         <input type="hidden" name="AuthCode" value=""><br>
         <input type="hidden" name="Status" value="0"><br>
         <input type="hidden" name="ErrDesc" value="Permission not allow"><br>
         <input type="hidden" name="Signature" value=""><br>
         </form>
         <script language="JavaScript">
              document.ePayment.submit();
         </script>
    </html>
    Apparently it will redirect to http://www.testing.com,
    how should my procedure handle this response so it will redirect to the url?
    Thanks.
    Vincent pek
    Edited by: [email protected] on May 3, 2010 7:09 AM

         <script language="JavaScript">
              document.ePayment.submit();
         </script>
    </html>
    Apparently it will redirect to http://www.testing.com,
    how should my procedure handle this response so it will redirect to the url?
    Thanks.
    Vincent pekYour procedure should be able to run JavaScript, which it isn't.
    Therefore, I would recommend that you talk to the website administrator and discuss using a webservice.

Maybe you are looking for

  • I tried to update my iPad but when I switched it on it was in recovery mode?

    I don't know what to do now. I just pressed 8.0.2 update because I wanted to get an app that required it, and then the screen went black. I turned it on again, and tried updating it again, but it still did the same thing. Then, the next time, I switc

  • I've got a nested table issue..

    Okay, first off: in Oracle 9i is there an option to nest a table inside a nested table? I got the impression it is an option; & I'd like further info on this. ..& on to the issue I've got: I've got one nested table object that I've identified in the

  • Start and Stop ASM in a Standalone Environment

    Hi, I have just installed 11gR2 Grid Infrastructure and have ASM up and running. Q1. How do I shut ASM down cleanly ? So far I have shutdown the +ASM instance shutdown the listener however I still appear to have a number of processes running grid1   

  • Locking and Objects

    I have been looking up a lot of information on locking shared-scope variables lately, because I dont really do it at all and I probably should. My question revolves around something else I had posted about a couple of days ago about creating objects

  • Is there a setting for PC to override iPhone when syncing?

    I want to make sure that if I delete a song/playlist from my phone it does not delete from my computer.  Using Windows version 12.0.1.26 of iTunes.