Http post with parameters

Hi All,
We want to send an HTTP post with parameters,  and we are not sure how to do that.  We tried to do that like the code below,but we get the parameters in the body and not in the header ...
  DATA lo_client      TYPE REF TO  if_http_client.
  DATA lv_status_code TYPE i.
  DATA lv_reason      TYPE string.
  CALL METHOD cl_http_client=>create_by_destination
    EXPORTING
      destination  = 'ZRFC_TEST'
    IMPORTING
      client       = lo_client.
  lo_client->request->set_method( if_http_request=>co_request_method_post ).
  cl_http_utility=>set_request_uri( request = lo_client->request
                                    uri     = '?param1=value1' ).
  lo_client->send( ).
  lo_client->receive( ).
  lo_client->response->get_status( IMPORTING code   = lv_status_code
                                             reason = lv_reason ).
Thanks a lot,
Tuvia.

Hi,
what do you mean by "parameters on the query". In any http request you can have two types of variables: POST or GET. The post variables are transferred in http header and you can add them using methods from my previous post. GET variables are transferred in URL. HTTP client has a method APPEND_FIELD_URL which can be used to add variable into URL string.
Cheers

Similar Messages

  • How would I do a http post with a xml file

    How would I do a http post with a xml file.
    I have a url called https://localhost:8443/wss/WSS and the XML file is sent as part of the HTTP POST body.
    How would I send this XML file when posting?

    most people just add feedback to the comments they've asked about already, rather than ignoring all the feedback and making a new post with the exact same information:
    http://forum.java.sun.com/thread.jspa?threadID=5247331&messageID=10020973#10020973
    If you want to add in an XML file to a POST command, you'd add it just like any other file you'd attach to a post request, especially (if you're request is the same as your last post) if you're just doing a jsp page. I'd do it something like this:
    <form method=POST ENCTYPE="multipart/form-data" action="https://rcpdm.mnb.gd-ais.com/Windchill/servlet/IE/tasks/DJK/fcsAddContentComplete.xml">
    <H3> File Name </H3>
    <input type=file name=filename>
    <input type=submit value="Do it!">
    </form>Then again, this solution has literally nothing to do with java, and you still need to make sure that your servlet knows what to actually do with that information you're sending it.

  • HTTPS post with certificate - certificate exception

    Hi,
    I am trying to create java program to do HTTPS post with certiticate.
    I get certificate in *.P12 file. When I open HttpsURLConnection I have received exception : javax.net.ssl.SSLException: No certificate authorities are registered for this secure application
    during startHandshake. I run java with properties
    -Djavax.net.ssl.keyStore=value -Djavax.net.ssl.keyStorePassword=value -Djavax.net.ssl.keyStoreType=pkcs12
    Shell I use JKS (trustStore properties) for server certificate ? Or I have to add some more code ?
    Thanks in advance
    M

    I am trying to create java program to do HTTPS post with certiticate.Do you mean that the server requires client authentication and the clients each have a keypair and signed certificate in their keystore?
    Shell I use JKS (trustStore properties) for server certificate?Yes. But you need to find out whether the server's certificate is self-signed or signed by a CA. If it is self-signed you will have to get them to export it, and import it into the truststore of each client. NB not the keystore of each client.
    Or I have to add some more code ?No.

  • HTTP POST with XML with HTTPService

    Hi,
    I need to be able to send an HTTP POST request to a server I
    have on Tomcat. In the body of the POST Request I need to have the
    following:
    <setView domain="someDomain" view="macro" />
    We have tried the following using the HTTPService, but with
    no such luck
    <mx:HTTPService id="setViewHTTPService" url="{serverURL}"
    resultFormat="object" contentType="application/xml"
    method="POST">
    <mx:request>
    <setView domain="abc" view="xyz" />
    </mx:request>
    </mx:HTTPService>
    Is there a way for us to specify the body of the HTTP Post
    using HTTPService, or a different class for that matter.

    var variables:URLVariables = new
    URLVariables("name=Franklin");
    //or variables.name = "Franklin";
    var request:URLRequest = new URLRequest();
    request.url = "
    http://www.[yourdomain
    request.method = URLRequestMethod.POST;
    request.data = variables;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, completeHandler);
    try
    loader.load(request);
    catch (error:Error)
    trace("Unable to load URL");
    function completeHandler(event:Event):void
    trace(event.target.data.welcomeMessage);
    This is in the help documentation and what I generally use.

  • Can I use third party web services that communicate via http-post with webui builder?

    Hi, 
    I have 5 computers (services) that are controlled via http-post. 3 of these services are implemented as labview webservices, 1 is labview socket (with python http-wrapper) and the last one is implemented with c# (lighttpd + cgi). 
    Can I use webui builder to controll all of them? Or, what is the simplest change so I can use webui builder?
    What I would like to do, is to change the current javascript-UI to labview-webui. For the interfaces implemented with labview webservices, this is not a problem. For non-labview services, I don't know if it is even possible.
    br,
    Juha

    To add to Mike's answer, the only caveat is that the server needs an appropriate clientaccesspolicy.xml file at the root level (http://yourserver/clientaccesspolicy.xml), or a completely open crossdomain.xml file, for the editor and built apps to be able to communicate with it. There's a help topic which explains this in the context of LV web services, but it's true for Web UI Builder to be able to communicate with arbitrary web servers also.
    Since it sounds like you control all the web servers in question, it shouldn't be too difficult to get this file in place, though.

  • Http post with bpel

    I am not sure if this forum is the right forum for my question but I post anyway to see if anyone can help
    me. I have created a very simple bpel using http post; all it does is to copy the input to the output.
    The output from my bpel looks like this:
    <myContact xmlns="http://xml.netbeans.org/schema/XmlPost">
    <ns0:LastName xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
    <ns0:FirstName xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
    <ns0:EmailAddress xmlns:ns0="http://xml.netbeans.org/schema/XmlPost">
    LastName=aa&FirstName=bb&EmailAddress=cc&OfficeAddress=dd</ns0:EmailAddress>
    <ns0:OfficeAddress xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" />
    </myContact>
    My question is why the EmailAddress element contains all my input data. I should expect the lastname element
    has 'aa', the firstname element has 'bb', the emailAddress has 'cc' and the officeAddress has 'dd'.
    Can someone please tell me what I do wrong in here.
    Thanks,
    ================================================================================================
    Here's my html page to call the bpel process:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <form action="http://localhost:18182/XmlPostServiceService/XmlPostServicePort/submit" method="POST">
    Last Name: <input type="text" name="LastName" value="" size="10" />
    First Name: <input type="text" name="FirstName" value="" size="10" />
    Email Address: <input type="text" name="EmailAddress" value="" size="10" />
    Office Address: <input type="text" name="OfficeAddress" value="" size="10" />
    <input type="submit" value="post" />
    </form>
    </body>
    </html>
    ==================================================================================================
    Here is the xsd file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/XmlPost"
    xmlns:tns="http://xml.netbeans.org/schema/XmlPost"
    elementFormDefault="qualified">
    <xsd:complexType name="MyContact">
    <xsd:sequence>
    <xsd:element name="LastName" nillable="true" type="xsd:string"/>
    <xsd:element name="FirstName" nillable="true" type="xsd:string"/>
    <xsd:element name="EmailAddress" nillable="true" type="xsd:string"/>
    <xsd:element name="OfficeAddress" nillable="true" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="myContact" nillable="true" type="tns:MyContact"/>
    </xsd:schema>
    =================================================================================================
    Here is my bpel file:
    <?xml version="1.0" encoding="UTF-8"?>
    <process
    name="XmlPost"
    targetNamespace="http://enterprise.netbeans.org/bpel/XmlPost/XmlPost"
    xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://enterprise.netbeans.org/bpel/XmlPost/XmlPost" xmlns:ns1="http://j2ee.netbeans.org/wsdl/XmlPostService" xmlns:ns0="http://xml.netbeans.org/schema/XmlPost" xmlns:ns2="http://enterprise.netbeans.org/bpel/LogServiceServiceWrapper" xmlns:ns3="http://service.log.com/">
    <import namespace="http://j2ee.netbeans.org/wsdl/XmlPostService" location="XmlPostService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
    <partnerLinks>
    <partnerLink name="PartnerLink1" partnerLinkType="ns1:XmlPostService1" myRole="XmlPostServicePortTypeRole"/>
    </partnerLinks>
    <variables>
    <variable name="XmlPostServiceOperationOut" messageType="ns1:XmlPostServiceOperationReply"/>
    <variable name="XmlPostServiceOperationIn" messageType="ns1:XmlPostServiceOperationRequest"/>
    </variables>
    <sequence>
    <receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationIn"/>
    <assign name="Assign1">
    <copy>
    <from variable="XmlPostServiceOperationIn" part="LastName"/>
    <to>$XmlPostServiceOperationOut.outcome/ns0:LastName</to>
    </copy>
    <copy>
    <from variable="XmlPostServiceOperationIn" part="FirstName"/>
    <to>$XmlPostServiceOperationOut.outcome/ns0:FirstName</to>
    </copy>
    <copy>
    <from variable="XmlPostServiceOperationIn" part="EmailAddress"/>
    <to>$XmlPostServiceOperationOut.outcome/ns0:EmailAddress</to>
    </copy>
    <copy>
    <from variable="XmlPostServiceOperationIn" part="OfficeAddress"/>
    <to>$XmlPostServiceOperationOut.outcome/ns0:OfficeAddress</to>
    </copy>
    </assign>
    <reply name="Reply1" partnerLink="PartnerLink1" operation="XmlPostServiceOperation" portType="ns1:XmlPostServicePortType" variable="XmlPostServiceOperationOut"/>
    </sequence>
    </process>
    ======================================================================================================
    Here's my wsdl file:
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions name="XmlPostService" targetNamespace="http://j2ee.netbeans.org/wsdl/XmlPostService"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ns="http://xml.netbeans.org/schema/XmlPost"
    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:tns="http://j2ee.netbeans.org/wsdl/XmlPostService">
    <types>
    <xsd:schema targetNamespace="http://j2ee.netbeans.org/wsdl/XmlPostService">
    <xsd:import namespace="http://xml.netbeans.org/schema/XmlPost" schemaLocation="XmlPost.xsd"/>
    </xsd:schema>
    </types>
    <message name="XmlPostServiceOperationRequest">
    <part name="LastName" type="xsd:string"/>
    <part name="FirstName" type="xsd:string"/>
    <part name="EmailAddress" type="xsd:string"/>
    <part name="OfficeAddress" type="xsd:string"/>
    <!-- part name="request" element="ns:myContact"/ -->
    </message>
    <message name="XmlPostServiceOperationReply">
    <part name="outcome" element="ns:myContact"/>
    </message>
    <portType name="XmlPostServicePortType">
    <operation name="XmlPostServiceOperation">
    <input name="input1" message="tns:XmlPostServiceOperationRequest"/>
    <output name="output1" message="tns:XmlPostServiceOperationReply"/>
    </operation>
    </portType>
    <binding name="XmlPostServiceBinding" type="tns:XmlPostServicePortType">
    <http:binding verb="POST"/>
    <operation name="XmlPostServiceOperation">
    <http:operation location="submit"/>
    <input name="input1">
    <http:urlEncoded/>
    </input>
    <output name="output1">
    <mime:mimeXml part="outcome"/>
    </output>
    </operation>
    </binding>
    <service name="XmlPostServiceService">
    <port name="XmlPostServicePort" binding="tns:XmlPostServiceBinding">
    <http:address location="http://localhost:18182/XmlPostServiceService/XmlPostServicePort"/>
    </port>
    </service>
    <plnk:partnerLinkType name="XmlPostService1">
    <!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes.
    In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
    A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
    <plnk:role name="XmlPostServicePortTypeRole" portType="tns:XmlPostServicePortType"/>
    </plnk:partnerLinkType>
    </definitions>
    ================================================================================================

    sure you send the right xml?
    what I would try is to copy the xml from the receive, paste and extend it, and see if this works . . these errors are mostly because of no namespace defined or such ..
    sure your element has the right namespace?
    hth clemens
    2)
    here is the xml for the following schema ..
    XML
    <ns1:AttributetestProcessRequest xmlns:ns1="http://xmlns.oracle.com/Attributetest">
    <ns1:input/>
    </ns1:AttributetestProcessRequest>
    schema
    schema attributeFormDefault="unqualified"
         elementFormDefault="qualified"
         targetNamespace="http://xmlns.oracle.com/Attributetest"
         xmlns="http://www.w3.org/2001/XMLSchema">
         <element name="AttributetestProcessRequest">
              <complexType>
                   <sequence>
                        <element name="input" type="string"/>
                   </sequence>
    <attribute name="service" use="required" type="string"/>
              </complexType>
         </element>
         <element name="AttributetestProcessResponse">
              <complexType>
                   <sequence>
                        <element name="result" type="string"/>
                   </sequence>
              </complexType>
         </element>
    </schema>
    it works design and runtime in 10.1.3.1
    Message was edited by:
    clemens.utschig

  • One  last try... emulating HTTP POST with applet

    I am trying emulate the HTTP POST method for file uploading using an applet. More specifically, I am trying to upload raw data to a PHP script by making the PHP script think it is receiving a file when in reality all it is receiving is a series of headers, some other necessary info, the data, and a closer. The PHP is then supposed to save the data into a file.
    I have looked at eight or ten threads, explanations, and sample code in this and other forums that deal with this exact same thing, some even specific to PHP, read various documents on and explanations of HTTP headers and so forth, corrected every code error and possible code error I could find, and tried a gazillion variations, but still can't get the PHP script to think that it is receiving a file.
    As far as I can tell, communication with the server is being established, the server is receiving info and sending responses back, the PHP script is defrinitely being activated to do its thing, but the PHP is not recognizing anything that looks like a file or even a file name to it.
    The following information may be relevant:
    The PHP works perfectly with real files uploaded from real HTML pages.
    The server uses Apache.
    The server has no Java support (shouldn't matter, but otherwise I would be using servlets at that end instead of PHP).
    the applet is in a signed jar, and is trying to store information in the same directory that it came from.
    I am using the Firefox browser (shouldn't matter?) .
    I am hoping that someone knowegeable about this can look at the code below and point our any errors. I've also included the response I get from the server, and the PHP code. If there are no obvious errors, can you think of anything else tthat might be going wrong besides the code itsef?
    Please don't suggest I try alternate means of doing this or grab some working code from somewhere. I may very well wind up doing that, but I'm a stubborn bastard and want to find out what the #^%R$($ is going wrong here!!!
    Here is the latest incarnation of the applet code: All it does is immediately try to send some text to the PHP script in such a way that the script thinks it is uploading text within a file. it also displays the responses it gets from the server, including what the PHP script sends back.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class test1 extends Applet{
    DataOutputStream osToServer;
    DataInputStream isFromServer;
    HttpURLConnection uc;
    String content = "This is a test upload";
    public void init(){
    try
    URL url = new URL( "http://www.mywebpage.com/handleapplet.php" );
    uc = (HttpURLConnection)url.openConnection();
    uc.setRequestMethod("POST");
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setAllowUserInteraction(false);
    uc.setRequestProperty("Connection", "Keep-Alive");
    //uc.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
    uc.setRequestProperty("Content-Type","multipart/form-data; boundary=7d1234cf4353");
    uc.setRequestProperty( "Content-length", ( Integer.toString( content.length() ) ) );
    osToServer = new DataOutputStream(uc.getOutputStream());
    isFromServer = new DataInputStream(uc.getInputStream());
    catch(IOException e)
    System.out.println ("Error etc. etc.");
    return;
    try{
    osToServer.writeBytes("------------------------7d1234cf4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n\r\n");
    osToServer.writeBytes(content);
    osToServer.writeBytes("\r\n------------------------7d1234cf4353--\r\n");
    osToServer.flush();
    osToServer.close();
    catch (Exception e) {
    System.out.println(e);
    System.out.println("did not sucessfully connect or write to server");
    System.exit(0);
    }//end catch
    try{
    String fieldName="",fieldValue="";
    for ( int i=0; i<15; i++ )
    fieldName = uc.getHeaderFieldKey(i);
    System.out.print (" " + fieldName +": ");
    fieldValue = uc.getHeaderField(fieldName);
    System.out.println (fieldValue);
    }catch(Exception e){
    System.out.println ("Didn't get any headers");
         try{        
    String sIn = isFromServer.readLine();
                        for ( int j=0; j<20; j++ )
                             if(sIn!=null)
    System.out.println(sIn);
                             sIn = isFromServer.readLine();
    isFromServer.close();
    }catch(Exception e){
              e.printStackTrace();
    }//end AudioUp.java
    Here's the response I get back from the server:
    null: HTTP/1.1 200 OK
    Date: Sun, 03 Apr 2005 18:40:04 GMT
    Server: Apache
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    <html>
    <head>
    <title>Handling uploaded files from an applet, etc.</title>
    </head>
    <body>
    No file was uploaded.
    </body>
    </html>
    The <html> and the "No file uploaded" message is simply what the PHP script sends back when it does not detect any uploaded file.
    Here is the PHP code on the server:
    <html>
    <head>
    <title>Handling uploaded files from an applet, etc.</title>
    </head>
    <body>
    <?php
    if ($testfile)
    print "The temporary name of the test file is: $testfile<br />";
    $uplfile=$testfile_name;
    $uplfile=trim($uplfile);
    print "The filename is: $uplfile<br />";
    if ($uplfile)
    copy ($testfile, "$testfile_name");
    unlink ($testfile);
    }else{
    print "No file was uploaded.";
    ?>
    </body>
    </html>

    xyz's sample code didn't work - PHP doesn't like the getallheaders line at all. I'm going back to the manual now.
    I had another thought. When I first started using PHP, I had problems with ordinary text field uploads from web pages because somewhere in the process, extra blank lines or spurious carriage returns were being inserted into the strings. For example, if I had a place where people could enter their name, password, and brief message, and tried to store the incoming strings in an array, I'd wind up with some thing like:
    name
    password
    brief message
    instead of:
    name
    password
    brief message
    Which played havoc when trying to read out information by counting lines.
    Anyway, the problem was solved by using the trim($string) function on all incoming strings, which I now do as a matter of course. I never could figure out why it was happening though.
    Do you think something like that could be happening here?? I mean, if spurious blank lines or carriage returns were being inserted where they shouldn't be, could that be screwing things up in this way? HTTP seems to insist on having new lines and blank lines inserted in just the right places.

  • HTTPS Post with XI

    Hi mates,
    I've a scenario that complains a RFC call to XI and then, XI makes a HTTPS Post on a specific server.
    I've created a HTTP Destination (type G) on SM59, set it to use SSL at Logon & Security tab, using the DFAULT ssl client(that i've created at STRUST transaction).
    The problem is when i try to TEST the connection, an successful textless message appears in the bottom and nothing happens! The server that will receive the request doesn't receive nothing when it occurs.
    I've debugged the testbutton of SM59 and i found that the problem occurs in cl_http_client, in the method IF_HTTP_CLIENT~RECEIVE, and the exception is http_communication_failure.
    Somebody faced the same problem?
    Is the Destinations created on the J2EE Admin Service avaliable to my XI Communication Channel?
    Thanks in advance.

    Hi Bruno,
    Try using the SOAP adapater instead of the plain HTTP way.
    These links might help:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/frameset.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
    Coe

  • HTTP POST with Java? (Submit file)

    I want to submit a file to a web service using Java, specifically the JXXX Compiler Service (http://www.innovation.ch/java/java_compile.html). It seems like the page uses HTTP POST. How can I do this?
    Any help would be appreciated.

    I suggest you ask them you question.
    Have you read the instructions on how to use it.
    http://www.innovation.ch/java/java_comp_instr.html

  • HTTP POST with advance balance cookies

    Hello
    I am trying to keep a session sticky for 20 mins based on cookies. The problem is the application is using HTTP POSTs and the balance method only looks into the HTTP GET. How can I get the CSS to look into the HTTP POST?
    Any examples would be great.
    Thanks.
    Donagh

    Hi Gilles
    Thanks for your reply. I have obviously been misinformed about the POST and the GET. That is good but now I don't have an answer to my problem!! I am balancing on a cookie called ASP.NET_SessionId=
    Here is my config
    content Toughbook_PDAs
    vip address 10.40.21.28
    add service w2k-eolasprd1
    add service w2k-eolasprd2
    protocol tcp
    port 80
    string prefix "ASP.NET_SessionId="
    sticky-inact-timeout 20
    advanced-balance cookies
    active
    I have attached a trace and I am looking for
    ASP.NET_SessionId=1w0cql550wou04albf4jrjfoy45
    Hopefully my config is incorrect.
    Thank You
    Donagh

  • Http post with applet

    Hi, im really new to java, and i just read the previous posts about posting with java but i dont get it pretty well, and i am triyng to post a simple string, to get it in the php as a variable and use it. Can anyone help me please?

    I see, you read the errorstream in the catch block.
    Thanks for that tip, I will of course add it to my
    implementations :)
    My current one (without error handling from above)
    is the following (it works good so far)
    Maybe it helps someone, or maybe someone
    detects problems in it:
      *  Post the string document to the server from where the
      *  applet has been loaded.
      *  Then wait for the string response, suppose it is html
      *  and display it in a html editor pane.
      public boolean postDocument( final String document,
                                 final String documentParameter )
        System.out.println("postDocument(): starts.");
        boolean success = true;
        try
           // Establish a connection to the server:
           System.out.println("postDocument(): using basis URL: " + super.getDocumentBase().toExternalForm() );
           System.out.println("postDocument(): postURL " + this.postURL );
           URL url = new URL( super.getDocumentBase(), this.postURL );
           URLConnection con = url.openConnection();
           System.out.println("postDocument(): Received a URLConnection subclass of type " +
                                   con.getClass().getName() );
           con.setDoInput(true);
           con.setDoOutput(true);
           con.setUseCaches(false);
           con.setRequestProperty("CONTENT_LENGTH", "" + document.length() ); // actually not checked
           System.out.println("postDocument(): Set content-length to: " + document.length() );
           System.out.println("postDocument(): Getting an output stream...");
           OutputStream os = con.getOutputStream();
           OutputStreamWriter osw = new OutputStreamWriter(os);
           osw.write("RequestDocument=");
           osw.write( document );
           if( ( documentParameter != null ) && (documentParameter.length() > 0) )
            osw.write("&RequestDocumentParameter=");
            osw.write( documentParameter );            
           osw.flush();
           osw.close();
           System.out.println("postDocument(): After flushing the output stream...");
           System.out.println("postDocument(): Getting an input stream...");
           InputStream is = con.getInputStream();
           // any response ?
           InputStreamReader isr = new InputStreamReader(is);
           BufferedReader br = new BufferedReader(isr);
           StringBuffer htmlReply = new StringBuffer();
           String line = null;
           while( (line = br.readLine()) != null )
                 htmlReply.append(line);
             System.out.println("postDocument() response: " + line);
           } // while
           // error interception:
           if( htmlReply.length() == 0 )
                 htmlReply.append("<html><body>No reply from the server. An error has occured.</body></html>");
           String replyText = htmlReply.toString();
           this.showHTML( replyText );
           // and look, if the the applet has received a page redirection directive,
           // in which case, the applet will tell the browser to
           // redirect to that page:
           if( this.redirectionAddressAfterPost != null )
             this.gotoRedirectionPage();      
        catch(Exception e)
          success = false;
          System.out.println("*** postDocument(): Exception catched:");
          e.printStackTrace();
        System.out.println("postDocument() has ended.");
        return success;
      } // postDocument

  • Http post with cgi script

    Hello everyone,
    I currently have a pl/sql web form that executes a cgi script... Instead of that cgi containing any html and printing a page, I would like to just grab the output and print it as text, wrapping it in my pl/sql headers and footers and the like...
    I want to use util_http post to grab the cgi output, but am a little unsure how to do this - any tips??
    Many thanks

    See this link for help:
    http://download-west.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a89852/utl_htt4.htm#1003115

  • Kerberos Ticket via Java to BW to access BW Querys with HTTP POST

    Hi and thanks for reading,
    im Working with 2004 and the NWDS SP10. We have a project which must show some reports from the HR system via backend and some BW Reports done with Web Application Designer 3.5.
    The user of the project application is able to select personnel numbers or org units in a tree UI element. At design time we do not know hwo many of each he might select (could be a couple of hundreds or even more).
    A URL isn't long enough to support our needs (255 characters border)
    A consultant said that we should use HTTP Post with a Form. He gave me an example like this
    <HTML>
    <BODY>
    <form name="querySelektion" action="<system name>" method="POST">
              <input type="submit" value="Formular senden" />
              <!-- Template Parameter -->
              <input name="SAP-LANGUAGE" type="hidden" value="D" />
              <input name="PAGENO" type="hidden" value="1" />
              <input name="CMD" type="hidden" value="LDOC" />
              <input name="TEMPLATE_ID" type="hidden" value="Z_TEST_AX" />
              <!-- Selektionsparameter -->
              <input name="var_name_1" type="hidden" value="H1_ORGST" /></td>
              <input name="VAR_NODE_IOBJNM_1" type="hidden" value="0ORGUNIT" />
              <input name="var_value_ext_1" type="hidden" value="50058503" />
         </form>
    </BODY>
    </HTML
    This is working beside the fact that i have to fill in my BW username and password. I translated this to Java with  the Jakarta HTTP Librarys into the following code.
    try
                HttpClient httpClient = new HttpClient();
                PostMethod post = new PostMethod("http://<system name>");
                NameValuePair[] data =
                        new NameValuePair("SAP-LANGUAGE", "D"),
                        new NameValuePair("PAGENO", "1"),
                        new NameValuePair("CMD", "LDOC"),
                        new NameValuePair("TEMPLATE_ID", "Z_TEST_AX"),
                        new NameValuePair("var_name_1", "H1_ORGST"),
                        new NameValuePair("VAR_NODE_IOBJNM_1", "0ORGUNIT"),
                        new NameValuePair("var_value_ext_1", "50058503")};
                post.setRequestBody(data);
                int iReturnCode = httpClient.executeMethod(post);
                wdContext.currentContextElement().setTextView(Integer.toString(iReturnCode ));
                post.releaseConnection();
            } catch (IOException ioe)
                wdContext.currentContextElement().setTextView(ioe.getMessage());
    All i get is an Error 401 which means "Not Authorized". The Portal (where the application is running) and the BW do both support Single Sign On and the BW System is configured in the Portal.
    I think the HTTP Post is to generic. I also think that i need to make a authorization before and post the Kereberos Ticket to the BW before.
    But how can i accomplish that? Is there a SAP HelperClass to configure or establish system connections of SSO enabled systems?
    Or is the approach with the HTTP Post in java wrong, maybe there is an easier way to do transfer a lot of personnel or orgunit numbers to the BW Query?
    Thanks in advance,
    Kai Mattern

    Since you mentioned, I now tried to modify the writeToFile method in a few ways (closing the streams, directly setting them to null...), but the "java.lang.IllegalStateException: Already connected" exception remains there
    Actually I suppose this has no effect on the originally reported cookie problem, because if I just completely remove this logwriting (+ the following URL disconnect-reconnect) from the code, the situation is the very same
    I paste my modified writeToFile method anyway, maybe you can tell what I do wrong here, and I can learn from that
        public void writeToFile ( HttpURLConnection urlConnection, String filename ) {
          try {
            BufferedReader bufferedReader = null;
            InputStreamReader inputStreamReader = null;
            // Prepare a reader to read the response from the URLConnection
            inputStreamReader = new InputStreamReader(urlConnection.getInputStream());
            bufferedReader = new BufferedReader(inputStreamReader);
            String responseLine;
            PrintStream printStream = new PrintStream(new FileOutputStream (filename));
            // Read until there is nothing left in the stream
            while ((responseLine = bufferedReader.readLine()) != null)
                printStream.println(responseLine);
            inputStreamReader.close();
            bufferedReader.close();
            inputStreamReader = null;
            bufferedReader = null;
            printStream.close();
          catch (IOException ioException) { /* Exception handling */ }
        } //writeToFile()

  • Loading applet using http-post

    Hi,
    I am trying to load applet using http-post and I can not figure out how can I get http post form parameters in applet. Can sombody please help me with this?
    thanks
    Kamal

    Hi Arun
    actully i m doing all these stuff .
    but still i m not being able to load .
    do u have any code which can simplify this?
    if u have plz send it at [email protected]
    and also thanx for reply dear .

  • Retrieve data/files fro HTTP POST request in On-Demand process

    Hello,
    I would like to integrate https://github.com/blueimp/jQuery-File-Upload to my APEX 4.2 application inside XE11g. I would like to use this kind of jQuery component, multiple file upload, use Drag & Drop, image resize, size limit, filter extensions etc...
    This jQuery component and also others javascript uploaders sends data files to some defined URL. Developer need to build some servlet, php script or something on server side that will read files from HTTP request and stores it somewhere.
    Do you know how to do it in APEX? How can I read data from HTTP POST request in PL/SQL? Now I can only call my On-Demand application process from javascript, but I am not able to read any data from HTTP POST in it.
    Can I do it in APEX, or using MOD_PLSQL?
    I would like to implement this:
    1) some javascript uploader will call some URL of my application and sends HTTP POST with data files
    2) I will read data files from HTTP POST and store them into database
    3) I will create some HTTP response for javascript uploader
    Thank you for some tips

    I know about that existing plugin " Item Plugin - Multiple File Upload"
    But I doesn't work in IE and has only basic features. Licence for commercial use is also needed. I would like to use some existing jQuery plugin. There are many of these plugins with nice features. And only one problem is that I need to create some server side process/servlet/script.. that can recieve HTTP request, get files from it and stores them into DB.

Maybe you are looking for

  • I am trying to deploy the Creative Cloud

    Hello! Thanks for this video. I found this thread while researching physical CD installs of Adobe CS vs. a Creative Cloud install. I have a work machine where volume licensed CS software was installed. (master collection via CD) I later downloaded th

  • Did I just delete all my photos??

    Before I have a nervous breakdown, I was trying to move a photo to another location and I clicked on something and it asked if I wanted to create a new catalog.  I said yes.  Now none of my photos are appearing in my lightroom.  Please please help me

  • How to download data in excel from web report in sap ?

    how to download data in excel from web report made  in sap abap? through tcode smw0.

  • Need list of delivery notes delited

    Hi, I am new to MM and SD.how to get list of delivery notes created and which one got delited or processed in past with username who deleted and material no qty and Sales Order no. Thanks, Bipin Singh

  • Runexec( ) & Inherited hashCode

    Question: Can Runexec( ) be used to start a .exe. or .bat file from within a Java program? Also, Does the Exception class inherit hashcode from the Throwable class.? May we contact you?: yes