HTTP Request in post

Hi all,
    I want to implement an interface between SAP and a bank.
    The bank provide a HTTP server, when I sent a HTTP request in post method with an XML body to the server, it will answer a response with an XML body to me.
    I search lots of topic about HTTP request in ABAP, then I know I must create a object ref to IF_HTTP_CLIENT, but I don't know which parameter I need to input, and how can I receive the response, and so on.....
    So, I want some simple code, can you help me? thanks in advance!
    PS: Does I need to configure a HTTP Adapter? I never use XI so I don't know any adapter, I just want to sent a request and receive a response in ABAP
Edited by: Wei Jie Pan on Mar 23, 2009 3:54 AM

you can use HttpURLConnection to POST or GET request in your backing bean
See this example
    public void youTubeServerAction(ClientEvent clientEvent) {
      URL               url;
      HttpURLConnection conn;
      StringBuffer strBuffer = new StringBuffer();
        try {
            url = new URL("http://gdata.youtube.com/feeds/users/thomasthiele/uploads?alt=json-in-script&callback=showMyVideos&max-results=50");
            conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("GET");                   // >> set here POST request
            InputStream in = conn.getInputStream();
            int c;
            while ((c = in.read()) != -1)
                strBuffer.append((char)c);
            System.out.println(strBuffer.toString());
            in.close();
            conn.disconnect();           
        } catch (Exception e) {
            e.printStackTrace();
        FacesContext fctx = FacesContext.getCurrentInstance();
        ExtendedRenderKitService serv =
            Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
        System.out.println("SOURCE " + strBuffer.toString());
        serv.addScript(fctx, strBuffer.toString());       
    }Good luck.
Thomas

Similar Messages

  • How to Record HTTP Requests and POST data

    Hai all..
    Can anyone help me to solve this issue..
    How to Record HTTP Requests and POST data by using java..
    regards
    Ranjith Nair

    You should read about TCP and splitting data stream into packets and learn how to understand packet header to assemble stream from packets.
    Actually there are few different stages:
    1. detect handshake to start new empty stream within your code;
    2. detect subsequent packets and assemble stream (there are counters within packet header and they will help).
    After creating start of TCP stream (usually 1KB is enough) you'll be able to detect is it HTTP request/header or no and start logging or ignoring packets for this connection.

  • How to send a document in net.HTTP.request as a POST variable?

    I have read and reread the doc on net.HTTP.request, and it says I can pass an argument of oRequest, but I have not succeeded at passing in the current document, which is what I want to do.
    I've tried app.activeDocs[0], or encoding that to a string, but though it makes the call without error, nothing is sent.
    Should oRequest be simply a document, or a variable made up of name-value pairs? How do we send multiple parameters to a POST otherwise?
    I've succeeded fine with calling using GET, but when I tried to pass the document as a GET variable, I got nothing either.
    I'm sending to a LiveCycle REST end point so either POST or GET is fine.
    Thanks!

    POSTing the current document is straightforward *provided* your script is running outside the document context (i.e. in the console or a folder-level script). There's no access from doc-level scripts for obvious reasons.
    For example, putting this in the JS console will POST the current file to a URL:
    Net.HTTP.request({
      cVerb:'POST',
      cURL: 'http://localhost/submit.php',
      oRequest: Collab.documentToStream(this),
      oHandler: {
        response: function (msg, uri, err) {
           if (err!=undefined) app.alert(msg);
    Your problem with talking to a vanilla webservice is that you cannot send the RFC1867 delimeters (i.e. form a "multipart/form-data" request) as the ReadStream object doesn't have a concatenation method in the Acrobat JSAPI. That's also how you would usually prepend other form fields, but if you're careful with your server-side coding you can send those as GET parameters in cURL. Normally you'd be polite and pass a Context-Type header in the aHeaders array - it won't matter to the transmission process but will allow your webservice to predict what the heck it's been sent.
    Your webservice will then have to read the raw data. In PHP for example, you won't get anything in the $_FILES global but you can grab the PDF by reading everything from the input buffer, with the line:
    $pdf = file_get_contents("php://input");
    If that line was in the server script that the above JS code was aimed at, the variable $pdf will contain an exact binary copy of the currently-open document.

  • Is there a restriction on length of Http request posted to a Iplanet Web Server ?

    I am submitting an Http Request by POST method to my server. The request will be received and forwarded by Iplanet Web Server to a clustered Weblogic environment, which will then be handled by Java Servlets. The problem I am facing is that when the length of the request shoots up to around 2000 bytes, NES doesn't receive and forward the request to Weblogic. There is no fixed cut-off for the length, it keeps fluctuating.
    I observed the following after hitting the server hundreds of times with Http Requests that vary in length.
    1) If length of Request is below 1500 bytes, request always goes through successfully.
    2) In a range of 1500 bytes to 2000 bytes, request fails most of the times. (Around 80 %)
    3) Requests with length above 2000K invariably fail, though it just worked for a 2.4K request on one occasion (out of some 100 hits)
    Note that by "length of request", I mean the data I post through Http Request (I just have a single parameter in Http request having the literal "XML" as key and a well formed XML document as value. That is equivalent to submitting a HTML form just having a text area called "XML" containing a XML document. )
    I presume that the length of actual Http Request is slightly greater than that of XML (probably by around 100 bytes).
    My Iplanet documentation says that the upper limit on the length of a POST Http Request is 64 K, which is way above the value (2-3 K) at which I am facing the problem.

    Hi Ganesh
    Did you check the HTTP Persistent timeout of your server? Check the value which has been set up by default. Try increasing the timeout value and try again.
    follow these steps it might solve your problem:
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)(note : if you are posting large amount of data or file increase the value accordingly)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    If this doesnot solve your problem notify me
    regards
    T.Raghulan
    [email protected]

  • HTTP request using PL/SQL

    I've the following header and http request.
    POST http://deab/DexNETWebServices_4_0_0_4/LoginService.svc HTTP/1.1
    MIME-Version: 1.0
    Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"
    VsDebuggerCausalityData: uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA
    Host: deab
    Content-Length: 1017
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>19e0ddb4-5fa5-41ee-b624-aea762865a6c</systemId><strName>FirmwareUpdateLogQueryWorker</strName><productId>0af39a3e-6549-485b-872f-b73413203998</productId><password>abc</password></LoginByUserName></s:Body></s:Envelope>
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--
    I'm using the following code to set the header from PL/SQL.
    l_http_req := UTL_HTTP.begin_request ('http://deab/DexNETWebServices_4_0_0_4/LoginService.svc', 'POST', 'HTTP/1.1');
    UTL_HTTP.set_header (
             l_http_req,
             'Content-Type',
             'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
    UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
    But UTL_HTTP.get_response returns the error 400 Bad Request. How do I set MIME-Version and VsDebuggerCausalityData from the header?
    Thank you for your help on this.

    Here is the complete code that returns the 400 Bad Request error. Thanks for your help.
    DECLARE
       l_request         CLOB;
       l_http_req        UTL_HTTP.req;
       l_http_resp       UTL_HTTP.resp;
       v_buffer          VARCHAR2 (32767);
       p_status_code     NUMBER (9);
       p_error_message   VARCHAR2 (32767);
       p_response        CLOB;
    BEGIN
       l_request :=
             '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>'
          || '19e0ddb4-5fa5-41ee-b624-aea762865a6c'
          || '</systemId><strName>'
          || 'FirmwareUpdateLogQueryWorker'
          || '</strName><productId>'
          || '0af39a3e-6549-485b-872f-b73413203998'
          || '</productId><password>'
          || 'abc'
          || '</password></LoginByUserName></s:Body></s:Envelope>
    --uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--';
       DBMS_OUTPUT.put_line ('request ' || l_request);
       l_http_req :=
          UTL_HTTP.begin_request (
             'http://deab/DexNETWebServices_4_0_0_4/LoginService.svc',
             'POST',
             'HTTP/1.1');
       UTL_HTTP.set_header (
          l_http_req,
          'Content-Type',
          'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
       UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
       UTL_HTTP.set_header (l_http_req, 'MIME-Version', '1.0');
       UTL_HTTP.set_header (
          l_http_req,
          'VsDebuggerCausalityData',
          'uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA');
       UTL_HTTP.write_text (l_http_req, l_request);
       DBMS_LOB.createtemporary (p_response, FALSE);
       l_http_resp := UTL_HTTP.get_response (l_http_req);
       BEGIN
          LOOP
             UTL_HTTP.read_text (l_http_resp, v_buffer, 32767);
             DBMS_OUTPUT.put_line (v_buffer);
             DBMS_LOB.writeappend (p_response, LENGTH (v_buffer), v_buffer);
          END LOOP;
       EXCEPTION
          WHEN UTL_HTTP.end_of_body
          THEN
             NULL;
       END;
       UTL_HTTP.end_response (l_http_resp);
       p_status_code := l_http_resp.status_code;
       p_error_message := l_http_resp.reason_phrase;
       p_response := REPLACE (p_response, '&lt;', '<');
       p_response := REPLACE (p_response, '&gt;', '>');
       DBMS_OUTPUT.put_line (
          'Status: ' || p_status_code || '-' || p_error_message || ': ' || p_response);
    END;

  • The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST

    Hi,
    When trying with Postman sending a REST call to Azure Storage Queues I get:
    The MAC signature found in the HTTP request '***' is not the same as any computed signature. Server used following string to sign: 'POST.
    The code I have for creating the Authorization Header:
    var accountName = "my_account";
    string key = ConfigurationManager.AppSettings["my_access_key"];
    DateTime dt = DateTime.Now;
    string formattedDate = String.Format("{0:r}", dt);
    var canonicalizedHeaders = "x-ms-date:" + formattedDate + "\n" + "x-ms-version:2009-09-19" + "\n" ;
    var canonicalizedResource = "/my_account/myqueue/messages";
    var stringToSign = String.Format("POST,\n\n\n\n\n\n\n\n\n\n\n{0}{1}", canonicalizedHeaders, canonicalizedResource);
    stringToSign = HttpUtility.UrlEncode(stringToSign);
    HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
    var signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)));
    var authorizationHeader = String.Format(CultureInfo.InvariantCulture, "SharedKey {0}:{1}", accountName, signature);
    return authorizationHeader;
    Anyone any idea what I'm missing/doing wrong?
    Additional question: do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?
    Thanks.

    One issue is with this line of code:
    HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(key));
    Please use the following:
    HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String(key));
    and that should take care of the problem.
    Regarding your question, "do i have to create for every message I want to send a new Authorization header? Or is there an option (as with Service Bus Topics) to create a header that can be used for a certain timeframe?"
    With your current approach, the answer is yes. What you can do is create a Shared Access Signature on the queue which will be valid for certain duration and then use that for posting messages to a queue using simple HttpWebRequest/HttpWebResponse.
    Hope this helps.

  • How to post multiple http requests using a single http connection in java

    I am using the httpurlconnection class and it allows only to post one request on a connection. I require to post multiple http requests by opening a single connection. Code examples please. Thanx in advance.

    Hi
    I found this article through Google. I hope it helps a little
    http://www.developer.com/tech/article.php/761521
    D

  • PL/SQL posting to HTTP request

    Hi
    As part of a web application I am developing, I need to generate an HTTP post from a PL/SQL package. The problem I am having is that the message going out is not properly formatted and is being rejected by the listening application (in this case, WebCT)
    The MIME message should be formatted like this. (this is what I get when I use Perl to generate the call...)
    POST /webct/systemIntegrationApi.dowebct HTTP/1.1
    Host: roach:4041
    Connection: Keep-Alive, TE
    TE: trailers, deflate, gzip, compress
    User-Agent: RPT-HTTPClient/0.3-3E
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Content-type: multipart/form-data; boundary=WebCT_Enterprise_API_boundary
    Content-length: 1506
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="adapter"
    ims
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="ACTION"
    import
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="OPTION"
    unrestrict
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="SCTMODE"
    OFF
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="TIMESTAMP"
    1091141996
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="AUTH"
    3D 1F DC E0 F7 15 5A 1F F4 99 CA 70 D4 68 1C 57
    --WebCT_Enterprise_API_boundary
    Content-Disposition: form-data; name="FILENAME"; filename="baseline_import.xml"
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE ENTERPRISE SYSTEM "IMS-EP01.dtd">
    <ENTERPRISE>
    <PROPERTIES>
    <DATASOURCE>McGill University SCT Banner</DATASOURCE>
    <TYPE>Initial Creation</TYPE>
    <DATETIME>2000-00-00T12:00:00</DATETIME>
    </PROPERTIES>
    <GROUP>
    <SOURCEDID>
    <SOURCE>Banner 2000 SCT Banner</SOURCE>
    <ID>6536.200409</ID>
    </SOURCEDID>
    <DESCRIPTION>
    <SHORT>HIST-666-001</SHORT>
    </DESCRIPTION>
    <RELATIONSHIP myrelationship="3">
    <SOURCEDID>
    <SOURCE>Banner 2000 SCT Banner</SOURCE>
    <ID>6537.200409</ID>
    </SOURCEDID>
    </RELATIONSHIP>
    </GROUP>
    </ENTERPRISE>
    WebCT_Enterprise_API_boundary
    HTTP/1.1 200 OK
    Date: Thu, 29 Jul 2004 21:56:27 GMT
    Server: Apache/2.0.49 (Unix) DAV/2 mod_ssl/2.0.49 OpenSSL/0.9.6m mod_jk/1.2.3-dev
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html
    35
    Success: Import file (baseline_import.xml) complete.
    0
    My PL/SQL code that tries to build the outgoing call is
    req := utl_http.begin_request('http://atlas.cc.mcgill.ca:8900/webct/systemIntegrationApi.dowebct','POST', 'HTTP/1.1');
    utl_http.write_text(req,'Content-type: multipart/form-data; boundary=WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="adapter"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'ims' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="ACTION"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'import' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="OPTION"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'unrestrict' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="SCTMODE"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   'OFF' || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="TIMESTAMP"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   timestamp || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="AUTH"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   mac || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary' || CHR(13)|| CHR(10) ||
                   'Content-Disposition: form-data; name="FILENAME"; filename="xlist.xml"' || CHR(13)|| CHR(10) ||
                   '' || CHR(13)|| CHR(10) ||
                   total_xml_string || CHR(13)|| CHR(10) ||
                   '--WebCT_Enterprise_API_Boundary--' || CHR(13)|| CHR(10));
    resp := utl_http.get_response(req);
    utl_http.read_text(resp, val);
    utl_http.end_response(resp);
    When I watch the network traffic generated by this PL/SQL I do not have any carriage returns which makes WebCT to believe that the message does not carry the proper data and returns Fatal Failure(99): Invalid URL arguments...
    Is there somewhere where I can see sample code for placing HTTP requests using the utl_http package? Or if I am doing something obviously wrong (I am new at this whole PL/SQL thing...) please let me know.
    Thank you
    Bogdan

    If UTL_HTTP.SET_TRANSFER_TIMEOUT has no effect, probably your hang is due to the fact that the machine is completely down and inaccessible.
    As the name suggests, SET_TRANSFER_TIMEOUT only controls the timeout when UTL_HTTP succeeds in making a connection to the remote Web server and it times out the request when no more response is received by certain time while the connection is not closed by the remote server either.
    In your case, you probably need a connect-timeout which isn't provided by UTL_HTTP (yet).

  • Read of HTTP Request POST parameters failed:Read timed out

    Hi !
    Any one seen this exception . any ideas of the cause?
    java.lang.RuntimeException: Read of HTTP Request POST parameters failed: Read timed out
    at org.apache.catalina.connector.HttpRequestBase.parseParameters(HttpRequestBase.j ava:665)
    at org.apache.catalina.connector.HttpRequestBase.getParameterValues(HttpRequestBase.java :737)
    at org.apache.catalina.connector.RequestFacade.getParameterValues(RequestFacade.java:170 )
    Thanks,

    Assuming there is nothing wrong with
    org.apache.catalina.connector.HttpRequestBase.parseParameters
    I can only think of 2 things:
    1. The timeout is set for an extremely short time in the Apache settings (server.xml&#51032;)
    2. The client application is sending the POST verry slow or incorrect. For example the
    client says that the POST is 500 long than sends 200 and leaves the connection open.
    You can try and post the following:
    request.txt:
    POST /somePath/somefile.js HTTP/1.1
    Host: localhost:44
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041217
    Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 45
    depreciatedButWontPostWithoutAName=some+valueThe client sending the request:
    import java.io.*;
    import java.net.*;
    import java.io.DataOutputStream;
    import java.applet.Applet;
    public class appTest extends Applet implements Runnable {
         public static final int HTTP_PORT = 80;
         public static final String hostName = "localhost";
         public void run() {
              try{
                   InetAddress addr = InetAddress.getByName(hostName);
                   Socket s = new Socket(addr,HTTP_PORT);
                   BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(), "UTF8"));
                   s.setSoTimeout(2000);
                   File fileToSend = new File("request.txt");
                   FileInputStream fleHTML = new FileInputStream(fileToSend);
                   StringBuffer sbHTMFile = new StringBuffer();
                   int b = fleHTML.read();
                   while(b!=-1){
                        sbHTMFile.append((char) b);
                        b = fleHTML.read();
                   wr.write(sbHTMFile.toString());
                   wr.flush();
                   BufferedReader rd = new BufferedReader(new InputStreamReader(s.getInputStream()));
                   String line;
                   while ((line = rd.readLine()) != null) {
                        System.out.println(line);
                   wr.close();
                   rd.close();
                   } catch (Exception e) {
                        e.printStackTrace();
         public void init(){
              new Thread(this).start();
         public appTest(){
              new Thread(this).start();
         // main program
         public static void main(String argv[]) throws Exception {
              new appTest();
    }In appTest.java change HTTP_PORT to the port you need and hostName to the
    hostname you need.
    In request.txt change the /somePath/somefile.js to the location you desire.
    And change Host: localhost:44 to the hostname and post you desire.

  • After Mavericks OS upgrade, can no longer make any HTTP requests with the OPTIONS verb

    My machine can no longer make any HTTP requests with the OPTIONS verb. This happens whether I try it curl, postman, or ajax.
    curl -i -X OPTIONS http://www.google.com returns curl: (52) Empty reply from server
    It should return a long string containing a 405 error code.
    I suspect that this is related to the Mavericks upgrade I did earlier this week. I only have one mac (my dev machine) with Mavericks. Other macs are Mountain Lion and they don't have this problem.
    Can anyone else with Mavericks confirm whether or not they have this problem too?
    If this is Mavericks related, anyone know of a fix or workaround?

    Turns out that it wasn't Mavericks related at all. Cisco AnyConnect has a security module running behind the scenes even when you're not VPNed into anything. It was blocking my OPTIONS verb requests. I was able to make these calls after uninstalling.
    Re-installing with Web Security turned off should prevent it from happening. While I was uninstalling I did notice that there was a web security uninstall script in /opt/cisco/vpn/bin but I already committed to taking the whole app off my machine. Simply running that script could have done it too.
    I must give credit to Ben Nadel. It was his blog post that helped me fix this issue.
    http://www.bennadel.com/blog/2559-Cisco-AnyConnect-VPN-Client-May-Block-CORS-AJA X-OPTIONS-Requests.htm?&_=0.10495476494543254#comments_44093

  • Creation of shopping cart through HTTP request

    Hello all, I am trying to create a shopping cart through a HTTP request.
    The URL I am managing is the same that the one that the Web Service BBPSC01 uses.
    Using the following code I cannot connect to the server in background, the error "This browser is not supported" is launched.
    In addition to this, I can open the URL successfully via R/3 when executing online.
    Help very appreciated!
    Thanks.
    data declarations
    DATA: client TYPE REF TO if_http_client.
    DATA: host      TYPE string VALUE 'host',
          host2      TYPE string,
          service   TYPE string VALUE '8000',
          path      TYPE string VALUE '/sap/bc/gui/sap/its/bbpsc01/?sap-client=020&sap-language=EN',
          errortext TYPE string. "used for error handling
    DATA: dest(13) TYPE c.
    dest = 'ZPORTAL_CESTA'.
    CALL METHOD cl_http_client=>create_by_destination
      EXPORTING
        destination              = dest
      IMPORTING
        client                   = client
      EXCEPTIONS
        destination_not_found    = 1
        internal_error           = 2
        argument_not_found       = 3
        destination_no_authority = 4
        plugin_not_active        = 5
        OTHERS                   = 6.
    IF sy-subrc NE 0.
      WRITE: / 'Create failed, subrc = ', sy-subrc.
      EXIT.
    ENDIF.
    set http method POST
    CALL METHOD client->request->set_method(
      if_http_request=>co_request_method_post ).
    client->request->set_version(
         if_http_request=>co_protocol_version_1_1 ).
    client->request->set_header_field( name = '~request_method'
    value = 'GET' ).
    set request uri (/<path>[?<querystring>])
    DATA uri TYPE string.
    uri = path.
    cl_http_utility=>set_request_uri( request = client->request
                                      uri     = uri ).
    FIN: conectamos el final de la peticion
    Send
    DATA timeout TYPE i.
    CALL METHOD client->send
      EXPORTING
        timeout                    = timeout
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      DATA: subrc TYPE sy-subrc.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( send )',
             / 'code: ', subrc,
             / 'message: ', errortext.
      EXIT.
    ENDIF.
    CALL METHOD client->receive
      EXCEPTIONS
        http_communication_failure = 1
        http_invalid_state         = 2
        http_processing_failed     = 3
        OTHERS                     = 4.
    IF sy-subrc NE 0.
      CALL METHOD client->get_last_error
        IMPORTING
          code    = subrc
          MESSAGE = errortext.
      WRITE: / 'communication_error( receive )',
             / 'code: ', subrc, 'message: '.
      EXIT.
    ENDIF.
    DATA return_str TYPE string.
    return_str = client->response->get_cdata( ).
    close
    CALL METHOD client->close
      EXCEPTIONS
        http_invalid_state = 1
        OTHERS             = 2.
    DATA html_control TYPE REF TO cl_gui_html_viewer.
    DATA container   TYPE REF TO cl_gui_custom_container.
    DATA html_table TYPE TABLE OF char255.
    Create container for HTML viewer
    CREATE OBJECT container
      EXPORTING
        container_name              = 'CONTAINER'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.
    IF sy-subrc NE 0.
      MESSAGE e208(00)
         WITH 'The control HTML_CONTAINER could not be created'.
    ENDIF.
    CREATE OBJECT html_control
      EXPORTING
        parent = container.
    CALL FUNCTION 'CONVERT_STRING_TO_TABLE'
      EXPORTING
        i_string         = return_str
        i_tabline_length = 255
      TABLES
        et_table         = html_table.
    DATA: l_doc_url(255) TYPE c.
    CALL METHOD html_control->load_data
      EXPORTING
        type         = 'text'
        subtype      = 'html'
      IMPORTING
        assigned_url = l_doc_url
      CHANGING
        data_table   = html_table.
    CALL METHOD html_control->show_url
      EXPORTING
        url = l_doc_url.

    Dear Poster
    Your thread has had no response since it's creation over
    2 weeks ago, therefore, I recommend that you either:
    - Rephrase the question.
    - Provide additional Information to prompt a response.
    - Close the thread if the answer is already known.
    Thank you for your compliance in this regard.
    Jason Boggans
    SAP SRM SDN Moderator

  • HTTP Request Error

    Hi Iam using Flex to display pie chart in my application. Im
    getting the pie chart in Mozilla firefox but in IE iam getting Http
    Request Error. Iam giving the code what i wrote. Please find. can
    anybody help me in this? thanks
    mxml file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" width="300" height="232" backgroundColor="white"
    usePreloader="true">
    <mx:Script>
    <![CDATA[
    import mx.messaging.channels.StreamingAMFChannel;
    import mx.charts.series.LineSeries;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.controls.Alert;
    import mx.controls.*;
    import mx.events.*;
    [Bindable]
    public var orXmlList:XMLList;
    [Bindable]
    public var orXml:XML;
    [Bindable]
    public var orderCount:String = "0";
    private function getOrXML():void{
    orRPC.cancel();
    orRPC.send();
    public function handleXML(event:ResultEvent):void
    orXml = event.result as XML;
    orXmlList = event.result.orderResultsData.order as XMLList;
    var orMetaString:String = "orMeta";
    orderCount = orXml.orderResultsData[0].orMeta[0].orderCount;
    public function handleFault(event:FaultEvent):void
    Alert.show(event.fault.faultString, "Error");
    ]]>
    </mx:Script>
    <mx:HTTPService result="handleXML(event);"
    fault="handleFault(event);" id="orRPC" resultFormat="e4x"
    method="POST" url="/global/corpOrderResults.csc"
    useProxy="true">
    </mx:HTTPService>
    <mx:PieChart x="0" y="46.95" id="orPieChart" width="168"
    height="126" dataProvider="{orXmlList}"
    creationComplete="getOrXML();" showDataTips="true">
    <mx:series>
    <mx:PieSeries nameField="name" field="count" />
    </mx:series>
    </mx:PieChart>
    <mx:Legend dataProvider="{orPieChart}" x="141.25"
    y="56.6" verticalGap="0"/>
    <mx:Label id="orInfoLabel" x="0" y="20.95" text="Orders
    updated in the last 30 days: {orderCount}" width="283.4"
    height="18"/>
    </mx:Application>
    Text
    And my JSp page is:
    <div id="flashcontent">
    </div>
    <script type="text/javascript">
    var so = new SWFObject("/global/flash/litigationByNoc.swf",
    "mymovie", "400", "200", "8", "#336699");
    so.write("flashcontent");
    </script>

    Hi,
    I have checked the logs. I am getting errors like the below:
    1.     com.sap.engine.services.servlets_jsp.server.deploy.impl.exceptions.WCEApplicationNotStartedException: The application [sap.com/com.sap.portal.ivs.iviewservice] is configured to have ALWAYS start up mode. Currently it is in STOPPED status - because of this it will not be started implicitly by the Web Container service and any internal operation that needed this application to be running will fail. There are two possible reasons for STOPPED status: 1) The application failed to start during cluster startup. 2) The application is stopped by system administrator.
    2.     .info.exception.WD4VCRuntimeException: FAILED: process plan id: generatedBindPlan_CWG_UI action: null
    3.     Thread HTTP Worker [2] failed to acquire exclusive lock on client session
    But the data is being processed by the code correctly. I tried printing the final values of the o/p and the values are as expected.

  • XML Insert into database by direct http request from browser

    I want to ask if it is possible to pass a xml filename which valuse should be stored in the database directly by a http request of i.e. IE 5.5.
    I mean perhaps such a construction: http://pcziegl/Test_Insert.xsql?posted-xml=http://pcziegl/Test_Insert.xml

    The xsql page looks like:
    <?xml version="1.0"?>
    <xsql:insert-request xmlns:xsql="urn:oracle-xsql" connection="test" table="test"/>
    The xml to be inserted:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW num="1">
    <NAME>andreas</NAME>
    <PASTNAME>fischbach</PASTNAME>
    <VALUE>24</VALUE>
    </ROW>
    <ROW num="2">
    <NAME>robert</NAME>
    <PASTNAME>loerks</PASTNAME>
    <VALUE>40</VALUE>
    </ROW>
    <ROW num="3">
    <NAME>hubert</NAME>
    <PASTNAME>fuenfer</PASTNAME>
    <VALUE>35</VALUE>
    </ROW>
    <ROW num="4">
    <NAME>konrad</NAME>
    <PASTNAME>reiser</PASTNAME>
    <VALUE>38</VALUE>
    </ROW>
    <ROW num="5">
    <NAME>lisa</NAME>
    <PASTNAME>fischer</PASTNAME>
    <VALUE>35</VALUE>
    </ROW>
    <ROW num="6">
    <NAME>wolfgang</NAME>
    <PASTNAME>hesse</PASTNAME>
    <VALUE>53</VALUE>
    </ROW>
    <ROW num="7">
    <NAME>juergen</NAME>
    <PASTNAME>ebbinghaus</PASTNAME>
    <VALUE>33</VALUE>
    </ROW>
    <ROW num="8">
    <NAME>joerg</NAME>
    <PASTNAME>weigl</PASTNAME>
    <VALUE>28</VALUE>
    </ROW>
    <ROW num="9">
    <NAME>tom</NAME>
    <PASTNAME>spaarmann</PASTNAME>
    <VALUE>33</VALUE>
    </ROW>
    </ROWSET>
    Thanks for your advices.

  • Embedded "multipart/encrypted" HTTP Request?

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

  • SOAP Adapter Sender PI7.1: 400 Bad HTTP request

    Hello,
    I have a problem with a SOAP adapter sender communication channel.
    I'm trying to migrate a scenario from XI 3.0 to PI7.1 SP6 (PI_BASIS 2006_1_710 SAPKIPYN06).
    I can send messages successfully to the old system using the URL
        http://host:port/XISOAPAdapter/MessageServlet?channel=:BC_Name:CC_SOAP_Sender
    On PI7.1 I get
        400 Bad HTTP request
        Error: -21
        Version: 7010
        Component: HTTP_PLG
        Module: http_plgrt_mt.c
        Line: 5226
        Error Tag:
        Detail: illegal request version
    I have created a Sender Agreement, generated the wsdl from that and tried the URL in there.
    Surprisingly it has the old format, namely
        http://host:port/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_Name&receiverParty=&receiverService=&interface=myInterface&interfaceNamespace=urn:my.Interface:ns
    although the 7.1 documentation describes the ?channel=party:service:channel style only.
    Anyway, the result remains the same.
    I tried some other approaches like escaping the colons in the URL without success.
    The user has the role SAP_XI_DEVELOPER_J2EE assigned.
    Any idea what's wrong here?
    Thanks in advance
    Rainer

    >>In RWB the channel appears as "started but inactive".
    Yeah,it will be like that because you are posting messages directly to Integration server."Propose URL" does that.You are bypassing the adapter engine when you use the URL generated by "Propose URL" button.
    /people/stefan.grube/blog/2006/09/21/using-the-soap-inbound-channel-of-the-integration-engine
    The above blog gives the reason for this,if you want to bypass the adapter engine,then generate the URL as given in the above blog
    /people/siva.maranani/blog/2005/03/01/testing-xi-exposed-web-services
    This blog explains how to post message to adapter engine,here you need to change the URL,don't click on "Propose URL" button.You can monitor SOAP adapter in RWB only if you generate the URL as given in second blog
    The URL which is working for you in XI 3.0 is posting messages to adapter engine,so generate the URL in PI 7.1 in the same way,by following the second blog i have mentioned.
    Thanks
    Aamir

Maybe you are looking for

  • Local folders in Mail

    Hi, I have a problem to create a new "Local Folder" in my Mail program. I am talking about local folders which I can see in right gray panel in Mail program ( Inbox, Smart Mailboxes, Reminders, RSS and On My Mac - local folders). These folders was cr

  • How to fix a router needs to be reset every morning?

    I just purchased a new WRT54G V8.0. I upgraded to 8.0.0.2 and set up my network. I have 3 wireless devices and one wired device. The wireless devices are the Desktop, the Laptop, and the Wii console. The wired device is the Xbox. My problem is this..

  • Apple Pay not working over half the time at Subway & Walgreens after adding TCF card

    After I got my iPhone 6, there weren't many places that took Apple Pay...i tried it at Subway and it worked there at first and then it worked at Walgreens too. I mostly used AmEx cards and Citibank cards. However, once my bank finally started being A

  • Need after effects programmer

    I am a real estate broker and we purchased a DAKTRONICS Galaxy Pro sign and are in need of someone who can use the After Effects program.   Someone who is proficient with this program and works from home would be great.  Any help out there?  Thank Yo

  • Setting secure on session management cookie only in production

    I am faced with the following: In our developmentcycle we deliver full application exports to an acceptation environment and after testing to a production environment. However, only our production site does HTTPS. Development and acceptation only do