How to access request content using MultipartMessage Object

I want to take a file from the Client and upload it as a FileInputStream on the server.
I have a simple form as follows:
<form action="scan" name="scan_files" method="post"
enctype="multipart/form-data">
<input type="file" name="file1">
<input type="file" name"file2"/>
<input type="Submit" name="insert_scaned" value="Upload"/>
</form>
In my servlet I tried to use the com.sap.engine.services.servlets_jsp.lib.multipart.MultipartMessage
class to parse the form information.
protected void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
MultipartMessage multipartMsg =
(MultipartMessage)request.getAttribute("com.sap.servlet.multipart.body");     
if (multipartMsg != null) {
     multipartMsg.addFormParametersToRequest();
The help said that once this is done the form information should be accessible via the
request getParameter() method. However, I can't seem to get it working?
How can I access the file so that I can parse it into a FileInputStream?
Thanks.

Hi Mat,
first, welcome on SDN!
About your question:
From the APIDoc - https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/javadocs/nw04/sp12/j2ee%20engine/com/sap/engine/services/servlets_jsp/lib/multipart/multipartmessage.html - I would expect this as a solution:
MultipartMessage multipartMsg = (MultipartMessage)request.getAttribute(MultipartMessage.MULTIPART_BODY_KEY);
if (multipartMsg != null) {
  for (int i = 0; i < multipartMsg.getCount(); i++) {
    MultiPart mp = multipartMsg.getBodyPart(i);
    // mp.getInputStream, mp.getBody() or whatever you need
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

Similar Messages

  • UCM 11g - how to accessing secured content using open WCM service

    Hi All,
    Does any one has an idea on how to access the contents that are checked in with security groups as "Secured". If the contents are checked in as "Public" then, we can easily access the same with the following open WCM servervice:l
    http://<ucm_server>:16200/cs/idcplg??IdcService=WCM_PLACEHOLDER&dataFileDocName=<data_file_name>&templateDocName=<region_template_name>
    Regards,
    Sanjay

    Hi Donato,
    Did you ever get an answer for this issue? I'm trying to get a similar case working and would be curious on how you ended up doing this...
    For what I know so far, this may help you:
    1) The trigger-EBSProfile requires you to pass th afGuid value, this value, is created automatically by the IPM process, basically, when you click the MA button in EBS, the SOA call to IPM does 2 things:
    First, it creates a row in the AFGRANTS table in the WCContent DB, this basically overwrites UCM security and give the user access to the documents, this table has the information of the EBS record (Business Object, and Primary Key) as well as the auto generated afGuid
    Second it sends back the URL to WCContent, mainly "/cs/idcplg/_p/min/af/trigger-EBSProfile?IdcService=GET_SEARCH_RESULTS_FORCELOGIN" and passes the afGuid created in the first step, which identifies the EBS record.
    So if you need to make direct calls to UCM under the trigger-EBSProfile you will need to manually (custom) add the afGuid and details of the EBS record to the table, the entries in this table get removed automatically based on the dexpirationdate value
    2) While the IPM SOA call overwrites the UCM security, if you have implemented your own security structure (assign a different security group to the documents and give the users access to it) you could make calls directly to UCM bypassing the "trigger-EBSProfile"..
    for example, in the call you were trying to make originally to DOC_INFO, if you know the dDocName of the document, you can simply call the service as "/cs/idcplg?IdcService=DOC_INFO_BY_NAME&dDocName=POC2001" (I use DOC_INFO_BY_NAME because you need to know the dDocId for DOC_INFO)
    You can do the same with other services like checkin/checkout etc, (for checking you will need to pass the additional parameters dfBusinessObejct, dAFBusinessObject and dfApplication to link the document to the EBS record)
    Regards,
    Juan Becerra

  • How to access Infocube content using an ABAP program

    Hi,
       I am trying to access infocube contents using a ABAP program in BW.
       It is easy to access ODS content as we have NEW DATA or ACTIVE DATA
       tables. Is there any way we can access Infocube content.
       I tried using the FACT table but it has only Keyfigure data.
    thanks
    arshad.

    Hi,
    I would suggest to use a transactionnal cube, even if you do not use BPS to feed it.
    Then, you create a layout in transaction BPS0 (~ similar to a query), and you can access the cube content by simply using the SAP function <b>API_SEMBPS_GETDATA</b>.
    This is easy and fast.
    Regards,

  • Web Dynpro ABAP: How to access the content of a mime object?

    Hi everyone,
    does anybody know how to access the content of a mime object of a Web Dynpro component? I added a XML file as mime object to a web dynpro component. Now I want to read the content of this xml file within a method of the component controller. The code would look something like:
    DATA: xml_content type xstring.
    xml_content = read_mime_object("test_123.xml").
    Any ideas?
    Regards,
    Nils

    dude here's the modification that i've done but I can't still access the content of the properties...
               Mail mail = new Mail();
               String message2 = sqlException.getMessage();
               File file = new File("Add.properties");
               Properties props = new Properties();
               props.load(new FileInputStream(file));
               String[] emailadd = {props.getProperty("emailadd","defaultValue")};
               mail.postMail(emailadd,"An error has occurred, Auto-archive was unsuccessful.", message2,"[email protected]");
               Message was edited by:
    ryshi1264

  • How to trigger a workflow using generic object services?

    Hi Experts,
    Let me know on how to trigger a workflow using generic object services.
    My requirement is to trigger the FI document reversal document using Object services.
    Any info or docs relevant to this, please share with me..
    Thanks,
    Dinesh.

    Dinesh,
    First of you need to check if the transaction has a BO (in released status) published to use the GOS.
    These are the pre-requisites for GOS
    http://help.sap.com/saphelp_46c/helpdata/en/94/aa532cddd511d289860000e8216438/content.htm
    Once done.. check that you have valid workflow linkages active for this BO.
    Now when you click on the 'start workflow' the system will show all relevant workflows for the BO to choose from and to start.

  • How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    Hi,
    Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
    Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
    But this only works if the URL i give points to a static html page.
    So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
    Have u ever tried to do some things like this?
    Rahul

  • LSADMIN CMS authorization problem - How To Transport XI Content Using CMS

    We are configuring CMS using the "How To Transport XI Content Using CMS".  For the LSADMIN user we have added the SAP_XI_CMS_SERV_USER and SAP_SLD_ORGANIZER roles.  We have followed all of the steps in the guide.
    The problem we are encountering is that when we define the domain but put in the LSADMIN as the user, we get an error - "SLD (URL http://server:50000) server exception: HTTP response code: 403 Forbidden"
    We then gave the LSADMIN all of the roles of XISUPER and restarted the J2EE engine.  We still have the same problem.  So we changed the CMS User to be XISUPER and we could save the domain.  Now, we have another problem - when we try to export from dev using CMS, we get the following problem:
    "Sent on 3/9/06 at 1:26 PM: Unable to establish connection to CMS server http://servername:50000. Unable to transfer the following transport lists:  Export list for ...
    Details: unknown exception: com.sap.cms.util.exception.conf.CMSCFinderException: Workspace name does not exist: com.sap.cms.util.exception.conf.CMSCFinderException: Workspace name does not exist: version=0,dtrWSName=
    Check the availability of the CMS and the user authorizations and send the transport request again if necessary
    We are on SP16.  Anyone encountered this issue?
    Regards,
    Jay

    Here are all of roles we have given LSADMIN in client 100:
    SAP_CMS_ADMINISTRATOR
    SAP_SLD_DEVELOPER
    SAP_SLD_GUEST
    SAP_SLD_ORGANIZER
    SAP_XI_BPE_MONITOR_ABAP
    SAP_XI_CMS_SERV_USER
    SAP_XI_CMS_SERV_USER
    SAP_XI_DEMOAPP
    SAP_XI_DEVELOPER
    SAP_XI_DEVELOPER_ABAP
    SAP_XI_DEVELOPER_J2EE
    SAP_XI_MONITOR
    SAP_XI_MONITOR_ABAP
    SAP_XI_MONITOR_J2EE
    But on the J2EE side, we only see the following roles for LSADMIN:
    - Authenticated Users Built-in Group Authenticated Users
    - Everyone Built-in Group Everyone
    - SAP_XI_CMS_SERV_USER Exchange Infrastructure: Change Management Service User
    I checked client 000, and noticed that LSADMIN only had the SAP_XI_CMS_SERV_USER.  So this the problem.  I added all of the roles to LSADMIN in client 000 and restarted J2EE and now i can see all of the roles under the LSADMIN user in UME.
    We noticed the problem that our UME configuration was pointing to client 000 and not client 100.  If we go to Visual administrator and go to the Services->UME Provider, we see that - ume.r3.connection.master.client points to client 000.  We will need to change this.
    That was the issue.  UME was pointing to the wrong ABAP client.  I appreciate all of your help.
    Regards,
    Jay

  • How to access Acrobat Plugin using GetInterface?

    Hi
    I'm trying to access a C++ plug-in written for Adobe Acrobat from a C# program. Following is my code, which I found elsewhere in this forum (LINK).
    Type acroApp;
    acroApp = Type.GetTypeFromProgID("AcroExch.App");
    object oAcroObject = Activator.CreateInstance(acroApp);
    object[] param = new object[1];
    param[0] = "MyPlugin";
    object pluginRef = oAcroObject.GetType().InvokeMember("GetInterface",BindingFlags.Invoke Method, null, oAcroObject, param);
    Here, MyPlugin is the name of the plugin (without extension) which I've placed in the Acrobat plug-ins folder. But this way, InvokeMember returns a NULL object instead of the expected interface of my plugin.
    What am I doing wrong? Any help would be greatly appreciated.

    You don't do it that way.
    You need to use standard "inter application communication" methods such as (but not limited to): COM, DDE, shared memory, shared files, named pipes, etc.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 1 Feb 2012 20:20:23 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: How to access Acrobat Plugin using GetInterface?
    How to access Acrobat Plugin using GetInterface?
    created by Sachintha81<http://forums.adobe.com/people/Sachintha81> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4180327#4180327

  • How to view alerlog contents using SQL?

    How to view alertlog contents using SQL?

    Hi,
    Why don't you use the OEM Database Console ?? Now, in order to view the contents of the alert log file using a SELECT statement, you need to create a external table:
    create or replace
    directory background_dump_dest_dir
    as '<your_oracle_home>/bdump';
    CREATE table alert_log_external
    (line varchar2(4000) )
    ORGANIZATION EXTERNAL
    (TYPE oracle_loader
    DEFAULT DIRECTORY background_dump_dest_dir
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY newline
    nobadfile
    nologfile
    nodiscardfile
    FIELDS TERMINATED BY '#$~=ui$X'
    MISSING FIELD VALUES ARE NULL
    (line)
    LOCATION ('alert_<sid_of your_database>.log') )
    REJECT LIMIT UNLIMITED;Cheers

  • As a new MacBook user I plug in my USB Flash Drive but don't know how to access its contents. Please help. Thanks.

    as a new MacBook user, when inserting my USB Flash Drive, I do not know how to access its contents. Please help. Thanks.

    Open a new Finder window, Finder > File > New Finder Window, and it should appear on the left under Devices.
    If you don't see it there, or to get it to show up on the Desktop: Finder > Preferences... General tab, check External disks to have it show on the Desktop,  Or Sidebar tab, check External disks under DEVICES.

  • Error : Access not possible using "null" objects reference

    Hello.
    i am working with a zbapi.
    i called a external email program in this bapi,everything is working fine over here.
    In webdynpro java they mapped my bapi and starting working from there.
    every functionality is working fine but regarding this email stuff it is showing an error as access not possible using null objects reference.
    where could be the possible error.
    is it in webdynpro or in abap side.

    Raghu,
    You are right. When it comes from the WD Java, may be you are not passing any value at all. You can trace it by these ways.
    1. Check it using SE37, make sure everyhting is fine.
    2. Print all the values that you are passing to the RFC in the execute RFC method().
    3. using ST05 transaction in R/3, enable RFC and SQL trace, check what is passing in between web dynpro and R/3.
    Moreover paste your error message here.
    Thanks,
    Raj.

  • How to access xml file using c

    how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
    samitha

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • How to access the content in the configuration files

    Hi, Folks,
    To make it easy, the questions can be like this:
    how to access the content in web.xml in a web application?
    Through ServletConfig and context?
    how to access the content in ejb-jar.xml in an ejb?
    initial context?
    Thanks

    There is no documented way to delete data stored in archived log files: you can only remove the archived log files if needed.

  • How to access the mysql using ordinary command line in Azure Website?

    Hi
    I deploying Django project on Azure. I created project and MySQL db according this method: https://pytools.codeplex.com/wikipage?title=PollsDjangoSql . I can create tables using django command "syncdb" in Visual Studio. I see
    db structure in SQL Explorer. All works. But now I need to get access directly to mysql.  For example with a view to set encoding of some column, or set permissions, change user password, etc.
    I found about many different tools and methods in Microsoft portal. But the purpose of these tools, how to install it and how to use it is a very entangled (After several attempts to find out what's what two weeks later I found on my computer
    three dozen programs with unknown purpose. I doubt that I need to install so many tools to just add the user in mysql).
    How to access the mysql using ordinary command line (or the same simple tool) in my case?

    Hi pvgdrk,
    To get access directly to a mysql database, you can use the commandline tool(open a cmd window-->type mysql the commadline ) or the
    GUI MySQL workbench.
    Since this is a question about MySQL, I would suggest you post your question in a dedicated MySQL forum. You will get more prompt response.
    If you have any feedback on our support, please click
    here.
    Eric Zhang
    TechNet Community Support

  • How to access remote database using applet

    hi all,
    I want to know how to access remote database using applet,
    Please help me anybody.
    Regards
    Jesu

    If the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.

Maybe you are looking for