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

Similar Messages

  • How to send a https request using jsf

    hi
    Can anybody tell a sample how to send a https request using JSF ...
    thanks

    Prefix the request URI with the https protocol.
    The answer is too easy and straightforward that I guess that you mean something else. If you just want to know how to configure an SSL environment for your own webapplication, refer to the Java EE tutorial chapter 28: http://java.sun.com/javaee/5/docs/tutorial/doc/

  • How to transfer the http request from applet to servlet/jsp

    I use the JTree component to create a navigation of a website,but i don't
    know how to connect the tree's nodes with the jsp/servlet.
    I mean how to transfer the http request from the applet to a jsp.
    I use the "<frameset>" mark which will divide the web browse into 2 blocks.
    The left side is Applet,and the right side is the linked jsp page.
    what I say is as the weblogic console layout.
    who can help me!!!
    Thank You!

    I use the JTree component to create a navigation of a website,but i don't
    know how to connect the tree's nodes with the jsp/servlet.
    I mean how to transfer the http request from the applet to a jsp.
    I use the "<frameset>" mark which will divide the web browse into 2 blocks.
    The left side is Applet,and the right side is the linked jsp page.
    what I say is as the weblogic console layout.
    who can help me!!!
    Thank You!

  • How to pass a HTTP request from a simple java class

    Is it possible to pass an HTTP request from a simple java class.if yes how?

    Is it possible to pass an HTTP request from a simple
    java class.if yes how?If you're talking about creating a HttpRequest object and passing it to a servlet, that would be a red flag to me that your design is flawed. You shouldn't have to do that - the application server (Tomcat, Weblogic, etc) should be the only thing that has to worry about creating that kind of object and passing it to you.

  • How to make a http request from a pl/sql procedure(URGENT)

    I need to make a http request from a pl/sql procedure, can any one tell me which built-in package and which procedure/function we serve my need?
    Thanks in advance.
    Ram Prasad.

    You should use UTL_HTTP package, but before it install the JVM into DB

  • How to send a HTTP request to servlet in java application

    I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
    package coreservlets;
    import java.io.*;
    import java.net.*;
    public class PostHTTP
         public static void main(String args[])
              throws IOException, UnknownHostException {
              try
              // URL and servlet
                   URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
                   URLConnection c = myURL.openConnection();
                   c.setUseCaches(false);
                   c.setDoOutput(true);
                   ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
                   PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
                   String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
                   out.print(postData);
                   out.flush();
                   String lengthString = String.valueOf(byteStream.size());
                   c.setRequestProperty("Content-Length", lengthString);
                   c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                   byteStream.writeTo(c.getOutputStream());
                   BufferedReader in =     new BufferedReader(new InputStreamReader
                                                 (c.getInputStream()));
                   String line;
                   //String linefeed = "\n";
                   //resultsArea.setText("");
                   while((line = in.readLine()) != null) {
                        System.out.println(line);
                        //resultsArea.append(linefeed);
              catch(IOException ioe) {
              // Print debug info in Java Console
              System.out.println("IOException: " + ioe);

    here are some updates to your code I haven't tested it running
    post again if you still have trouble
    URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
    HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
    c.setDoInput(true);
    c.setDoOutput(true);
    ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
    String lengthString = String.valueOf(byteStream.size());
    c.setRequestProperty("Content-Length", lengthString);
    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    PrintWriter out = new PrintWriter(byteStream, true);
    //parameters
    String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
    out.print(postData);
    out.flush();
    byteStream.writeTo(c.getOutputStream());
    // connect
    c.connect();
    BufferedReader in = new BufferedReader(new InputStreamReader
    (c.getInputStream()));
    String line;
    while((line = in.readLine()) != null)
        System.out.println(line);

  • How to send the transport request from one client to other client?

    Hello Friends,
    I have generated one transport request in one of the client in Development server.Now as it is  customizing request so unless and until i transport it to other client within the same server, Changes will not be visible in other clients.So how to transport this customizing request from one client to other client within the same server.
    Thanking you guys in advance.
    Regards,
    Jitendra

    Hi Jitendra,
    Release your Transport Request via SE10, then go to STMS & import the request first to your quality server, then to your production server.
    Apologies for the incorrect inputs, please use SCC1 as advised by other forum members
    Hope the above clarifies your query.
    Regards,
    Vivek
    Edited by: Vivek on Mar 16, 2009 1:05 PM

  • How to send a http request to a non java appln

    I have one legacy web application running which can handle only http request . So I need to connect (using http request) and send my request and get the response, without opening that application in browser.
    Any idea
    1) How to connect to non - java appln from a java appln ?
    2) How to use the Httprequest without displaying the page using browser?

    You can try one of three routes:
    Open a socket and write the HTTP request and parse the HTTP response yourself
    Use java.net.URLConnection
    Use Jakarta Common's HttpClient at jakarta.apache.org- Saish

  • How to send POST HTTP Request through PI .

    Hi ,
    I am trying to send a XML mesage at HTTP server from SAP PI 7.1 .
    but not able to , reason is HTTP guy telling me is that ,i am sending a get request through SAP PI 7.1 and it should be POST.
    Where to change this this thing , so that only post request should go.
    There is one more thing , i am facing following request only in Quality . In Development request is going as Post and every thing running fine ...
    Regards
    PS

    It was always HTTP from our end , some config was missing at HTTP guys end , which solve the problem ..
    So there was no issue at PI end.

  • Executing HTTP Request from ABAP

    Hi Experts,
    I am trying to fill & submit an http form through abap using CL_HTTP_CLIENT class methods "request". here is my code:-
    DATA: client TYPE REF TO if_http_client.
    Create Client-Object
    CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
      EXPORTING
        url                = url_string
      IMPORTING
        CLIENT             = client
      EXCEPTIONS
        ARGUMENT_NOT_FOUND = 1
        PLUGIN_NOT_ACTIVE  = 2
        INTERNAL_ERROR     = 3
        others             = 4.
    IF sy-subrc <> 0.
      WRITE: / 'Client Object could not be created. SUBRC=', sy-subrc.
      EXIT.
    ENDIF.
    Set Header Field of request
    CALL METHOD client->request->if_http_entity~set_header_field
      EXPORTING
        name  = '~request_enctype'
        value = 'multipart/form-data'.
    CALL METHOD client->request->if_http_entity~set_header_field
      EXPORTING
        name  = '~request_method'
        value = 'POST'.
    try posting form fields
    CALL METHOD client->request->if_http_entity~set_form_field
      EXPORTING
        name  = 'datasource'
        value = 'GSAPO'.
    CALL METHOD client->request->if_http_entity~set_form_field
      EXPORTING
        name  = 'feedtype'
        value = 'full'.
    CALL METHOD client->request->if_http_entity~set_form_field
      EXPORTING
        name  = 'data'
        value = xml_string.
    CALL METHOD client->send
    EXPORTING
       TIMEOUT                    = CLIENT->CO_TIMEOUT_INFINITE
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        http_invalid_timeout       = 4
        OTHERS                     = 5
    IF sy-subrc <> 0.
      WRITE: / 'Request could not be sent - communication error. SUBRC=',
                                                                 sy-subrc.
      EXIT.
    ENDIF.
    Receive Response
    CALL METHOD client->receive
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc <> 0.
      WRITE: 'Response not obtained - communication error SUBRC = ' ,
    sy-subrc.
      EXIT.
    ENDIF.
    Close HTTP connection
    CALL METHOD client->close
      EXCEPTIONS
        http_invalid_state = 1
        OTHERS             = 2.
    IF sy-subrc <> 0.
      WRITE 'HTTP connection in undefined state'.
      EXIT.
    ENDIF.
    *End of code.
    The problem here is I am getting exception "http_connection_failed" in recieve method.
    Can any body help me out.
    Thanks in advance.
    Madhu.

    is the http destination within intranet or internet? do you connect to internet via proxy server?
    Raja

  • How to call external http client from abap system

    Hi All,
    I have browsed through sdn and google but not found any helpful document ,
    Here my requirement is to call external http client from ecc ,
    Pl suggest..,
    Regards,
    Lokeswar .

    Hi Deepak,
    I have followed the below Reference links :
    Example Program: Executing an HTTP Request - Components of SAP Communication Technology - SAP Library
    http://scn.sap.com/thread/2035765
    but while executing  get http responce i'm facing 'HTTP_COMMUNICATION_FAILURE' error
        CALL METHOD L_HTTP_CLIENT->RECEIVE
          EXCEPTIONS
            HTTP_COMMUNICATION_FAILURE = 1
            HTTP_INVALID_STATE         = 2
            HTTP_PROCESSING_FAILED     = 3.
    Pl suggest ,

  • How to submit a HTTP Request from a Java Program

    I am working on an web based application where in I need to submit the HttpRequest through a Java Program and not through browser. Moreover my intent is just to submit the HttpRequest. I donot want to wait for the response to come back. I have used the URL Connection class to do the same and I am trying to post this request. The contents of the methods that I am using are as below:-
    public void doPost(URL url, String inputXMLString) throws IOException
              //Create URLConnection based on the passed URL
              URLConnection connection = url.openConnection();
              connection.setDoOutput(true);
              connection.setDoInput(false);
              connection.setUseCaches(false);
              connection.setAllowUserInteraction(false);
              connection.setRequestProperty("Content-type", "application/x-www-form-
    urlencoded");
              //Get the Connection's output stream and write the request to it.
              PrintWriter out = new PrintWriter(connection.getOutputStream());
              out.print("&ena-request-input=" + URLEncoder.encode(inputXMLString));
              out.flush();
              out.close();
    Call to the above method does not invoke the URL I am intending to submit the request at.
    Can anybody give me the clue....................................................?

    I agree with the advice to launch a new thread to read and ignore the response. I don't think you should have to do it to make it work, but it's worth trying for two reasons:
    1) If it turns out it does make it work, well, then either you can leave it that way, or use that as a clue to help figure out how to make it work the way you want.
    2) There may be an error message there that will give you an idea why it's not working.
    When you say it's not invoking the servlet, what does that mean, and how do you know? Is it just that the final results aren't being seen? Put a bunch of logging statements in the servlet. It could be that it's getting hit, but you're corrupting the string you're building, or sending some extra junk that it can't handle. Spit out a log statement from the start of doPost, to see if it's even getting there. Then log the parameter. Enclose the output in quotes or braces or something to make sure there's not extra junk. I've had XML docs not parse because there was a blank line at the beginning.
    If it works in the browser but not from your standalone app, then you need to have the servlet tell what difference it sees in the two cases. Print out headers, other params, everything you can think of.
    Re-read the docs for URL, HttpURL, whatever, to make sure you're doing all the right steps in the right order. Make a servlet that just takes a single, simple param=value via POST and see if you can get that to work.

  • How does Flash send outgoing HTTP request to server?

    Hello everyone,
    I would like to know how Flash sends outgoing HTTP requests.
    I would like to know when from the inside of a Flash SWF file
    request for another SWF or FLV file is made; how the Flash sends
    this request to server.
    Thank you very much and have a great day,
    Khoramdin

    Hello everyone,
    I would like to know how Flash sends outgoing HTTP requests.
    I would like to know when from the inside of a Flash SWF file
    request for another SWF or FLV file is made; how the Flash sends
    this request to server.
    Thank you very much and have a great day,
    Khoramdin

  • 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

  • Error while sending a soap request from XML SPY to a webservice in XI

    Hi ,
    I published a webservice om the XI end and testing it with consuming the WSDL file in XML SPY and sending a soap request from there.
    I am getting the following error .
    <b>com.sap.aii.af.mp.module.ModuleException: either no channelID specified or no channel found for the specified party, service, and channel name</b>, MessageServlet(Version $Id: //tc/xi/645_VAL_REL/src/_adapters/_soap/java/com/sap/aii/af/mp/soap/web/MessageServlet.java#4 $)
         at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:380)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Is this error due to the user authentication or due to some other issue .
    Please do let me know soon .
    Thanks a lot
    Nikhil

    Hi Ricardo ,
    I have the correct port now.
    the url looks like
    http://<host>:50000/XISOAPAdapter/MessageServlet?channel=:SIEBEL_DEV:SOAP_CUST
    when I am testing it in the XML spy. and send a soap server request. I am getting the popup for user authentication . once i put my user id it gives me a error saying
    <b>HTTP operation 'POST' could not be performed on URL
    '/XISOAPAdapter/MessageServlet?channel=:SIEBEL_DEV:SOAP_CUST&amp;version=3.0&amp;Sender.Service=SIEBEL_DEV&amp;Interface=http%3A%2F%2FOFCOM%2FUNIFY%2FCustomerMaster%5EMI_CUST'  due to an error :
    The connection to the server was terminated abnormally</b>
    Any Idea as to why is such a error is coming
    Thanks for the help
    Nikhil

Maybe you are looking for