Receive HTTP POST XML file

Hi all,
I am working with Flex where a HTTP POST request with XML is sent from the client to the server (Java server, I am running JBoss) expecting a reply. Can someone point to example code of Java on the server side receiving POST request, and if possible acts on the XML data and returns similar XML to the client? I need to use HTTPService; AMF/BlazeDS is not an option. Unfortunately most examples online of Flex/Java apps are using the latter.
I would much prefer not to have to deal wilth EJBs and JSPs unless those are the only solutions available. Hopefully some plain old server side Java will suffice!
Thank you for all your help in advance.

Try reading: https://metro.dev.java.net/discover/

Similar Messages

  • Http-post XML file to Localhost:1301 - No XI available

    Hi guys,
    I hava a problem finding a preferrably easy answer to a task: send a XML-file via http-post to localhost:13001. I am using the iXML library to create the XML (as it contains some stuff not available in the crm) and thats about it. The system will not have an XI available, but the application listening on 13001 will be expecting data, whenever it ist sent. As far as I know, the file should be sent everytime a user presses a certain button.
    Never done this before, so even basics are fine.
    Any help appreciated!!
    Thanks
    Claudia

    Try reading: https://metro.dev.java.net/discover/

  • Error while posting xml file to URL using URLConnection

    Hello everyone,
    I am facing an issue from long time related to URLConnection. If this would be resolved by your help then I would be very grateful to you.
    One application which posts xml file to URL hangs and after waiting for 5 mins it throws 504 error:
    java.io.IOException: Server returned HTTP response code: 504 for URL: http:hostname.
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:715)
    Same application is running fine without error on another environment from last 5 years. But on another env it is erroring out from the day 1.
    We have many workarounds in place none worked.
    I tried to use HttpClient from apache but that too hanged at URLConnection.getInputStream() method call.
    App is running on iPlanet web server 6.1 using JDK 1.4.0_03
    We still dont know why this program hangs at that particular line in only one env but many times it runs fine. That means 30% of the times it posts xml file without error but 70% times it errors out. So our program logic is to retry until post is successful.
    Once this issue is resolved we will remove the logic of trying again and agian.
    Please provide inputs.
    Thanks,
    Nitin

    The HTTP response 504 means that the server, acting as a gateway, has not received a response from an upstream server in the time it expected.
    I think this is problem is due to the remote server that receives the XML and takes too long to return a response to the local application that posted the XML.
    Try HttpClient and set the timeout variable of the HttpClient instance used.
    Here http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/PostXML.java?revision=480424&view=markup
    a Post XML sample.
    NB: HttpClient > setTimeout method is deprecated. See : http://jakarta.apache.org/commons/httpclient/apidocs/index.html for an alternative
    Hope That Helps

  • Receiving a inbound xml file in Business Connector

    Hi All,
    The requirement is we are receiving an inbound xml file at the BC end from a third party application.
    We have configured the url in the third party end as follows -
    http://ip address of BC:port address/invoke/Folder/Service
    When the file is posted, the xml file is normally routed to the service in the developer.
    In the developer we are using the service load document to load the file from the url location.
    But at present when a xml file is triggered from the third party application it is routed to the service, and on checking the url location http://ip address of BC:port address/invoke/Folder/Service the server slows down slowly and we are not able to access both the developer and administrator after this.
    Are we following the correct steps, or else is there anyother way of receiving the inbound file in BC.
    Any suggestions on this would be of great help.
    Please let me know if we are going wrong anywhere.
    Regards,
    Priya

    Hi priye,
    I am agreed with you approach, and this is what everyone do. :). So that is not a problem. May be something else will be the cause.
    >>>>In the developer we are using the service load document to load the file from the url location
    For load document, i don't think its necessary because using the URL post, you are submitting data directly to the Flow Service. So no need to do document load or anything. Also i am against to use the Save data in pipeline (savePipeline) service because when you transport this  in production you need to comment this step otherwise it will give other problems when this will run.
    if this approach is giving you performance problem, then try putting your xml file in you package directory and the write a file pooler and then parse this xml for ur use. this is one of the simple solutions.
    hope this will help you.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • Receive http post, modify and resend

    Hi
    I have problem with servlet.
    My servlet must:
    1) receive http post data
    2) modify one value of parameter
    3) and resend http post to other URL (servlet).
    How can I do this?
    Thanks :)

    There's no possibility to modify the value a request's parameter but You can follow the advice that is accessible here. Hope this helps.

  • Receive and Send XML files

    I have a requirement, to receive XML files from a Vendor, process them and send them back an XML file.
    What are the different way I can receive the files from the Vendor ?
    They do not support File Transfer Protocol and They do not want to access any web-service that we create for them to post the XML's ?
    What technology do I use to get the files, I was told we can use HTTP.
    Please let me know
    Thanks

    Timo,
    Thanks for your reply, the technology stack we are using is Oracle Middleware,
    The process of uploading the documents should be automatic , so I need to give the Vendor an URL, where they can post the XML documents.
    If I use a web-service, will that be having any URL for the vendor to post ? and I suppose I have to make that web-service open in the internet. ?

  • ABAP Proxy viewing of historical web service posts - XML files

    Hi there
    I have developed a web service that posts via an ABAP proxy.  The webservice posts successfully.  Where do I see the historical XML files of the posts of my executed webservices?
    Kind Regards
    Gustav Coleske

    Hello Torsten,
    It seems that the Web Service You are going to consume is a SOAP 1.2 one.
    It is apparently making use of the so-called "SOAP Web Method Feature" which is part of the SOAP 1.2 specification (see [Web Method Feature (W3C)|http://www.w3.org/TR/soap12-part2/#WebMethodFeature]).
    Unfortunately, SOAP 1.2 is, to the best of my knowledge, not supported as yet by the SOAP Adapter in SAP NW 7.0 / 7.1. That leaves You, in theory, with one of the following options:
    - It might be possible to consume that service with the help of Axis framework (see [Using the Axis Framework in the SOAP Adapter|http://help.sap.com/saphelp_nw04/helpdata/en/45/a4f8bbdfdc0d36e10000000a114a6b/frameset.htm]). SAP Help states that with the help of the Axis framework SOAP 1.2 can be used. However, there are no further details on that subject, especially whether Web Method feature can be utilised (btw - has anyone tried this?).
    - Ask service provider for a SOAP 1.1-compatible WSDL.
    - Attempt to reverse engineer the SAP SOAP proxy so that it is capable of consuming a SOAP 1.2 Web Method-based web service (has anyone done this before?).
    Would You be so kind to post whether, and how, You were able to consume this web service?
    Kind regards
    Wiktor Nyckowski

  • Read Time out error while posting XML file

    Hi
    While posting the XML file from .NET application to XI I am getting following error :
    com.sap.engine.services.httpserver.exceptions.HttpIOException: Read timeout. The client has disconnected or a synchronization error has occurred. Read 62127 bytes. Expected 75283.
                at com.sap.engine.services.httpserver.server.io.HttpInputStream.read(HttpInputStream.java:186)
                at java.io.FilterInputStream.read(FilterInputStream.java:111)
                at java.io.PushbackInputStream.read(PushbackInputStream.java:161)
                at java.io.FilterInputStream.read(FilterInputStream.java:90)
                at com.sap.aii.messaging.net.MIMEInputSource$MIMEReader.readContent(MIMEInputSource.java:683)
                at com.sap.aii.messaging.net.MIMEInputSource.readBody(MIMEInputSource.java:342)
                at com.sap.aii.messaging.net.MIMEServletInputSource.parse(MIMEServletInputSource.java:58)
                at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:358)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
                at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
                at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
                at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
                at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
                at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
                at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                at java.security.AccessController.doPrivileged(Native Method)
                at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
                at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    Earlier I incresed the PROCTIME as 600 secs ( OSS Note 824554 ) -->
    icm/server_port_0 = PROT=HTTP,PORT=1080,TIMEOUT=600,PROCTIMEOUT=600
    In this case do I need to increase this parameter value again & what should be the optimal value which will not effect the performance of the system too.
    Best Regards
    Lalit Chaudhary

    hi Lalit,
      Check the OSS note(807000) and see if it helps you....
    Re: Calls to Webservice published by XI getting lost
    hope it helps,
    regards,
    Anu

  • Not receiving the output xml file from BPM

    Hello
    I am doing a scenario where I'd be sending two files in text format to the BPM workflow which would be using Fork and Correlation to merge these two files into one file and send the output xml file as receiver. Problem is that the two files are successfully converted into the xml messages and are displayed in SXMB_MONI but the output file which would be received from BPM engine as receiver is not being generated and displayed in SXMB_MONI as well as RWB. Please suggest any probable solution.
    Thanks.

    I don't think you can manipulate .ai files in Flex /
    AIR.

  • HTTPS Receiver Adapter POST with FILE TYPE parameter

    Hello,
    I need to do a POST to a URL service that validates content of a file. It receives user and password as string parameters and a FILE as a mime type parameter.
    I'll appreciate any help.
    Regards,
    Diego.

    Hi.
    Using Http Receiver Adapter , you can try out this.
    This blog may give some idea-
    /people/amol.joshi2/blog/2006/06/28/must-fire-a-http-get-from-xi---try-this
    Otherwise, try out with callinng this service via SOAP Adapter i.e webservice.
    Rgds,
    moorthy

  • Emulating HTTP POST for file upload with J2ME

    I have search through a lot of site and couldn't find the actual code. I try to emulate below html with J2ME.
    <form method="POST" enctype="multipart/form-data" action="Insert.asp">
    <td>File :</td><td>
    <input type="file" name="file" size="40"></td></tr>
    <td> </td><td>
    <input type="submit" value="Submit"></td></tr>
    </form>
    here is my code :
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    byte[] filecontent = file byte content ...
    try {
    c = (HttpConnection)Connector.open("http://xx.com/insert.asp");
    c.setRequestMethod(HttpConnection.POST);
    c.setRequestProperty("Content-Length", String.valueOf(cmg.length + 15));
    c.setRequestProperty("Content-type","multipart/form-data");
    os = c.openOutputStream();
    os.write("file=c:\\abc.png".getBytes());
    os.write(filecontent);
    os.flush();
    I can emulate form with text field and it work, but when it come to file upload, above code not working, I don't know what to put for the outputstream, filename ? content ? or both ? since the html only has one field that is the "file" field. The file is actually store in rms with filename abc.png, and I just put in the c:\ for the server as a dump path.

    File upload is more complicated then that... you need multi-part MIME formatting.... But I have just the code...
    http://forum.java.sun.com/thread.jspa?forumID=256&threadID=451245

  • Post XML from HTTPs server

    How do I get the HTTPs server to send/post the XML file to user's mailbox?
    The situation is like this: User from System A need to send XML file to User in System B. These 2 can't communicate directly.So the XML file will be posted to an HTTPs server. This HTTPs server will then post the XML to the recipient based on the mailboxid. This mailboxid is specified in the XML. How do i send the XML to the designated mailbox?

    You write something that runs on the server, receives
    the uploaded XML file, attaches it to an e-mail
    message, and sends that message. Since you ask in the
    Java context, that something could be a servlet. (You
    will notice that this applies equally well to files
    that aren't XML.)Hi there! Thanks for the feedback. So I need to create a servlet in the HTTPs server which upon receiving of the XML file, servlet need to read the XML content to get the mailboxid then attach the XML file to that mailboxid? All these can be done in one servlet? Please correct me id I'm wrong. Your feedback is highly appreciated. Thanks..:)

  • URGENT - Posting a XML file to a listener URL

    Hi all,
    I have a situation like this: A servlet Client should post a XML file
    to a listener URL, and the listener responds back with a XML file
    after the processing the posted XML file.
    1. Before posting, the servlet client should establish a session with
    the server on which the listener URL is sitting and the Server will
    return a cookie with the authentication credentials to the servlet
    client.
    2. That cookie should be added to the HTTPResponse and then the
    posting of the file should happen.
    The first part is happening okay ..and i could add that cookie to the
    HTTPresponse.
    Now, did anyone successfully post a XML file to a listener URL like this from a servlet?
    I tried using URLConnection, but my cookie got lost and i got back a 401 error. The key there is i should use the same HTTPrequest and HTTPresponse objects, as the cokie needs to be retained!
    Any example code please!!
    thanks a lot
    Rox

    Thanks for your response, but i dont think using authenticator would work. To tell you exactly what is happening there, the url to which the sevlet posts the XML file is protected by Siteminder ( a Enterprise securty platform) and all it requires is a cookie with authenticated credentials on the httprequest/httpresponse objects which are trying to post to that URL. If it find the cookie with the credentials, then the requestor will not be challenged for credentials.
    Here is what i am doing:
    String urlString = "http://webservicesURL.com/ws";
    Cookie SMSESSION = setSMSession();
              if(SMSESSION != null)
                   response.addCookie(SMSESSION);     
              System.out.println("\n..Cookie confirmation..\n"+SMSESSION.getName()+" : "+SMSESSION.getValue());
    URL u = new URL(urlString);
              URLConnection conn = u.openConnection();
              conn.setDoOutput(true);
              conn.setDoInput(true);
              conn.setRequestProperty(SMSESSION.getName(),SMSESSION.getValue());
              OutputStream out = conn.getOutputStream();
    BufferedReader in = new BufferedReader(new FileReader(file));
              while((s = in.readLine())!= null)
                   xml_line = xml_line+s;
              writer.println("The XML file is ..\n");
              writer.println(xml_line);
              writer.println("\n\n\n");
              out.write(xml_line.getBytes());
              InputStream ins = conn.getInputStream();
    when i execute the servlet, i get a tomcat error 401 on the last line above.
    So the new URLConnection that is being opened, is not carying the credentials with it, or the siteminder is unable to read the credentails from the URLConnection. But i am positive that it can read the credentials from the cookie from the HttpResponse object.
    Do you have any more ideas, please?
    thanks

  • How to post  xml over http

    Hi experts,,
    My idea is to post XMl file from client application to server.
    user.XMl file will be created then and there dynamically based on user entered data.
    For this i have a .java program in client application.
    And one important thing is My XMl file contain image in binary data,, which is in Base64Encoded format.
                      <?xml version="1.0" encoding="UTF-8"?>
                    <FileAttachment>
                                         <UserName>krish</userName>
                                         <password>rao</password>
                                        <image type="jpg">
                                                   <PictureData>
                                                    QAAAAIAGtaMS2/u6RnIAAAAIYAAAAKAAAAYm
                                                          l0bWFwLmJtcHPybWOAADMg1gBiVihm
                                                      ZJAAiwcA8RE+CIaB/6iAYj4AUEsBAhQAFAAAAAgAa1oxLb+7
                                                     pGcgAAAAhgAAAAoAAAAAAAAA
                                                      AAAgALaBAAAAAGJpdG1hcC5ibXBQSwUGAAAAAA
                                                    EAAQA4AAAASAAAAAAA
                                             </PictureData>
                                        </image>
                     </FileAttachment>My .xml like above.. i have to post it to server . Some thing like http://myserver:8080/Requesthandler.java which recive the xml and parse it and do some other things.
    And one thing is My server at some location and my client application at other location.
    Plz do me some help as early as possible

    Thak u
    but i am sitting in front of laptop but i cant find perfect code match to me.
    Give me link if possible,
    <Product>
      <SKU>99238</SKU>
      <Description>Super Gidgetidoo</Description>
      <Picture>
    Content-Description: File encoded with ENCODE64.EXE.
    Content-Disposition: attachment; filename="foo.zip"
    Content-Transfer-Encoding: BASE64
    Content-Type: application/octet-stream
    UEsDBBQAAAAIAGtaMS2/u6RnIAAAAIYAAAAKAAAAYm
    l0bWFwLmJtcHPybWOAADMg1gBiVihm
    ZJAAiwcA8RE+CIaB/6iAYj4AUEsBAhQAFAAAAAgAa1oxLb+7
    pGcgAAAAhgAAAAoAAAAAAAAA
    AAAgALaBAAAAAGJpdG1hcC5ibXBQSwUGAAAAAA
    EAAQA4AAAASAAAAAAA
      </Picture>
    </Product> If my xml like above and its created dynamically based on client input.
    I find some code to post above xml, But it post an XMl file in hard disk
    it uses output stream to post , ie read every byte in xml and write to out put stream.like below
    response.setContentType("text/xml");
          response.addHeader("Content-Disposition", "attachment; filename="
              + fileName);
          response.setContentLength((int) xml.length());
          FileInputStream input = new FileInputStream(xml);
          buf = new BufferedInputStream(input);
          int readBytes = 0;
          while ((readBytes = buf.read()) != -1)
            stream.write(readBytes);But i want to post xml file as it is , means whole xml document as an element
    let me help

  • Sending xml file from client to servlet

    Hi,
    I am writing the server component of an applcation, such that it will receive xml files from the clients(standalone application similar to javaSwing stuff but it's coded in C#), and the servlet will have to extract the data from the xml file and update the mySql database. it will also fulfill the client's request for xmlFiles (and extract data from DB, format to xml file and send back to client)
    I'm new to implementing the servlet receiving files from clients so would need some help.
    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file from the client as a series of httpPost request/response. Do i send a File or the file's contents as a String to/from the client?
    2) Is it also a must to use socket for the file transfers? I have read in other posts about sockets as well as HttpURLConnection but i don't quite understand.
    3) When I send a file back to the client(client is standalone application written in C# whereas server is coded in java), what do i specify for the HttpResponse.setContentType() in my servlet? (i'm returning the xml file to client)
    Would really appreciate for any help rendered. If you have any useful links, would appreciate them too. Thanks a lot.
    Karen

    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file
    from the client as a series of httpPost
    request/response. Do i send a File or the file's
    contents as a String to/from the client?The server will listen on some port for requests. The client has to open a socket to this server to send the file as string to the server.
    see http://java.sun.com/docs/books/tutorial/networking/index.html
    >
    2) Is it also a must to use socket for the file
    transfers? I have read in other posts about sockets as
    well as HttpURLConnection but i don't quite
    understand.You use HttpURLConnection to make a request using the http protocol, instead of opening a socket and then writing the html headers yourself.
    3) When I send a file back to the client(client is
    standalone application written in C# whereas server is
    coded in java), what do i specify for the
    HttpResponse.setContentType() in my servlet? (i'm
    returning the xml file to client)Its up to your receiving program how to interpret this though, so you probably dont need this.

Maybe you are looking for