How to Recieve a POSTed data by Servlet

How can I recieve a POSTed data by Sevlet doPost Method?
Raheel

No, I cannot use getParameter because a XML Request is posted to the Servlet and my Servlet has to parse that servlet using DOM.
My code is as follows:
factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
document = builder.parse(new InputSource(requst.getReader())); --- A
I am facing SAXParseException that Content not allowed in Prolog at point A.
Any Help
Thanks
Raheel

Similar Messages

  • How to recieve a POSTed data

    How can I recieve a POSTed data by Sevlet doPost Method?
    Raheel

    No, I cannot use getParameter because a XML Request is posted to the Servlet and my Servlet has to parse that servlet using DOM.
    My code is as follows:
    factory = DocumentBuilderFactory.newInstance();
    builder = factory.newDocumentBuilder();
    document = builder.parse(new InputSource(requst.getReader())); --- A
    I am facing SAXParseException that Content not allowed in Prolog at point A.
    Any Help
    Thanks
    Raheel

  • How to change the posting date at the line item level in a sales order

    how to change the posting date at the line item level in a sales order

    Hi,
    I believe the POSTING DATE will appear on the accounting document
    In the Accounting document, the posting date will be based on the  Billing date.
    Please let me know if you need any more details
    santosh

  • How to show field Posting Date (FB60)

    Hi All...
    I have some problem with my SAP testing,
    when i try to created some testing with AP Invoice transaction FB60 @ SandBox Client 200, i can found field Posting Date.
    but when i try to create testing with FB60 @ SandBox Client 300, i can't found field Posting Date,
    does any body can give me the solution, how to display field Posting Date @ my client 300 ??
    Regards
    Ferry

    Hi,
    There must a screen varient activated for tcode FB60 in yuor 300 clent to suppress the PD field.
    In standard system it will always shown.
    Please check with your ABAPer for the screen varient activated to it or not.
    Thanks,
    Srinu

  • Can't send POST data from servlet

    Hi,
    I have a servlet that receives data via GET method, process the request and then it has to send feedback to an url, but the query string that
    I have to send must be in a POST method.
    I ilustrate this:
    http://host:port/myservlet?param1=value1
    myservlet proccess and then calls
    http://external_url (with param2=value2 via POST)
    I've tried to put an HttpURLConnection
    URL url = new URL("http://localhost:7001/prueba.jsp");
    java.net.HttpURLConnection con= (HttpURLConnection)url.openConnection();
    //POST data
    URL url = new URL("http://localhost:7001/prueba.jsp");
    HttpURLConnection c = (HttpURLConnection)(url.openConnection());
    c.setDoOutput(true);
    PrintWriter out = new PrintWriter(c.getOutputStream());
    out.println("param2=" + URLEncoder.encode("value2"));
    out.close();
    but I get this error.
    lun mar 10 13:53:46 GMT+01:00 2003:<W> <ListenThread> Connection rejected: 'Login timed out after 5000 msec. The socket
    came from [host=127.0.0.1,port=2184,localport=7001] See property weblogic.login.readTimeoutMillis to increase of decreas
    e timeout. See property weblogic.login.logAllReadTimeouts to turn off these log messages.'
    (it's a weblogic 5.1 problem, i've been researching a little bit)
    And I don't want to call a jsp that generates a post form, and then it's auto-submitted with javascript. (this will be the last remedy!!)
    How can i do this?
    All suggestions will be grateful.
    Thanks in advance.
    PD: sorry for my english :)

    I make an URLConnection and I intended to know if the post data was
    sent right. Then, in my machine, under weblogic 5.1, I developed a jsp with this code:
    <%
    URL url = new URL("http://machine2/examples/prueba.jsp");
    HttpURLConnection c = (HttpURLConnection)(url.openConnection());
    c.setDoOutput(true);
    PrintWriter outd = new PrintWriter(c.getOutputStream());
    outd.println("param1=" + URLEncoder.encode("value1"));
    outd.close();
    c.disconnect();
    %>
    and in machine2 (using tomcat 4.1), I simply put a line in prueba.jsp:
    System.out.println(request.getParameter("param1"));
    and I don't get "value1" in the tomcat log as expected (I think).
    I also tried with adding this properties:
    c.setRequestProperty("Content-Length", size...);
    c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    and it didn't work!
    what's wrong?

  • Exchange POST data between servlets?

    Hello all
    First of all, my apologies for my English. This is the first time writing to forum.
    I�m new to java and I need a little help with servlets.
    I have the servlets A, B and C.
    Servlet A just display a page with a form tag witch send the data to Servlet C via POST method. What I want is to intercede the Servlet B between them and check the integrity of those POST data.
    For example: Servlet A send data to Servlet B via POST method, Servlet B check the integrity of those data, and finally Servlet B send those data to Servlet C via POST method.
    For now the only I have done is to send the data to B and transfer the data to C with GET method.
    How can I send data with POST method in a servlet?
    The code so far:
         String urlstr = new String();
         String str1 = request.getParameter("st_name");
    String str2 = request.getParameter("st_birth");
    String str3 = request.getParameter("st_class");
    ��some check ����
         urlstr = "/student/check_st?st_name=" + str1 + "&st_birth=" + str2 + "&st_class=" + str3;
         response.sendRedirect(urlstr);
    Thanks in advanced.
    Ilias

    You should use the RequestDispatcher.forward(request,response) method.
    For example, inside Servlet B do this:
    public void doPost(ServletRequest request, ServletResponse response) {
        ... validate parameters ...
        RequestDispatcher dispatcher = request.getRequestDisplatcher("ServletC");
        dispatcher.forward(request,response);
    }This prevents an extra request-response cycle to the client and between the .forward() and .include() methods of the RequestDispatcher, should be considered the preferred way of server-side redirection unless there is a specific need to go to the client first.
    See the J2EE API:
    http://java.sun.com/javaee/5/docs/api/

  • How can I send post data through nsurlrequest?

    Hi.
    I'm working on an application which needs to make requests to a php gateway. I tried many examples I found on google, but none of them worked for me.
    First I was working with GET, and it worked just fine, but now, as I need to send more complex data, GET isn't a solution anymore. I have three params to send: module which is a string containing a php class name, method: the function in the class, and params for the function which is usually an indexed array.
    The following method makes the request to the server, but for some reason, doesn't send the POST data. If I var_dump($_REQUEST) or var_dump($_POST), it turns out, the array is empty. Can somebody tell me, what am I doing wrong? Is there some kind of a sandbox, which prevents data from being sent to the? I also tried to send some random strings, which aren't json encoded, no luck. The sdk version is 5.1, and I'm using the iPhone simulator from xcode.
    If it is possible I would like to solve this problem without any additional libraries (like asihttp).
    And here is the code:
    +(NSObject *)createRequest:(NSString *)module: (NSString *)method: (NSArray *)params
        NSString *url       = @"http://url/gateway.php";
        NSData *requestData = nil;
        NSDictionary *data  = [NSDictionary dictionaryWithObjectsAndKeys:
                module, @"module",
                method, @"method",
                params, @"params",
                nil];
        NSString *jsonMessage = [data JSONRepresentation];
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
        NSString *msgLength = [NSString stringWithFormat:@"%d", [jsonMessage length]];
        [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
        [request addValue: msgLength forHTTPHeaderField:@"Content-Length"];
        [request setHTTPMethod:@"POST"];
        [request setHTTPBody: [jsonMessage dataUsingEncoding:NSUTF8StringEncoding]];
        requestData     = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
        NSString *get   = [[NSString alloc] initWithData:requestData encoding:NSUTF8StringEncoding];
        NSLog(@">>>>>>%@<<<<<<",get);
    Thank you.

    raczzoli wrote:
    I'm working on an application which needs to make requests to a php gateway. I tried many examples I found on google, but none of them worked for me.
    Why not?
    Unfortunately, you are dealing with a number of different technologies that have been cobbled together over the years. You could write a PHP server that would respond correctly to this request, but not using basic methods like the $_POST variable. PHP was designed for HTML and true forms. What you are trying to do is make it work as a general purpose web service over the HTTP protocol. You can do that, but not with the form-centric convenience variables.
    The following is a basic program that will populate the $_POST variable.
    #import <Foundation/Foundation.h>
    int main(int argc, const char * argv[])
      @autoreleasepool
        // insert code here...
        NSLog(@"Hello, World!");
        NSString  * module = @"coolmodule";
        NSString * method = @"slickmethod";
        //NSArray * params = @[@"The", @"Quick", @"Brown", @"Fox"];
        NSString * params = @"TheQuickBrownFox";
        NSString * url = @"http://localhost/~jdaniel/test.php";
        NSDictionary * data  =
          [NSDictionary
            dictionaryWithObjectsAndKeys:
              module, @"module",
              method, @"method",
              params, @"params",
              nil];
        //NSString *jsonMessage = [data JSONRepresentation];
        //NSData * jsonMessage =
        //  [NSJSONSerialization
        //    dataWithJSONObject: data options: 0 error: nil];
        NSMutableArray * content = [NSMutableArray array];
        for(NSString * key in data)
          [content
            addObject: [NSString stringWithFormat: @"%@=%@", key, data[key]]];
        NSString * body = [content componentsJoinedByString: @"&"];
        NSData * bodyData = [body dataUsingEncoding: NSUTF8StringEncoding];
        NSMutableURLRequest * request =
          [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString:url]];
        //NSString * msgLength =
        //  [NSString stringWithFormat: @"%ld", [jsonMessage length]];
        NSString * msgLength =
          [NSString stringWithFormat: @"%ld", [bodyData length]];
        [request
          addValue: @"application/x-www-form-urlencoded; charset=utf-8"
          forHTTPHeaderField: @"Content-Type"];
        [request addValue: msgLength forHTTPHeaderField: @"Content-Length"];
        [request setHTTPMethod: @"POST"];
        //[request setHTTPBody: jsonMessage];
        [request setHTTPBody: bodyData];
        NSData * requestData =
          [NSURLConnection
            sendSynchronousRequest: request returningResponse: nil error: nil];
        NSString * get =
          [[NSString alloc]
            initWithData: requestData encoding: NSUTF8StringEncoding];
        NSLog(@">%@<",get);
      return 0;
    I have written this type of low-level server in PHP using the Zend framework. I don't know how to do it in basic PHP and wouldn't bother to learn.
    Also, you should review how you are sending data. I changed your example to send the appropriate data and content-type for the $_POST variable. If you had a server that could support something else, you could use either JSON or XML, but your data and content-type would have to match.

  • How to change the posting date in UD stock posting for a HU managed item?

    Hi,
    We are using Handling Unit managed items with QM activation. For a specific HU managed material, we wanted to post the stock on a previous date. We have created PO on a back date and made GR also on a back date. Now the problem is, the system has generated an inspection lot. Now while trying to do UD and stock posting, I do not see the "Doc" tab which we normally see in UD stock posting for normal inspection lots (non-HU managed items) for changing the date.
    I don't see any other way to change the posting date for the HU managed item in UD stock posting. Anyone can help please?
    Thanks & Regards,
    Madhavan Krishnamoorthy.

    I don't think you can.
    Craig

  • How to change the posting date of confirmations?

    Hi,
    In my company CATA is scheduled as a background job and uses some ABAP logic to set the correct posting date for the confirmations that are transferred to the PS module. As a result of a wrong date entry in the table which is used in the ABAP logic, all the confirmations (8572) that should have had posting date in February got posting dates in March.
    As far as I can see some of the options are:
    - Use CN48N and cancel one and one confirmation
    - Manually add 8572 confirmations with the correct amount of time, employee number, periode, posting date etc.
    Due to the amount of confirmations this procedure will be very time consuming.
    My questions is what is the best procedure to correct the posting date for 8572 confirmations with wrong posting date?
    Regards,
    Petter Kvalvik

    hi
    write a LSMW or BDC to cancel the confirmation and correct it by another LSMW or BDC program for correct date.

  • How to mass change posting date of parked logistics invoice verifications

    I was wondering if someone can help...
    We are looking if there is a standard SAP program available to mass change the posting date (to a new date in a new period) for a number of parked logistics invoice verification documents.
    Example: Invoices are parked in e.g. April 2010; relevant information is not available before month end; so invoices will probably be posted somewhere in May or June or ...; users now have to individually change the posting date on each parked invoice to the new open month.
    Is there any proces/program that could automate this task.
    Thanks in advance for all your advice, feedback and comments.
    Best Regards,
       Luc Vernieuwe.

    Hi,
    There is no standard tcode , i used Tx Shuttle tool to do this in past for one of my client. ( excel based sap transaction tool)
    Thanks,
    sudhakar

  • How can I change Posting Date on Sales Invoice form in UI?

    Hello,
    I cannot change the Posting Date on the Sales Invoice form in UI.
    The new date is earlier than the system date, but when I type it on the field on the form, it's not problem!
    I've tried to use the following code in vb.NET:
    SBO_Application.Forms.Item(pVal.FormUID).Items.Item("10").Specific.value = DocDueDate.ToString("yyyyMMdd")
    But I've got an exception: <i>Form - Bad value</i>
    Next step I tried this, but I've got a same message:
    SBO_Application.Forms.Item(pVal.FormUID).Items.Item("10").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
    SBO_Application.SendKeys(DocDueDate.ToString("yyyy.MM.dd"))
    Any idea?
    THX,
    Csaba

    Hi Csaba!
    please, make sure that you've handled Sales Invoice form - just show the message:
    MessageBox.Show(pVal.FormUID)
    edDate = SBO_Application.Forms.Item(pVal.FormUID).Items.Item("10").Specific
    edDate.value = DocDueDate.ToString("yyyyMMdd")
    This has to show you 133. If not then put the IF-statement to check what form you are handling before you try to get the item's handler

  • How to make a POST from a servlet?

    Hi,
    I'd like to simulate sending a form with method="POST" from inside a servlet.
    So far, I know that I can simulate a GET using response.sendRedirect(), but unfortunatelly, this is not what I want.
    Does anyone knows how to do it?
    Thanks in advance,
    Gabriel

    Try the RequestDispatcher.forward()... this passes on the same request object from the callling servlet to the called servlet. It would be the equivalent of having done a post(you dont loose the form values)

  • How shall i send user data to servlet by an Applet in way Form does

    it is clear that URL class provides way to connect to remote web resource. and furthermore i am trying to make an applet perform like a Form in html to send user data to a servlet. i may adhere a long name-value string to url sent by applet but this is not a good way to hide information like hidden variables. Is there any class in J2SE package that i can wrap those Form data and send them in the way Form does...?
    cheers!

    It's not a matter of form vs. not-form, it's a matter of HTTP types.
    Basically HTTP allows a connection to be of various types: GET, POST, HEAD, and some lesser used ones like DELETE which many servers won't support anyway. GET is usually used for link clicks, and puts its arguments as name/value pairs as part of the resource name. POST sends it as body data, also as name/value pairs.
    In Java, the way you do this is, starting with your URL object, get an HttpURLConnection object. Then call setRequestMethod on that HttpURLConnection object. If I recall correctly the rest is basically the same.
    Check the docs for details and stuff I may have forgotten or got wrong. Also check RFC 2616, which is the HTTP specification.

  • How to change a posting date of an invoice in background

    Hello,
    I want to change the posting and invoice dates ( to correct many invoices,)
    I use the MIR4 transaction, the batchinput works fine in foreground,
    but in background I have the error
    Control framework : erreur fatale, destination SAPGUI
    due to enjoy transaction.
    No OSS notes or BAPI's to solve it.
    I am on ECC5 (MySap ERP2004)
    any idea ?
    Best regards
    RF

    New transactions based on control framework are not suitable for batch input. Try to find a BAPI or function module to do the same.

  • How to get GR posting date for schedule line of scheduling agreement?

    I had hard time to tie the GR date to schedule lines. I need this information to generate vendor performance report. However, the GR date is tied to scheduling agreement item level only. One item line can have multiple schedule lines. Is there a way to link the GR date to actual schedule line? Thanks in advance!

    Hi,
    There will be icon called PO history in the over view screen of SA.Select the item and press it.May be this will be some what useful to you.
    Regards,

Maybe you are looking for

  • Multiple ipods, one computer with multiple user accounts - Vista

    My daughter just got a new ipod for Christmas, and she has her own login on our family computer using Vista. So she has her own folders for documents, pictures, etc. I installed iTunes under her login thinking that it would pull songs from her the fo

  • Downloading iTunes 10.4

    When I try to load itunes 10.4, it says it will take 24 hours - am I missing something?  I have checked all my pop ups etc?

  • Two ALV's in single report without Using Containers

    Hi All, I have a requirement to show two ALV reports in a single report and the thing is I am not supposed to use Containers(Screen Painter). and OOPS concepts. Is there a way we can achieve this? Any valuable suggestion is highly appreciated. Thanks

  • Warping skewed type on a path

    Hi, As you'll see in the attached screenshot, I wanted to type along a path that mimmicks the marquee in the photo that is in the background. I was able to get it to do that pretty easily by just drawing the path, type on a path and then type on a pa

  • Adobe blocked by security settings

    how can I unblock the application. What security settings are you talking about