Sending a file as a http response

I am accessing a file on the file system and sending it back to the HttpResponse with the below code. My only problem is that every now and then the file transfer gets cut and the file is now downloaded completely. This does not happen after a certain size and a transfer that didn't work the first time might work the second.
The problem also occurs more often from remote sites than from my machine which resides on the same local network as the machine.
Is there anything in the code or the surrounding environment which I need to be aware of in order to fix this problem?
  public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    String filename = request.getParameter("fileName");
    FileDataSource fds = new FileDataSource(filename);
    DataHandler dh = new DataHandler(fds);
    response.setContentType(fds.getContentType());
    response.setHeader(
      "Content-Disposition",
      "attachment; filename=" + filename);
    dh.writeTo(response.getOutputStream());
  }

I've recently written a "file download servlet", too and found it to work quite well. There are some issues when using IExplore for Mac I'm aware of but usually transfers complete successfully.
It could be that the network reliability in your region is pretty poor and a lot of packets get dropped on the way - that would also cause a transfer to fail.
FileDataSource fds = new new FileDataSource(filename);
DataHandler dh = new DataHandler(fds);What are these two classes FileDataSource and DataHandler? Maybe they are causing the problems.
If you just want to download files and display a "Save file as..." dialog to the user, you don't have to use any third party classes/libs. Just do
File file = ...
String filename = ...
response.setContentType("application/octect-stream");
response.setHeader(
     "Content-Disposition",
     "attachment; filename=" + filename);
// Setting the content length ist not mandatory but provides the
// client with enough information to display a progress bar
response.setContentLength((int)file.length());
// The rest is just plain "read it in, write it out" stuff
BufferedInputStream in = new BufferedInputStream(
     new FileInputStream(file));
BufferedOutputStream out = new BufferedOutputStream(
     response.getOutputStream());
int len;
byte[] buf = new byte[1024]; // or whatever buffer size you like best
while((len = in.read(buf)) != -1)
     out.write(buf, 0, len);
in.close();
out.flush();
out.close();Hope I could help,
phil

