HTTP Request/Response in ABAP

Hello Experts
I have a simple requirement, where I want to access a web url from my ABAP program and get the response from url in my program. I have never handled such a requirement.
Kindly suggest the solution.
Thanks and best regards,
Anand.

Use class CL_HTTP_CLIENT and an HTTP destination in SM59.  There are multiple examples of code on the forum as well as blogs/tutorials available.

Similar Messages

  • HTTP request/response object not thread safe.

    According to the serlvet spec. Http Request/Response
    are not thread safe. Quoting from the Spec:
    " Implementations of the request and response objects are not guaranteed to be thread safe. This means that they should only be used within the scope of the request handling thread. References to the request and response objects must not be given to objects executing in other threads as the resulting behavior may be nondeterministic."
    This has prompt me to ask the following question.
    For Example I have a servlet which does the following
    request.setAttribute("myVar","Hello");
    The request and response is dispatched(using RequestDispatch.include(request,response)) to another
    servlet which retrieve this attribute i.e request.getAttribute("myVar");
    Is this safe?
    The Spec only said "The Container Provider must ensure that the dispatch of the request to a target
    servlet occurs in the same thread of the same VM as the original request." I take this meaning that the targeting servlet does not have to run in the same thread(only dispatch), otherwise it would be safe.

    To put it another way, you can only have onle thing working on a request at a time. For instance, the ServletContext is available to all servlets running on a server. If you tried to save a particular request to the ServletContext, it would potentially be available to many concurrently running servlets. They could all change whatever in it at the same time. Each servlet is in its own running thread. Hope that helps some.

  • Possible to get runtime info (Http request, response) from a WD4A Appl.?

    Hey,
    In a BSP / JSP application, it is possible to retrieve and set the runtime data (http request and response). For Example:
    response.setContentType("application/x-suvaagent;charset=iso-8859-1");
    response.setHeader("Cache-Control", "public");
    response.getWriter().print("<Request>");
    response.getWriter().print("</Request>");
    Is it possible to do this in a WebDynpro (ABAP) Application?
    The requirement is to construct a file using http response method. This file contains parameters like business data etc. The file type is already registered as a MIME type which is associated with a standalone program.
    When sending the http response, the file will be filled out with needed data and the associated program will be called using the data in the file.
    I haven't found out how to do this in web dynpro application, since we use WD4A in our project.
    Thanks and Regards,
    Liang

    In Web Dynpro you do not have direct access to the Request or Response object. This is part of the design of the abstracted rendering and makes things like the SmartClient and the AJAX based Delta Rendering possible.
    In Web Dynpro you should use the FileDownload UI element or the CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a8d95673b12fe2e10000000a42189d/frameset.htm
    If you want more control over the response object for a download then I might suggest that you can create a cached response object, place it into the ICM cache and generate a unique URL for it.  You can then fire a navigation plug or a LinkToURL to go to that cached response object.

  • Http request response

    Hi
    Im having trouble with a request /response.
    What I'm trying to do is send a string to a http request such
    as
    http://webdeploy/r/mixes/mixreq.aspx?username="+username+"&mixname="+mixname,
    "_parent"
    The response of this returns a string value.
    Ive tried using getURL but all that does is open a new html
    page with the response string printed on it.
    I couldnt get this to work with urlRequest either.
    Basically all I want to do is capture the returned string
    thanks,
    dub

    Thanks for the reply Raymond.
    I've been using the URIRequest class. It wasnt working for me
    and then I ran the application in debug mode.
    I got the following error
    *** Security Sandbox Violation ***
    Connection to
    http://webdeploy/r/mixes/mixreq.aspx?username=bernard1&mixname=My
    XYZ Mix_parent halted - not permitted from
    file:///C|/Documents%20and%20Settings/ba%Fetch.swf
    -- Untrusted local SWFs may not contact the Internet.
    Unable to load requested document.
    Do you know what this whole sandbox business is about and how
    to get around it?

  • Long HTTP Request/Response round trip time on new Azure Websites under BizSpark Plus

    Hi,
    I have a very difficult situation. I am busy migrating from a traditional VM architecture to Azure Websites. This is after a few months of testing and being happy that Azure Websites can provide the performance necessary for our application. The TEST site
    I set up is running great and meets all the performance requirements. The TEST site is set up under my normal BizSpark subscription.
    We have since been awarded a BizSpark Plus subscription and I have started the migration process on this subscription, as opposed to the normal BizSpark basic subscription.
    However, since starting our migration process, I am experiencing huge latency on the HTTP request roundtrip from browser to server and back for my newly created LIVE Azure Website instance. I have investigated and observed the statistics between the TEST
    and LIVE instances. Here is a test run against the 2 environments on a particular screen of our application. Here are the times for the full roundtrip for each AJAX HTTP request of the specific actions:
    TEST (Azure Website on BizSpark subscription):
    GetAudioSource - 267ms
    LogStartEvent - 196ms
    LogProgress - 243ms
    Retrieval of Audio file - 2.06s
    LIVE (Azure Website on BizSpark Plus subscription):
    GetAudioSource - 938ms
    LogStartEvent - 3.61s
    LogProgress - 5.11s
    Retrieval of Audio file - 5.97s
    There is clearly something wrong with the routing of the LIVE instance starting at the load balancer.
    This is not the only place affected. In fact, all the HTTP requests are very lagged and delayed in the LIVE instance as opposed to hardly noticeable in the TEST instance.
    I am wondering if there is a lower priority being afforded to my BizSpark Plus subscription running my LIVE instance, of if I am just unlucky with the underlying infrastructure that has been selected on my behalf. Or, is it possible that something can be
    done to enhance and optimise the routing etc?
    I also need to say that I have matched the Azure Website configuration and scale settings to be exactly the same between the 2 instances and have also set Always On to ON.
    Any help or thoughts will be greatly appreciated, because I am starting to seriously doubt the service levels of the Azure Websites platform.
    Thank you
    Ozzy

    Hello Ozzy Vox,
    1. Which region(data center) do you have your websites deployed in?
    Ideally there would be no change in terms of type of subsciptions when you deploy your website in production.
    I suggest that you set up diagnostics on to your Azure websites to get the logs to understand where it is spending most of its time and the reason behind the latency.
    You can refer to this link that will give you information on 'How to Monitor Websites':
    http://azure.microsoft.com/en-in/documentation/articles/web-sites-monitor/
    Also refer to this link regarding 'Enable diagnostic logging for Azure Websites':
    http://azure.microsoft.com/en-in/documentation/articles/web-sites-enable-diagnostic-log/
    Thanks,
    Syed Irfan Hussain

  • How to read the Image Data using HTTp Request response

    i want to read image data from server please send me any code or answers.
    and also i want to exit application using button control for iphone simulator.
    thanks in advance.

    You would do a URLRequest and download the image. You could save it to disk and then load it or directly create a new image with the binary data.

  • Load Balancing HTTP requests to ABAP App Servers options?

    Looking at SAP Documentations, SAP recommends to use the Web Dispatcher to load balance HTTP requests to multiply ABAP App servers. 
    My question is that the only solution? or can we use hardware such as the F5 BigIP to perform the same job?
    Any thoughts?

    In collaboration with SAP and SAP customers, F5 Networks has created a solution that delivers security, high availability, and improved performance for SAP web and portal technologies.
    By deploying F5 Networks solutions with SAP NetWeaver, enterprises extend their control over their Network and Application traffic, and ensure the fast and secure delivery of their applications.
    Benefits of F5 for SAP NetWeaver and Enterprise SOA
    u2022 Cuts SAP Enterprise Portal login time by more than half for WAN users
    u2022 Speeds document downloads
    u2022 Reduces SAP server CPU utilization by 44%
    u2022 Provides a 20x reduction in the number of SAP server-side connections
    Further details, case studies and deployment guides on;
    http://www.f5.com/solutions/applications/sap/netweaver/
    F5 certification information on SAP Website
    http://www.sap.com/partners/directories/SoftwareISVSolutions.epx?context=21B87D61C0F646A22B2A6DB254A010CA8C9C141B7529F029910FE6FF9EEEC5A701BF20EED61AC07159D98BAA068EBE1B8C5C7665EA2226374E942CF1D2A49D20AB1BFDFA1E0B68EC41E3058F04A85F105D5002CF1A11383C905D9FE5DDB951251A4B574B0BBE58309F67667A3B95877FEF85F1EF8B2C1A9F6FBA3BF5066D9534%7c01518B8BD6BF02F55A5A72E5947F2C45
    Hope this helps. Thanks

  • Request & Response

    When we try to test the application, it sends the http request to abap engine from whcih we get the corresponding response.
    Suppose that my application component has one view with two input fields and one action button.
    If we run the application for the first time, we get the response in the form of a page with these two input field elements and
    button. Suppose Now, i have filled tese two input fields and pressed the button and some validations happened. And closed the
    web page.
    Here ABAP engine responded for two things.
       i)  Initially it gives the response by rendering the web page for our URL request.
       ii)  Second it has done some validation for the given inputs by using the action event.
       iii) At last, I closed the webpage from the client webbrowser( here no interaction with abap engine). 
        In this scenario, When can we say that HTTP request/response cycle is completed?
        Is it happened  HTTP request/response for two times here?
       I appreciate ur help.

    This sounds like the age old question: If a tree falls in the forest, but no one is there to hear it; did it really make any sounds?  Of course the answer is: who cares? 
    In your description there will technically be 3 request/response cycles. 
    When you close the browser, some special JavaScript fires, making a request to the server to close your session and fire the WDDOEXIT method.  So your assumption of no interaction with abap engine on close is incorrect.

  • NAT type detection from a HTTP request

    Hello there
    I got two JAVA class : httpServer and httpClient. Running in two different machines. Server is listening to a HTTP port in one machine and on the other hand client is sending its machine IP from other PC to the server. But the client is behind a NAT. Now I can detect in my httpServer class that it is behind a NAT. I check the requesting IP and the IP send inside the packet payload. If they are different, I decide there is a NAT in between. But how can I know from such HTTP request-response what kind of NAT I am behind? This is important to know because with symmetric NAT
    (http://en.wikipedia.org/wiki/Network_address_translation) , where the NAT binding also include the outgoing address as well, my application is having problem.
    I have solution like STUN/TURN server implementation. But I would like to know the type of NAT my client is behind without any extra deployment such as STUN or TURN server.
    Any suggestion to detect type of NAT without any extra deployment and merely from HTTP request-response JAVA APIs?
    Mohammed Jubaer Arif.

    Thanks
    It seems you are asking me to configure the NAT, may be with some programming. Or may be I should run the server class on the NAT machine.
    But my client and server classes will be all over the world. Thus I think it is not a practical solution to ask the NATs to assist me. The intelligence should be in my client and server messaging.
    So I was wondering, is there any way out for me to get the NAT type with JAVA programming, in the server side once I get a request from the client side. But without any extra deployment.
    But as you said �There's not much of NAT types.� :(
    Mohammed Jubaer Arif

  • How to send a http-request from abap?

    I want to send a xml file through a http-request ,what should i do?

    Welcome to SDN
    you can use cl_http_client class to do that. search the abap general forum with key word cl_http_client and you will find lot of examples.
    Regards
    Raja

  • PO 7.4: NW BPM: HTTP Error response for SOAP request or invalid content-type.HTTP 200 OK

    Hi Experts
    I am trying to call NW BPM scenario(File to BPM) from PI, and using below adapter config.
    I am getting below error.
    Failed to call the endpoint: Error in call over HTTP: HTTP 200 OK
    SOAP: Call failed: java.io.IOException: HTTP Error response for SOAP request or invalid content-type.; HTTP 200 OK
    SOAP: Error occurred: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: HTTP Error response for SOAP request or invalid content-type.; HTTP 200 OK
    MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: HTTP Error response for SOAP request or invalid content-type.; HTTP 200 OK
    Transmitting the message to endpoint <local> using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: HTTP Error response for SOAP request or invalid content-type.; HTTP 200 OK
    Any idea how to fix this issue?
    Thanks,
    Sandeep Maurya.

    Hi Sandeep,
    Test the URL from your browser and check the proxy settings as well.
    Refer the below links
    SOAP: call failed: java.io.IOException: invalid content type for SOAP: TEXT
    SOAP: Call failed: java.io.IOException: Failed to get the input stream from socket: java.net.SocketException: Connection…
    Regards
    Bhargava Krishna

  • HTTP Request to Integration Server through ABAP Mapping

    Hi Experts,
    I need to send HTTP Request to Integration Server through ABAP Mapping.
    Could you please provide me ABAP code which will post data to Integration Server.
    Thanks,
    Abdur

    Hi Abdur,
       Can you explain your requierement more clearly?
    Abap mapping is purely to convert the data in source structure to data in target structure.
    It is not the job of Mapping to send data.
    Regards,
    ravi

  • SOAP Receiver Error: HTTP Error response for SOAP Request

    Hi gurus,
    I'm facing a weird error in File --> PI 7.31 java only --> soap receiver proxy.
    The other interfaces runs well. just one get the the following error:
    Exception caught by adapter framework: java.io.IOException: Error receiving or parsing request message: java.io.IOException: HTTP Error response for SOAP request or invalid content-type.
    I check the payload and test in the inbound proxy. on error.
    Any hints?
    Thanks a lot!
    regards
    Christine

    Hello Christine,
    I faced the same issue,
    You can use the beans below to overcome the error.
    And charset should be utf-8

  • Persistent HTTP Requests in BSP: Can you Flush the Response without Ending It?

    Hello all,
    I have been looking for a way to implement a persistent HTTP Request in a BSP.  This means the server keeps the request open as long as possible and sends data periodically to the browser without closing the request.  In other development environments, there would be a way to flush the response to the client, separate from closing the connection, thus making this possible.  I have looked and do not see any way to do this.
    Also, if it is not possible with a BSP, is there another way to do this via the Web Application Server?
    Thanks for any help,
    -Chris

    There are various limits: the number of sockets / file descriptors that the operating system lets a program have open, the amount of socket buffer space in the operating system, the number of simultaneous connections that the web server allows. Each of these can be configured.
    One problem is that a web server starts a thread for each hit. If you have 1000 simultaneous active hits you have 1000 threads. That is quite a lot. I've seen server OSes start buckling at around 400-500 threads. Given a suitable OS you may get higher with a bit of configuration, but I'd say the number of threads is rather a big concern. 100,000 threads? That dog don't hunt.
    An alternative would be not to use a regular web server, but to use a NIO select -based server. Then you can have one thread that handles all the connections. I once did that to write a stock ticker applet. But if you want to do fully standards compliant HTTP implementation that's not trivial.
    If you are writing the client applet as well as the server, consider using a simpler protocol than HTTP and writing a NIO server. NIO isn't quite trivial to get really right; look at examples and tutorials; google is your friend. If you can keep each client's connection open do so; establishing and tearing down hundreds or thousands of connections a second, and sending HTTP request and reply headers, is going to eat network and CPU resources.
    If you are really targeting 100,000 clients at 5 seconds between messages, that comes to 20,000 messages per second. That's a lot; plan for a load balanced server cluster.

  • Executing an HTTP Request in ABAP Code

    Hi,
    I have to write an ABAP program to check VAT numbers before making any VAT declaration. SAP checks the logic of the number, however it does not check if a VAT number is still valid for that company. The European Commission has a website (http://ec.europa.eu/taxation_customs/vies/) where you can check centrally all VAT numbers used in the EU. According to the Commission's web site it should be possible to have an open interface. A SOAP service is available (Its WSDL file can be obtained also on the website).
    Does anyone has an idea how this can be done (Current SAP version = SAP ECC 6.0) taken into account there is no XI (or IP) aviable or set up or used.
    Thanks,
    Jan

    Hi,
    The examples are calling a browser but that is not what we are looking for. What we are looking for is (via ABAP) to send our http request and receive back the anwser. They (http://ec.europa.eu/taxation_customs/vies/) provide the SOAP message (WSDL : (http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl). My question is if it is possible witout using XI and yes how? If I understand it correctly is should be possible via ABAP (example program RSWF_TEST_HTTP), but if I create my own program I get the message HTTP-Receive: RC=400  ICM_HTTP_CONNECTION_FAILED. Maybe the ABAP code is correct, but maybe I should change some settings or configure something else.
    Jan

Maybe you are looking for

  • Using a European Mac Pro in the States.

    Is there anything i should know before plugin it in? Any risks?

  • In segment IDOC attribute I occurred instead of SEGMENT

    Hi I am trying to post an IDOC thru XI, using XSLT(ABAP Engine) to convert an incoming message to IDOC format. Though the IDOC output is well formed, the message fails with an error message(see below). Has anyone experienced this problem before? I am

  • NavigateToURL bug in FireFox?

    Hi all, I'm expreiencing a strange bug with FireFox... I have the following example application: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import flash.n

  • Disabling Apps view in Windows 8.1 Enterprise

    Hi Guys, I have a question about deploying Windows 8.1 through Group Policy in domain forest. How can i disable the app view on the startscreen of Windows 8.1? And how can i disable unwanted apps. Please help me out... regards, Hafid el Addouti

  • Settings | General Unreachable on 3G IOS4.0.1

    I just upgraded my 3G to IOS4.0.1. I am out of the country so I am careful to keep data roaming off. It was off when I upgraded. Occasionally I'll switch it to get some info or send a quick facebook update. I can no longer do this because I cannot ge