How to send a request and get a response through xml

How to send a request and get a response through xml files?

This is the code that works for me. Hope you find it useful.
     public static String sendHttpGetRequest(String endpoint, String requestParameters){
          String result = null;
          // Send a GET request to the servlet
          try{
               // Send data
               String urlStr = endpoint;
               if (requestParameters != null && requestParameters.length () > 0){
                    urlStr += "?" + requestParameters;
               URL url = new URL(urlStr);
               HttpURLConnection conn = (HttpURLConnection) url.openConnection();
               conn.setRequestProperty("Accept", "application/xml");
               // Get the response
               BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
               StringBuffer sb = new StringBuffer();
               String line;
               while ((line = rd.readLine()) != null){
                    sb.append(line);
               rd.close();
               result = sb.toString();
          } catch (Exception e){
               e.printStackTrace();
          return result;
     }

Similar Messages

  • In ActionScript 2.0 , How can I send HTTP request and get the response in JSON format.

    I am using ActionScript 2.0 for my app development. I have checked XML and LoadVars class. These classes by default send/receive data either in XML or name/value pair format. I want to send data in JSON format and receive the response in JSON format. How can I achieve this behavior using AS2.0. I have noticed that AS3.0 has the capabilities to do so. My client platform doesn't support AS3.0. Can anybody suggest a way to achieve this?
    Thanks in Advance.

    Atlast I am able to find the solution for this problem. In the end solutioin is very simple.
    Following steps will help in sending request in JSON format.
    1. extend LoadVars class
    2. override toString method. (It should return JSON format )
    3. Use subclass to send the request.

  • ABAP need to connect to Webserivice and send a Request and get a response

    Hi All,
    i have a interfaace in SAP HCM, where i need to get data from given tables and convert it into XML and send it to Web service  as a #request, and then latter i need to get a response , where it is sucess or not ,
    I need to know exactly how to create a class in SE80 and what is the prerequiste for that , anyone , thankin g you
    Sridhar

    it as been sloved

  • TS3276 How do I send an email and get a receipt that they opened it? I have seen this before, but don't know what setting to go to.

    How do I send an email and get a recipt that they opened it?

    Additionally, even if Mail supported it, the recipient would have to allow/consent to sending you the receipt - if I were the recipient, I would certainly not allow it. If you are sending legal or other very important files, use the "return receipt required" feature of US Mail - you will get a receipt that it was accepted with a signature.

  • How bad does your phone have to be to send it away and get a new one?

    My blackberry 8520 keeps on resetting itself and freezing all the time, does this mean that i can send it away and get a new one for free?
    Regards

    Hi and Welcome to the Community!
    No one can say at an internet distance...only your specific qualified service center can say. Your contract is between you and either your wireless service provider or your authorized reseller...that contract will govern what could or could not be. You need to take it to your service provider for diagnosis and hopefully resolution.
    But, with what you've described, there are a whole host of diagnostic steps that could be attempted here, if you are willing.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to send automatic mail and put attache file on batch file ?

    how to send automatic mail and put attache file on batch file ?
    START MAILTO:[email protected]?SUBJECT=PHONE%CALL^&BODY=Testing

    Hi,
    Do you want to use a batch file to create new email message (including recipients, subject and email body) with attachments? If so, I'd recommend you post your question in the Scripting Guys forum for further assistance:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Please feel free to let me know if I've misunderstood something.
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • HT5699 I forgot the answers for security questions, how can I reset them and get the access back to the iTunes store?

    Need help to get access to iTunes store. I bought an iTunes card bor buying on iTunes store.
    I forgot the answers for security questions, how can I reset them and get the access back to the iTunes store?

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then you won't get the reset option - you will need to contact iTunes Support or Apple to get them reset.
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then 'Forgotten Apple ID security questions'
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down this page to add a rescue email address for potential future use : http://support.apple.com/kb/HT5312 . Or you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • HT1338 Free Mountain Lion request, how long does it take to get a response??

    Submitted my free request for software update to mountain lion yesterday, how long does it take to get a response, and where can I go to verify my request was received?/

    I called them after waiting 12 hours and they said up to 72 hours and there was no place to check things in the meantime.
    Their communication on this one is surprisingly bad, but apparently they have it under control. Time will tell. (It's now been about 36 hours for me with no code or confirmation email.)

  • When trying to open iphoto I get the error message "You can't open the application iPhoto because it may be damaged or incomplete." How do I fix this and get my photo's back?

    When trying to open iphoto I get the error message "You can't open the application iPhoto because it may be damaged or incomplete." How do I fix this and get my photo's back?

    To re-install iPhoto
    1. Put the iPhoto.app in the trash (Drag it from your Applications Folder to the trash)
    2a: On 10.5:  Go to HD/Library/Receipts and remove any pkg file there with iPhoto in the name.
    2b: On 10.6: Those receipts may be found as follows:  In the Finder use the Go menu and select Go To Folder. In the resulting window type
    /var/db/receipts/
    2c: on 10.7 they're at
    /private/var/db/receipts
    A Finder Window will open at that location and you can remove the iPhoto pkg files.
    3. Re-install.
    If you purchased an iLife Disk, then iPhoto is on it.
    If iPhoto was installed on your Mac when you go it then it’s on the System Restore disks that came with your Mac. Insert the first one and opt to ‘Install Bundled Applications Only.
    If you purchased it on the App Store you can find it in your Purchases List.

  • How do I re-open and get back into my iPhoto if this message appears: "Your photo library is either in use by another application or has become unreadable"? What do I do?

    How do I re-open and get back into my iPhoto if this message appears: "Your photo library is either in use by another application or has become unreadable"? What do I do?

    Rebuild your iPhoto Library:
    iPhoto 6 and later: Rebuilding the iPhoto library

  • HT201272 Hello there,I delete my scruff application on the 8/05/13. Receipt N: 184052577343. And I was charged ammount of £ 16.99on the 15/05/13. I t's a Subscription Renewal. How can I stop it and get the refund of this ammount back on my account? Thank

    Hello there,I delete my scruff application on the 8/05/13. Receipt N: 184052577343. And I was charged ammount of £ 16.99on the 15/05/13. I t's a Subscription Renewal. How can I stop it and get the refund of this ammount back on my account? Thank you!!

    There are instructions on this page for managing and stopping auto-renewing subscriptions (deleting an app won't stop it) : http://support.apple.com/kb/HT4098
    In terms of a refund, what does it say on the app's description page in the store (a lot say that refunds aren't given) ? But you can try contacting iTunes Support and see if they will refund or credit you : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • I bought a gift card, but it hasn't shown up in my e-mail after 1 hour.  How can I find it and get the credit on my account?

    I bought an iTune gift card for myself and sent it to my e-mail address.  I have waited over an hour and the e-mail showing the gift card has not arrived.  How do I find it and get the credit put into my iTunes account so that I can buy some music?

    Oh hold on - sudden development!
    I panicked and force-shut down my computer because it froze after I clicked on the 'Reset Cache' option, then I logged back on and noticed the Cloud symbol next to the missing song. I clicked it, and it's finally downloaded properly! <3
    Mate, thank you so much for helping me out! xxx

  • I refuse to pay for a one year automatic subscription for Cosumer report that was charged to my account today without me noticing. How can I cancel that and get reimbursed now?

    I refuse to pay for a one year automatic subscription for Cosumer report that was charged to my account today without me noticing. How can I cancel that and get reimbursed now?
    Patrick

    First turn off auto-renewing subscriptions:
    iTunes Store: Purchasing and managing auto-renewing subscriptions
    Getting a refund won't be as simple. For that you will have to contact iTunes Store Support.

  • Iphone has been in recovery mode for 4 hours and hasn't come back to the home screen and how can i fix this and get it back to working order?

    iphone has been in recovery mode for 4 hours and hasn't come back to the home screen and how can i fix this and get it back to working order?
    the iphone 4S has been in recovery mode for a long time and i have tried to press and hold the power and home buttons until the apple symbols comes on the screen again but it stay on the screen until the screen turns off and doesn't come back on to the home screen and have tried to sync with mac and doesn't do anything it does display the itunes and cable icons for a while but then goes back to the apple symbol and doers nothing what can I do to fix this  and not loose what is on the phone at all?

    Hi, simonRM.  
    Thank you for visiting Apple Support Communities. 
    I understand that you are unable to restore your iPhone.  Here are the best troubleshooting resources to start with when not being able to update or restore your iPhone.
    If you can't update or restore your iPhone, iPad, or iPod touch
    Resolve iOS update and restore errors in iTunes
    -Jason H.  

  • My ipod broke so a friend gave me their old ipod touch but they cant remember the code.  How can i unlock it and get it to work on my computer?  Please help

    My ipod is broken so a friend gave me their old ipod touch but they cant remember the code.  How can i unlock it and get it to work on my computer?  Please help

    The iPod needs to be restored but it only be restored from the computer it was last synced with
    iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    iPhone and iPod touch: Unable to update or restore

Maybe you are looking for

  • I lost Itunes on mac os x 10.5.8. What can I do ?

    I lost Itunes on mac os x 10.5.8. What can I do ?

  • Retain last state

    I have a little accordion sidebar my temporary site I have customized and widget works with mouseover, then click through to new page. Problem I have is once I'm on panel number 2, If I click on a panel content link, when new page loads the accordion

  • HT5642 error dpwnloading iOS6.1.2

    i get an error message saying connection time out while trying to download the new iOS6.1.2 for Ipod touch. I tried also  thru itunes and get the same message. The current version is 5.1.1

  • Simple signal comparison problems

    hi i am tying to do a simple singnal comparison. eventually i want to read in two square wave signals 0-5v signals from my usb6008 DAQ Card But for now i want to Get the simulated wavforms amplitudes, then decide which is bigger. and light up the cor

  • Reporting BIOS problem to MSI

    If anyone could report this BIG BIG issue with the latest Z77A-GD65 BIOS file aka. 10.8B3 to MSI it will be fantastic ! When you have the latest BIOS 10.8B3 and want to enable Virtu Technology in the BIOS, your PC restarts 4 times in a row until the