Similar Messages

  • How can i send xml file with a http servlet request

    Hi
    Please tell me how can I send a xml file into http servlet request.
    I have a servlet(action) java file.From this servlet I have generate a xml file. Now I need to send that xml file to another servlet with http servlet request object.
    Dave.

    When you say you have generated an XML file what do you mean?
    Is it a file stored on disk? Then pass the file path as a string to the servlet.
    Is it stored in memory as an object? The pass a reference to the object to the servlet.
    Or are you asking how to communicate between servlets?
    Look in the JavaDocs for the RequestDispatcher class. You can use this class to forward the request to another servlet. Data can be passes using the RequestDispatcher by storing it as attributes using the request getAttribute and setAttribute methods. Also described in the JavaDOcs.
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html

  • HTTP Sender with EOIO leads to HTTP Response 500

    Hello everybody,
    since we are using SP12 we have problems with the HTTP sender when using EOIO. If I use the two parameters ....qos=EOIO&queueid=myQueue... I got a HTTP Reponse Code 500: Internal Server Error in the sender system (for the test I use a Java Program). When I use the qos EO (without a queue ID) it works.
    Does anybody now this problem?
    Regards,
    Thomas

    Have u seen this
    HTTP Queue for EOIO
    Also have a look here SAP Notes – 804124, 807000
    Regards,
    Prateek

  • HTTP response code 401 when trying to import webservice

    Hi,
    I've created a Webservice how descripted in http://help.sap.com/saphelp_erp2005/helpdata/de/24/186440bdd39a0ae10000000a155106/content.htm. Now I try to import it in NWDS. I followed the step by step guide "81 Using a Web Service as External Service (Service)".
    My WDSL file of my webservice is available over http://server:8000/sap/bc/srt/rfc/sap/Z_MPO_XRFC_CAFTESTBO_GETBYNAME?wsdl
    When I try to use this url in step 4 (page 13) I get the following message:
    Cannot Load WebService WSDL from URI: http://server:8000/sap/bc/srt/rfc/sap/Z_MPO_XRFC_CAFTESTBO_GETBYNAME?wsdl reason: IO Exception occurred while parsing file:Server returned HTTP response code: 401 for URL:
    http://server:8000/sap/bc/srt/rfc/sap/Z_MPO_XRFC_CAFTESTBO_GETBYNAME?wsdl
    The HTTP errorcode means "no authorisation". But why does the NWDS don't ask for user and password?
    Any ideas?
    Best regards from cologne
    Martin

    Hello Martin,
    step 4 of page 13 is only for loading the WSDL and generating the external service model.  The user and password that you give here is not used for exectuting the web service.  The runtime configuration for your web service is done on page 23 of the tutorial.  Here is where you set the user and password for the execution of the web service.  You can choose either basic authentication or SSO with login ticket which will not send any text login information.
    Regards,
    Austin.

  • Some extra bytes appended to the http response by GzipResponseStream

    My project needs to open pdf in browser. But the IE tells me that the file cannot be open by default program. It is either corrupted or has a incorrect filetype. And IE tries to download it.
    I trace the http response by HttpWatch and find the content type is "application/pdf" which seems correct. And then I notice that there are some extra bytes in the http resposne. I use a servlet to retrieve the pdf file. The last few bytes of the http response are "%%EOF\n\r\n0\r\n\r\n". The last seven bytes "\r\n0\r\n\r\n" are the extra ones. I suspect these bytes are added by GzipResponseStream according to my debug result. But I dont have the source code so I am not sure.
    If I do not use servlet but get the pdf file directly the http response will end with "%%EOF\n" and IE can open it successfully.
    And I checked all responses from servlet they all have the extra seven bytes. Sometimes it cause the IE crash.
    I appreciate if anyone can tell me what the problem is.

    This is not a problem. I never know it is the chunked encoding of http protocol.

  • How to send a file from a java program to a servlet and get a response

    Hi,
    How can I call a servlet from a standalone java program and send a file to a servlet using POST method and in return gets the status back from the servlet. Any help is appreciated any small sample will help.
    Thanks.

    Hi,
    I am trying the following sample I got from net and am getting the following error. Any help what I am doing wrongs:
    06/12/24 02:15:58 org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
    06/12/24 02:15:58      at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:294)
    06/12/24 02:15:58      at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
    06/12/24 02:15:58      at mypackage9.Servlet1.doPost(Servlet1.java:38)
    06/12/24 02:15:58      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    06/12/24 02:15:58      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    06/12/24 02:15:58      at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    06/12/24 02:15:58      at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    06/12/24 02:15:58      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
    06/12/24 02:15:58      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    06/12/24 02:15:58      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    06/12/24 02:15:58      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    06/12/24 02:15:58      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    06/12/24 02:15:58      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    06/12/24 02:15:58      at java.lang.Thread.run(Thread.java:534)Here is the sample client code:
    import org.apache.commons.httpclient.HttpClient;
    import org.apache.commons.httpclient.methods.PostMethod;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    public class PostAFile {
        private static String url =
             "http://192.168.0.17:8988/Vulcan_Materials-ServletPost2-context-root/servlet/Servlet1";
        public static void main(String[] args) throws IOException {
            HttpClient client = new HttpClient();
            PostMethod postMethod = new PostMethod(url);
            client.setConnectionTimeout(8000);
            File f = new File("C:\\load.txt");
            System.out.println("File Length = " + f.length());
            postMethod.setRequestBody(new FileInputStream(f));
            int statusCode1 = client.executeMethod(postMethod);
            System.out.println("statusLine>>>" + postMethod.getStatusLine());
            postMethod.releaseConnection();
    }Here is the sample servlet code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import org.apache.commons.fileupload.DiskFileUpload;
    import org.apache.commons.fileupload.FileItem;
    import java.util.List;
    import java.util.Iterator;
    import java.io.File;
    public class Servlet1 extends HttpServlet
      private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
      public void init(ServletConfig config) throws ServletException
        super.init(config);
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
        try
          response.setContentType(CONTENT_TYPE);
          PrintWriter out = response.getWriter();
          java.util.Enumeration e= request.getHeaderNames();
            while (e.hasMoreElements()) {
              String headerName=(String)e.nextElement();
              System.out.println(headerName +" = "+request.getHeader(headerName));
           //System.out.println("Content Type ="+request.getContentType());
            DiskFileUpload fu = new DiskFileUpload();
            // If file size exceeds, a FileUploadException will be thrown
            fu.setSizeMax(1000000);
            List fileItems = fu.parseRequest(request);
            Iterator itr = fileItems.iterator();
    System.out.println("***************************");
            while(itr.hasNext()) {
              FileItem fi = (FileItem)itr.next();
              //Check if not form field so as to only handle the file inputs
              //else condition handles the submit button input
              if(!fi.isFormField())
                System.out.println("\nNAME: "+fi.getName());
                System.out.println("SIZE: "+fi.getSize());
                //System.out.println(fi.getOutputStream().toString());
                File fNew= new File("C:\\", fi.getName());
                System.out.println(fNew.getAbsolutePath());
                fi.write(fNew);
              else
                System.out.println("Field ="+fi.getFieldName());
            out.println("SUCCESS123456: ");
          out.close();
        catch(Exception e)
          e.printStackTrace();
    }Any help on what is wrong.
    Thanks

  • HTTP Response File not Found

    Hi,
    I have been working on this for days and could not get it resolved.
    I am using UCCX 8.5 Pre to receive an http trigger and send response with some parameters and variables mapping. I followed the scripting guide to create the html template and do the keyword transform. However, when I start to send the response, I always see the error from reactive debug that shows "FileNotFoundException".
    I then try to simply follow the guide to build the testing script (hello), and still see the same error. I think I upload the template html file into a wrong folder. So verified the trigger language and uploaded the template file almost in all folders I could think still with no luck. I even tried in a different UCCX 8.0 system and it is the same.
    What could be the problem? Installation directory?
    Any input would be highly appreciated.
    Thanks,
    Q

    Thanks for the quick response,
    Now I am using the sample script and still get the same result. I got the error message on the 'Send HTTP Response' step.
    I put the test.html (static file) file to default/webapps/ROOT folder, and the hello.html (dynamic) file into the same folder. I can access both files using a browser pointing at:
    http://ip:9080/test.html
    http://ip:9080/hello.html
    Q

  • HTTP response code 500 : Error during Sender Agreement Determination

    I am trying a simple file to file scenario and messages are not being received in Integration Server.
    Through communication channel monitoring, i have received the below error message.
    Error Transmitting the message to
    endpoint http://<hostname>:50000/sap/xi/engine?type=entry using
    connection File_http://sap.com/xi/XI/System failed, due
    to:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException:
    Received HTTP response code 500 : Error during Sender
    Agreement Determination.
    Can you please help
    Regards
    Harish

    Hi Harish,
    http://<hostname>:50000/sap/xi/engine?type=entry
    it should be http://<hostname>:8000/sap/xi/engine?type=entry not 50000 as port It should be your HTTP port...please .make the changes !!
    In SXMB_ADM transaction under Integration engine configuration please change the settings to http://<hostname>:8000/sap/xi/engine?type=entry
    make sure with your basis team that ur http port is 8000 or 8001 ..as per that make the necessary changes..
    Regards,

  • File- XI- RFC (Error: Received HTTP response code 500..)

    Hi,
    I am working on File->XI->RFC  scenario, getting Processed Successfully status in "SXI_MONITOR".
    But Data is not posted in SAP R/3. I check   <b>Runtime Workbench  </b> Getting following Error in one step.
    Can any one help me in analyzing the error.....??????
    2006-06-09 14:36:32 Success output 1149888992513 Channel WEBMETHOD_SENDER_SOAPFMTEST: Send binary file "/usr/sap/transx42/data/xi_input.xml". Size 175 with QoS EO
    2006-06-09 14:36:38 Success output 1149888998592 Application attempting to send an XI message asynchronously using connection AFW.
    2006-06-09 14:36:39 Success output 1149888999757 Trying to put the message into the send queue.
    2006-06-09 14:36:40 Success output 1149889000823 Message successfully put into the queue.
    2006-06-09 14:36:40 Success output 1149889000824 The application sent the message asynchronously using connection AFW. Returning to application.
    2006-06-09 14:36:41 Success SAPEngine_System_Thread[impl:5]_12 1149889001577 The message was successfully retrieved from the send queue.
    2006-06-09 14:36:41 Success output 1149889001591 File "/usr/sap/transx42/data/xi_input.xml" deleted after processing
    2006-06-09 14:36:41 Success SAPEngine_System_Thread[impl:5]_12 1149889001745 The message status set to DLNG.
    <b>2006-06-09 14:37:47 Error SAPEngine_System_Thread[impl:5]_12 1149889067522 Transmitting the message to endpoint http://SAPR3001.bently.com:8042/sap/xi/engine?type=entry using connection AFW failed, due to: Received HTTP response code 500..</b>
    2006-06-09 14:37:47 Success SAPEngine_System_Thread[impl:5]_12 1149889067585 The asynchronous message was successfully scheduled to be delivered at Fri Jun 09 14:42:47 PDT 2006.
    2006-06-09 14:37:47 Success SAPEngine_System_Thread[impl:5]_12 1149889067695 The message status set to WAIT.
    2006-06-09 14:42:47 Success SAPEngine_System_Thread[impl:5]_9 1149889367587 Retrying to send message. Retry: 1
    2006-06-09 14:42:47 Success SAPEngine_System_Thread[impl:5]_9 1149889367587 The message was successfully retrieved from the send queue.
    2006-06-09 14:42:47 Success SAPEngine_System_Thread[impl:5]_9 1149889367643 The message status set to DLNG.
    2006-06-09 14:42:48 Success SAPEngine_System_Thread[impl:5]_9 1149889368435 The message was successfully transmitted to endpoint http://SAPR3001.bently.com:8042/sap/xi/engine?type=entry using connection AFW.
    2006-06-09 14:42:48 Success SAPEngine_System_Thread[impl:5]_9 1149889368471 The message status set to DLVD.
    2006-06-09 14:42:48 Success SAPEngine_System_Thread[impl:5]_9 1149889368472 The message was successfully delivered.
    Thanks & Regards

    Hi Umesh,
    I think, the reason is because of huge number messages ..
    Also just go to RFC adapter, activate the adapter,refresh the cache and try it..
    following guide will help you to solve problem~
    https://websmp103.sap-ag.de/~sapdownload/011000358700002757652005E/HowtoMintorAF.pdf
    Just refresh the cache-The following guide will help you on that~
    https://websmp101.sap-ag.de/~sapidb/011000358700003163902004E/HowTo_handle_XI_30_Caches.pdf
    Refer these SAP notes- 807000,803145
    (some hints)
    Regards,
    Moorthy

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

  • Write binary files to HTTP response using Webtoolkit

    We are using Webtoolkit to generate HTTP responses from stored procedures. This works fine for generating HTMLs.
    However, the functions used for HTML generation ( htp.print , htp.prn ) support only plain text (they handle only VARCHARs).
    How can we generate binary HTTP response (e.g. PDF/DOC files) ? What are the packages/functions which provide this functionality ?
    Thanks,
    Subodh

    You can still use the built in Oracle procedure.
    wpg_docload.download_file(v_blob);
    Write Your procedure as follows:
    1. Load the BLOB from a table or from disk (BFile) into a BLOB object.
    2. Set your HTTP headers.
    3. Send your HTTP response.
    (some stuff omitted)
    owa_util.mime_header(type_mime, FALSE);
    htp.p('Content-Length: ' || v_size);
    owa_util.http_header_close;
    wpg_docload.download_file(v_blob);
    Remember, you can use Oracle's owa_util package to set things or do it yourself manually. Also, you can substitute wpg_docload.download_file for your own code (using RAW) but your making it more complicated.

  • Send xml file from sap to third party url through https

    Hi,
    I have a requirement to send the xml file from ecc to a 3rd party url through HTTPS. How can we achieve this using ABAP.
    Client doesn't have XI enviroment. The client has provided the 3rd party url where the file needs to be uploaded.
    Please help ! <removed by moderator>
    Thanks in advance.
    Regards,
    Chitra.K
    Edited by: Thomas Zloch on Sep 12, 2011 12:58 PM

    Hi Chitra,
    I had similar requirement and here is what I did: -
    REPORT  Z_HTTP_POST_TEST_AMEY.
    DATA: L_URL               TYPE                   STRING          ,
          L_PARAMS_STRING     TYPE                   STRING          ,
          L_HTTP_CLIENT       TYPE REF TO            IF_HTTP_CLIENT  ,
          L_RESULT            TYPE                   STRING          ,
          L_STATUS_TEXT       TYPE                   STRING          ,
          L_HTTP_STATUS_CODE  TYPE                   I               ,
          L_HTTP_LENGTH       TYPE                   I               ,
          L_PARAMS_XSTRING    TYPE                   XSTRING         ,
          L_XSTRING           TYPE                   XSTRING         ,
          L_IS_XML_TABLE      TYPE STANDARD TABLE OF SMUM_XMLTB      ,
          L_IS_RETURN         TYPE STANDARD TABLE OF BAPIRET2        ,
          L_OUT_TAB           TYPE STANDARD TABLE OF TBL1024
    MOVE 'https://<hostname>/xxx/yyy/zzz' TO L_URL.
    MOVE '<XML as string>' TO L_PARAMS_STRING.
    *STEP-1 : CREATE HTTP CLIENT
    CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
        EXPORTING
          URL                = L_URL
        IMPORTING
          CLIENT             = L_HTTP_CLIENT
        EXCEPTIONS
          ARGUMENT_NOT_FOUND = 1
          PLUGIN_NOT_ACTIVE  = 2
          INTERNAL_ERROR     = 3
          OTHERS             = 4 .
    "STEP-2 :  AUTHENTICATE HTTP CLIENT
    CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
      EXPORTING
        USERNAME             = 'testUser'
        PASSWORD             = 'testPassword'.
    "STEP-3 :  SET HTTP HEADERS
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
          EXPORTING NAME  = 'Accept'
                    VALUE = 'text/xml'.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
        EXPORTING NAME  = '~request_method'
                   VALUE = 'POST' .
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
        EXPORTING CONTENT_TYPE  = 'text/xml' .
    "SETTING REQUEST DATA FOR 'POST' METHOD
    IF L_PARAMS_STRING IS NOT INITIAL.
       CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
         EXPORTING
             TEXT   = L_PARAMS_STRING
         IMPORTING
               BUFFER = L_PARAMS_XSTRING
         EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
        EXPORTING DATA  = L_PARAMS_XSTRING  .
    ENDIF.
    "STEP-4 :  SEND HTTP REQUEST
      CALL METHOD L_HTTP_CLIENT->SEND
        EXCEPTIONS
          HTTP_COMMUNICATION_FAILURE = 1
          HTTP_INVALID_STATE         = 2.
    "STEP-5 :  GET HTTP RESPONSE
        CALL METHOD L_HTTP_CLIENT->RECEIVE
          EXCEPTIONS
            HTTP_COMMUNICATION_FAILURE = 1
            HTTP_INVALID_STATE         = 2
            HTTP_PROCESSING_FAILED     = 3.
    "STEP-6 : Read HTTP RETURN CODE
    CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_STATUS
        IMPORTING
          CODE = L_HTTP_STATUS_CODE
          REASON = L_STATUS_TEXT  .
    WRITE: / 'HTTP_STATUS_CODE = ',
              L_HTTP_STATUS_CODE,
             / 'STATUS_TEXT = ',
             L_STATUS_TEXT .
    "STEP-7 :  READ RESPONSE DATA
    CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
            RECEIVING DATA = L_RESULT .
    "STEP-8 : CLOSE CONNECTION
    CALL METHOD L_HTTP_CLIENT->CLOSE
      EXCEPTIONS
        HTTP_INVALID_STATE = 1
        OTHERS             = 2   .
    "STEP-9 : PRINT OUTPUT TO FILE
    CLEAR : L_XSTRING, L_OUT_TAB[].
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          TEXT   = L_RESULT
        IMPORTING
          BUFFER = L_XSTRING
        EXCEPTIONS
          FAILED = 1
          OTHERS = 2.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER                = L_XSTRING
      TABLES
        BINARY_TAB            = L_OUT_TAB .
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       FILENAME                        = 'C:AMEYHTTP_POST_OUTPUT.xml'
      TABLES
        DATA_TAB                        = L_OUT_TAB .
    Also, following is the detailed link for use of HTTP_CLIENT class: -
    http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/1f/93163f9959a808e10000000a114084/content.htm
    Also, in below link, you can ignore XI specific part and observe how its sending XML to external URL:-
    (I know it describes call to SAP XI server's URL, but it can be used to call any URL)
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/ae388f45-0901-0010-0f99-a76d785e3ccc
    In addition to all above, following configs to be present at ABAP application server: -
    1. The hostname used to URL should be present in SAP ABAP application server's 'hosts' file.
    2. Security certificate (if available) for URL to be called must be installed in SAP ABAP application server.
    Let me know if you achieve any progress with it...

  • How to send multiple files with it's original name over HTTPS using one CC?

    I am working on a File to HTTPs scenario. It is in production and working fine. Currently we send only one file and I have hard coded the name in the communication channel in the header fields. Now we have to send more files with different names and I want to use only one receiver channel instead of many. We need to send the files with their original names.
    I used the ASMA in the sender File Adapter and I see the FileName in the dynamic configuration under http://sap.com/xi/XI/System/File name="FileName".
    I know we can use a UDF in message mapping and get the value and put it in HEADERFIELDONE. But we don't want to use mapping as the files are huge and we don't want to insert XML tags in the payload.
    So how do I put the Filename from the DynamicConfiguration to the HTTP header field as FileName without using mapping? Are there any settings?
    Can I put something in the PROLOG or can I use any other module in the File Sender Adapter or is there any other option?
    Any help is appreciated.
    Thanks
    Sai

    See my blog:
    /people/stefan.grube/blog/2009/06/19/unknown-use-case-of-dynamicconfigurationbean-store-file-name-to-jms-header-without-mapping
    You have to put the configuration in sender channel, as HTTP adapter does not allow modules.
    For the second module, put values related to HTTP adapter.

  • How to send XML file into XI using sender HTTP adapter

    I am using HTTP sender adapter to post the XML file into XI. I tried to form the URL by using the following String query , but I am unable to execute file.
    String urlString = "http://<servername:portno>/sap/xi/adapter_plain?namespace=<namespace>&interface=<interface name>&service=<service name>&party=&agency=&scheme=&QOS=BE&sap-user=xiappluser&sap-password=satyam&sap-client=100&sap-language=EN";
    How can I execute xml file by using HTTP sender adapter.
    Any one with better suggestions, about this idea?
    Thanks in advance for all.
    Ram Raj

    Hi
    Just use the following parameter to send xml file using HTTP adapter.
    "http://xiserver:8000/sap/xi/adapter_plain?namespace="senderNamespace"&interface=senderinterface&service=sender service";
    "&party=sender party"&agency=&scheme=&QOS=BE&sap-user=userid &sap-password=password&sap-client=100&sap-language=D";
    with the help of this you are able to point out which interface you would like to use.
    And in payload pass the xml.
    and thats it
    carry on
    Cheers
    Regards
    Piyush

  • Outbound RFC to file: Received HTTP response code 500

    hello:
    i am doing outbound rfc from ecc to other system using PI and I get the below error in the PI.
    I am on PI 7.0 and looked at the RFC destiantions in ECC and all look good.
    The registered program in TCP/IP RFC destination was tested and looks fine .
    I checked the SMICM in PI running at port 8000 and it looks file and also i checked the SXMB_ADM Interation configuration in PI which looks good too .
    Even the PI integration engine is restarted . i am sure its in PI and I am hoping its related to user in PI -adapter frame work user XIAFUSER?
    can you please let me know how to fix the below issue ..
    "Transmitting the message to endpoint http://HGSGXI50:8000/sap/xi/engine?type=entry using connection RFC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Internal Server Error"
    thanks,

    HI
    for the error com.sap.aii.af.ra.ms.api.RecoverableException Received HTTP response code 500 Internal Server Error" 
    HTTP 500 can be any problem at receiver side. Are you sure, that the payload fits to the receiver requirements
    Please refer this thread answered by Stefan Grube
    Plain HTTP adapter error
    check the similar thread HTTP server code 500 reason Internal Server Error

Maybe you are looking for