Http POST/GET Method + QueryStrings

Hi,
I am facing the following problem:
I need to create an URL with a QueryString something like:
http:///index.asp?var1=a&var2=b
and then this needs to be sent via
POSTmethod to the webserver! I wonder if this is possible at all, as a querystring is naturally a GET... 
Otherwise when using GET, I get redirected to a login-page. I checked this with an html-page, which carries a corresponding form - this works with POST Method. I need to get the url or the source of the response page in webdynpro!
is there a way to simulate the html-form?
I think there are jars available, which can sent files to an url - I thought about sending an html-header, as the form-POSTMethod puts the form variables in the html-Header, when sending. Is this possible?
Right now I am using the following classes:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.*;
I am sending the URL via this:
     PostMethod post = new PostMethod(url.toExternalForm());
          post.setRequestHeader("Content-type", "text/html; charset=ISO-8859–1");
          HttpClient httpclient = new HttpClient();
          int iResultCode = httpclient.executeMethod(post);
          msgMgr.reportSuccess("iResultCode = " + iResultCode);
          byte[] yaResponse = post.getResponseBody();
          msgMgr.reportSuccess("Server response:"+new String(yaResponse));
          post.releaseConnection();
does somebody know, if "url.toExternalForm()" creates something like a form, which then again can be sent via POST? right now i get redirected to a login-page. So it seems my postMethod is infact a GET...
any ideas welcome,
thanx matthias

check same issue in java forum and this link:
http://jakarta.apache.org/commons/httpclient/methods/post.html

Similar Messages

  • HTTP-Post/Get method of calling the query service allows us to build URL

    Hi,
    I am new to webservices.i have requirement that, using a HTTP-Post/Get method of calling the query service that allows us to build an URL and if we call that url it wil populate XML object.i need query LDAP server for getting users manager details ,in request query we wil pass user details.thanks in advance..

    check same issue in java forum and this link:
    http://jakarta.apache.org/commons/httpclient/methods/post.html

  • View HTTP POST/GET request in CSS

    Hi Guys,
    i am facing an issue where my Appls is receiving more post request then what
    had been sent by the client.
    It was reported that Appls log 3 http post but client only submitted one request.
    To troubleshoot, does the CSS has the ablility to view HTTP POST/GET traces? Is there a history
    for such traces logged?
    Thanks

    You'll need a sniffer trace. Frontend and backend.
    The CSS does not have log for this info or ways to show you the HTTP requests.
    G.

  • HTTP Post/get traffic interception

    Hi
    I am developing a security software which needs to block emails with sensitive body & attachments  (CCN ,SSN.. etc) in Safari.
    I've been successfull in loading my Bundle into Safari Process & am trying to override NSURLConnection & other CFNetwork API which are used for HTTP GET/POST requests.
    I am able to capture all the GET requests , but no luck with HTTP Post requests.
    I've also tried writing a NPAPI plugin without any suceess.
    Any pointers towards intercepting HTTP POST requets for Safari on MAC OS would be deeply appreciated.
    Thanks for the help.

    check same issue in java forum and this link:
    http://jakarta.apache.org/commons/httpclient/methods/post.html

  • Http conditional get method

    When I use java.net.HttpURLConncetion to do conditional GET,
    that is, I did connection.setIfModifiedSince(current_time),
    but the response codes are always 200, instead of 304.
    What shall I do to make such conditional http request work in
    Java? Please help! Thanks a lot!!

    This sample code works just fine:
    import java.net.*;
    public class test3 {
      static String testUrl = "http://us.i1.yimg.com/us.yimg.com/i/ww/m6v3.gif";
      public static void main(String[] argv) {
        HttpURLConnection h = null;
        try {
          URL u = new URL(testUrl);
          h = (HttpURLConnection) u.openConnection();
          h.setIfModifiedSince(System.currentTimeMillis());
          h.connect();
          String r = null;
          int i = 0;
          do {
            r = h.getHeaderField(i);
            System.out.println(h.getHeaderFieldKey(i) + " = " + r);
            i++;
          } while (r != null);
        } catch (Exception e) {
          e.printStackTrace();
        } finally {
          if (h != null)
            h.disconnect();
    }It outputs this:
    null = HTTP/1.0 304 Not Modified
    Content-Type = image/gif
    Last-Modified = Fri, 15 Apr 1994 00:00:00 GMT
    Date = Wed, 27 Nov 2002 11:27:35 GMT
    Connection = keep-alive
    Expires = Thu, 15 Apr 2010 20:00:00 GMTHowever, you may want to consider this quote from the HTTP 1.1 spec:
    Note: When handling an If-Modified-Since header field, some servers will use an exact date comparison function, rather than a less-than function, for deciding whether to send a 304 (Not Modified) response. To get best results when sending an If-Modified-Since header field for cache validation, clients are advised to use the exact date string received in a previous Last-Modified header field whenever possible.
    Note: If a client uses an arbitrary date in the If-Modified-Since header instead of a date taken from the Last-Modified header for the same request, the client should be aware of the fact that this date is interpreted in the server�s understanding of time. The client should consider unsynchronized clocks and rounding problems due to the different encodings of time between the client and server. This includes the possibility of race conditions if the document has changed between the time it was first requested and the If-Modified-Since date of a subsequent request, and the possibility of clock-skew-related problems if the If-Modified-Since date is derived from the client�s clock without correction to the server�s clock. Corrections for different time bases between client and server are at best approximate due to network
    latency.
    So given that my test works fine, I'd argue the problem is not with java, rather it's with your code or the server you're connecting to.
    Maybe the server expects the date to be exactly the last modified time of the resource you're accessing, as described in the above note. (Which implies that the current time simply won't trigger 304 status for some servers.) Or maybe the server doesn't believe that the resource is immuatable over some periods of time. (I believe that servers can be configured, for example, always to invoke CGI scripts (and send them with a 200 status, assuming nothing has gone wrong), basically ignoring the If-Modified-Since header.) Note that I was explicitly asking for a GIF in the test code. In my experience with web servers logs, you only see 304's for resources like that.

  • HTTPS POST

    I'm trying to do a HTTP POST; however, the communication is HTTPS. I know that labview TCP doesn't support  HTTPS. But is there was way around this? Thank you!
    -Than

    Hi rolfk,
    I want to further explain. I implemented the HTTP GET & POST utilizing this example: Example HTTP POST & GET
    I had to modifiy the TCP Open VI though. Instead of opening a connection to the website I open a connection to our proxy server (it has a url). That made it all work since the proxy server looks at the GET & POST header for the information when using teh TCP write VI to write the entire unmodified post message.
    But, I want to do HTTPS POST. I can't get into the VI's block diagrahm so I don't know what is going on in there and I can't force it to open a connection to the proxy server to send the POST message.
    From my understanding of how the VI works the POST VI has a url input. This url input takes in both the URL & URI required for POST method. The data input is the body of the POST message. Am I correct in this understanding? If so, then there is no way to modify this to open a connection to the proxy server. Any possible solutions?
    I have a certificate file for authentication. I assumed it was a CA certificate but if I need it for me (the client) to authenticate then it is a client certificate file, correct? If the latter is true then I have to go back and ask for the private key file to work with the SSL VI, correct?
    Unless I can do SSL with the original Example using only the TCP VIs or possible how can I do a combination of the HTTP Client VIs and open a connection to the proxy server using the TCP Open VI's.
    Please help with this. Thank you.

  • How to call HTTP Post Method URL in SOA 10g

    Hi,
    I have a requirement where i need to call a HTTP Post Method, I have a URL, if i hit it in the browser, i am getting the response details. I know there is a HTTP Binding Adapter in 11g, but we are on 10g. Can anyone please let me know whether we can do it in 10g and how ?
    Thanks Always
    N

    You will need to write the WSDL by yourself. Just make sure you have the end point detail, operation name(if required) and the schema available to write the WSDL.

  • How to call HTTP POST method in SOA 10g

    Hi,
    I have a requirement where i need to call a HTTP Post Method, I have a URL, if i hit it in the browser, i am getting the response details. I know there is a HTTP Binding Adapter in 11g, but we are on 10g. Can anyone please let me know whether we can do it in 10g and how. ?
    Thanks Always
    N

    Look at 10g samples under tutorials/702.bindings.

  • Authentication syntax for HTTP GET method using TCP functions in Labview on linux

    Hi,
    Currently, I am trying to communicate to web server. I have Labview installed on a Linux machine. The HTTP function blocks and other labview functions do not work. Hence, I am building a HTTP code string using TCP functions (port 80) to talk to the web server. I am successfully able to fetch a response from web sites (example www.ni.com) from my vi. However, when I try to communicate to my web server, it does not work. It requires an authentication. I am able to open http://ipaddress in my browser from my machine using username and password. Can someone help with Authentication string requirement for GET method?
    so far the string is:
    GET /index/ HTTP/1.1
    Host: http://xx.xx.xx.xx

    An easy option would be to try http://userassword@server syntax for the URL.
    Else I posted a Twitter fetcher once (won't work anymore since Twitter moved to Oauth authentication) at LAVA. Based on code from @cloew.
    The code is part of this LLB.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • HTTP GET method error

    I've created a simple web page that contains a text box in which the user enters an URL. And also have a servlet to take this address and do something "useful" with it. The Servlet has a doPost method to get this address, and the web page also has the corresponding method
    (<FORM method="POST" ACTION="../fyp/AddressServlet" >).
    I'm using a j2ee server, which runs fine, as does the deploytool.
    However, when I attempt to open the web page in my browser, I get the following error,
    "HTTP Status 405-HTTP method GET is not supported by this URL"
    I don't know why I'm getting a GET method error, when it's a POST method I'm using.
    Any help would be appreciated,
    thanks,
    ahhfor

    Hi !
    You're using the POST method to call the servlet when you submit the HTML page. However, when you try to load your HTML page into the browser, this is done with GET !
    Check your server.xml file in the /conf directory and see if your application context is correctly defined. And then check the web.xml file in your application's WEB-INF directory. Finally, check your path to the servlet in your HTML file.

  • JAX-WS -- Force a wsimport generated ws client to use http POST method

    I've used wsimport to generate a JAX-WS client for a wsdl and xsd bindings that were provided to me.
    The basic implementation goes something like this.
    URL serviceUrl = ...url to the live web service's wsdl (this will change often and needs to be data driven)
    QName qname = new QName("thenamespace", "MyService")
    MyService myService = new MyService(serviceUrl, qname);
    At this point a http GET request is sent to the server which promptly spits back a "405: method not allowed" because it is only configured to accept the http POST method.
    Unfortunately i cannot change this behavior and need a way to get the web service client to generate http POST requests.
    Setting the following seemed to have no effect.
    System.setProperty("javax.xml.ws.http.request.method", "POST");
    Thanks!

    so, keep the wsdl as a local resource and use a url for the local resource. then the service will not request the remote wsdl.

  • Applicatio​n using Http Post... getting error response

    Im from Ecuador, and me and other 4 people from the same country are getting this error response when a native java application is trying to make a http post to mydomain.com
    The requested URL could not be retrieved:
    While trying to process the request:
    POST /somedir/more?var1=abc&var2=xyz& HTTP/1.1
    Expect: 100-continue
    Host: mydomain.com
    Content-Length: 40
    Content-Type: text/plain; charset=utf-8
    Accept: */*
    Connection: close
    Invalid request. Some aspect of the HTTP Request is nivalid. Possible problems:
    Missing or unknwon request method
    Missing URL
    Missing HTTP Identifier (HTTP/1.0)
    Request is too large
    Content-Length missing for POST or PUT request
    Generated by Blackberry.Internet.Browsing.Service (squd/2.7.STABLE6)
    This issue is only happening in my country (Ecuador). I have some friends in Argentina and they have no problems at all. What are the posible causes for this problem?
    Message Edited by andufo on 07-09-2009 08:43 PM

    Hi again,
    im attaching all the info you request:
    What does the program actually do?
    Social network (because of the TOS of this forum im not allowed to post project names or urls)
    What is it trying to send when you submit a request?
    What url is it posting the information to? 
    Im attaching all this at the end of the post.
    Is it the 'exact' same application that works in other countries?
    Yeap, the exact same one...
    Is it supposed to be useing the Internet Browser?
    No, it is a native app. The Browser is not used at all.
    Are you on a BlackBerry Enterprise Server? 
    Im on BIS, all the users use BIS.
    Technical details:
    1) The app makes an Http Connection (POST) to:
    http://mydomain.com/api/call?param1=abc&param2=xyz
    2) This is the Http connection configuration:
    httpConnection = (HttpConnection) Connector.open(url);
    HttpConnection.POST;
    ("Content-Type", "text/plain; charset=utf-8");
    ("Host", 'mydomain.com');
    ("Content-Length", 100); //depends on sent data
    ("User-Agent", 'BlackBerry8300... etc');
    ("Expect", "100-continue");
    3) On every country it works fine... on my country i get this error:
    The requested URL could not be retrieved while trying to process the request:
    POST /app/llamada?param1=abc&param2=xyz& HTTP/1.1
    - Expect: 100-continue
    - Host: mydomain.com
    - Content-Length: 100
    - Content-Type: text/plain; charset=utf-8
    - Accept: */*
    - Connection: close
    Invalid request. Some aspect of the HTTP Request is invalid. Possible problems:
    - Missing or unknwon request method
    - Missing URL
    - Missing HTTP Identifier (HTTP/1.0)
    - Request is too large
    - Content-Length missing for POST or PUT request
    Generated by Blackberry.Internet.Browsing.Service (squid/2.7.STABLE6)

  • Need JDeveloper Web Service with HTTP POST method

    Hello all,
    I am creating a Web Service from a java class using JDeveloper. The wsdl created uses a SOAP binding. When I test the web service, either through JDeveloper or by deploying to OAS, the HTTP request created uses the HTTP GET protocol. I am assuming that this would be the same for anybody doing this.
    I need to know how to change it to be an HTTP POST protocol instead.
    The reason that I need to try and use the POST method is that the xml needed by the service holds a lot of data and the http server is giving me a "URI too long" error. I have read and been told that using POST instead of GET would help this, but I can't figure out what to change to make this happen. I am not sure if I have to make a change in the generated wsdl or somewhere else. Or if it just won't work that way.
    Any help you can provide would be appreciated.
    Thanks,
    rob

    Hi Ayush,
    Please refer -
    http://biemond.blogspot.com/2010/08/http-basic-authentication-with-soa.html
    Regards,
    Anuj

  • Double requests (Post & Get) received when submitting a Post method

    Recently in our Web Access log, we found that some misbehavior request pattern on some user. When a single post request would result in TWO requests at the same time to our Apache web server, one is the original POST method and an additional GET method.
    Below is the access log (the .do & url are masked to anonymous, e.g. example.com)
    [07/Jul/2008:17:12:15 +0800] "POST /example1.do HTTP/1.1" 200 11784 "https://example.com/example1.do" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 2.0.50727)"
    [07/Jul/2008:17:12:15 +0800] "GET /example1.do HTTP/1.1" 200 9171 "-" "Internet Explorer"
    [07/Jul/2008:17:12:21 +0800] "POST /example2.do HTTP/1.1" 200 9171 "https://example.com/example2.do" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 2.0.50727)"
    [07/Jul/2008:17:12:21 +0800] "GET /example2.do HTTP/1.1" 200 9211 "-" "Internet Explorer"
    We checked the log and found that for the additional GET method, the user agent is different from the POST one. Do you encounter such "double request" case?
    Furthermore Is there any reasons, in the aspect of system configuration such as apache setting, or in user's browser perspective such as additional plug-in installed in Firefox, could resulted in double request to the web server? Do you have any work around to eliminate the second GET request?
    It would be great to receive your comment. Thanks in advance.

    I dont know the answer. However, I would check out the JSP or HTML page and see everywhere it submits back to the server. One spot is in the <form> tag. It should have something like action="POST". Also, check the javascript to see if it has a .submit call. It could be a click on the update button calls two java functions that each submit, or perhaps there is an on-load function call in the <form> tag that calls a submit. Another possibility is the user navigates back to the JSP page that auto submits when its refreshed.
    Possibly caused by a user double clicking the update button rather than single click. In the last case, have the button call a javascript function rather than let the button submit directly to the server. In the javascript function, set a static boolean variable and submit (document.myForm.submit). A second submit to the function will be blocked by that static variable being set because you check to see if its true before you submit and if so, dont submit. Print the timestamp to the log file from both post and get functions to see if both requests come in within a fraction of a second. If so, it may be the issue I just described.

  • Get file from HTTP POST (upload image)

    Hello,
    I would like to integrate http://www.plupload.com flash component to my APEX 4.1 website. I need it because I want to resize image and transform image before upload on client side, upload multiple files etc..
    But I don't know how to read image binary data from POST method.
    When I hit "Start upload" button on plupload component it makes some transformations and creates POST method like this:
    ------pluploadboundary1334433145869
    Content-Disposition: form-data; name="name"
    p16qp6jm3nhan1ca46me1ocr3tu1.jpg
    ------pluploadboundary1334433145869
    Content-Disposition: form-data; name="chunks"
    1
    ------pluploadboundary1334433145869
    Content-Disposition: form-data; name="chunk" 0
    ------pluploadboundary1334433145869
    Content-Disposition: form-data; name="file"; filename="centerd.jpg"
    Content-Type: image/jpeg
    ÿØÿà�JFIF������ÿÛ�„�
    image content
       now I would like to read content of this HTTP POST and read sended image and store it to DB.
    Question is... how can I read file sended with HTTP POST in APEX pl/sql process or pl/sql procedure?
    Thank you...
    Edited by: cardel on Apr 14, 2012 11:17 PM

    Hi,
    here are my two cents ...
    this will be a bit difficult. When you use the standard APEX File upload it is not PL/SQL handling the POST request. The request is handled by the webserver - depending on the variant you are using it is either mod_plsql, the C code of the Embedded Gateway or the APEX Listener. The webserver is also doint the insert into APEX' file repository. So I see two options:
    It might be possible to configure your plugin (don't know about it) the behave the same as a standard browser upload. Then for APEX there would be no difference - mod_plsql should handle the files accordingly.
    If you want to handle the POST request yourself, as said, you can't do this in PL/SQL. It would be possible to write a Java servlet doing this and deploy that servlet on the same container as the APEX Listener (when using Apache with mod_plsql you would need an additional Java server for that) ....
    Hope this helps ...
    Best regards
    -Carsten

Maybe you are looking for