Adding attachment from PI level

Hi all,
   I am trying to add some attachment to payload using JAVA Mapping.
public void transform(TransformationInput arg0, TransformationOutput arg1)     throws StreamTransformationException
          try{
                    System.out.println("JAVA Mapping  is Initiated");
                    //getTrace().addInfo("JAVA Mapping HMAC is Initiated");
                    InputStream stream1 = arg0.getInputPayload().getInputStream();
                    String inputPayload = convertInputStreamToString(stream1);
                    System.out.println("input file "+inputPayload);
                    String outputPayload = "";
                    outputPayload = inputPayload;
                    byte[] b = inputPayload.getBytes();
                    System.out.println("JAVA Mapping  "+b.length);
                    try{
                    *OutputAttachments outputAttachments = arg1.getOutputAttachments();     
                    Attachment attachments = outputAttachments.create("sd", b); *
                    outputAttachments.setAttachment(attachments);
                    } catch (Exception e)
                    {//getTrace().addInfo("JAVA Mapping Trace "+e);
                         System.out.println("test "+e);}
               arg1.getOutputPayload().getOutputStream().write(outputPayload.getBytes("UTF-8"));
               } catch (Exception e)
               {System.out.println(e.getStackTrace());}
I am getting null pointer exception from below line
*Attachment attachments = outputAttachments.create("sd", b); *
feels like
outputAttachments = arg1.getOutputAttachments();     is returning null.
Please help me in solving same
Regards
Pradeep

Have you tried working with the addAttachment() method of the Message interface (http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/engine/interfaces/messaging/api/Message.html#addAttachment%28com.sap.engine.interfaces.messaging.api.Payload%29) ... It may require some (major) redesign of your JAVA mapping (I'm still on XI, so I can't validate this assumption)
Chris

Similar Messages

  • Exception adding attachment from custom worklist client

    I am building a custom Human Task Editor for BPEL. This is a java standalone (at the moment) and runs on my local Mac machine. The SOA Suite 11g is installed on Linux hosted box.
    A BPEL process is already deployed and an instance created. The instance has reached the 'human task' activity. I can also verify this from <host:port/integration/worklistapp>. However, we plan to build our own worklist app.
    In this custom worklist app (which is configured through REMOTE protocol ), I make use of the taskQueryService to fetch a list of all human tasks assigned to a particular user. This returns me with a list. All works well.
    However, when I try to add an attachment to one of the tasks, I get an exception.
    -------------------CODE:----------------------------------
    import oracle.bpel.services.workflow.task.model.AttachmentTypeImpl;
    In my main class :
    AttachmentTypeImpl at = new AttachmentTypeImpl() {
    public InputStream getInputStream() {
    throw new UnsupportedOperationException("Not supported yet.");
    public void setInputStream(InputStream arg0) {
    throw new UnsupportedOperationException("Not supported yet.");
    public void setBoundary(String arg0) {
    throw new UnsupportedOperationException("Not supported yet.");
    public String getBoundary() {
    throw new UnsupportedOperationException("Not supported yet.");
    at.setContent("THIS IS ATTACH CONTENT");
    at.setMimeType("application/msword");
    at.setName("MyAttach.doc");
    task.addAttachment(at);
    try {
    taskSrvc.addAttachment(ctx, task.getSystemAttributes().getTaskId(), at);
    } catch (StaleObjectException ex) {
    } catch (WorkflowException ex) {
    --------- EXCEPTION --------------------
    Exception in thread "main" java.lang.NullPointerException
    at oracle.xml.jaxb.JaxbNode.getOwnerDocument(JaxbNode.java:237)
    at oracle.xml.jaxb.JaxbNode.setJaxbElement(JaxbNode.java:782)
    at oracle.bpel.services.workflow.task.model.AttachmentTypeImpl.setContent(AttachmentTypeImpl.java:50)
    at customworklistclilent.Main.addAttachment(Main.java:224)
    at customworklistclilent.Main.queryTasks(Main.java:156)
    at customworklistclilent.Main.main(Main.java:70)
    Has anyone tried adding an attachment from the custom worklist client using remote ejb interface

    Have you tried working with the addAttachment() method of the Message interface (http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/engine/interfaces/messaging/api/Message.html#addAttachment%28com.sap.engine.interfaces.messaging.api.Payload%29) ... It may require some (major) redesign of your JAVA mapping (I'm still on XI, so I can't validate this assumption)
    Chris

  • Enforcing attachment to process level not working

    I am trying to attach attachments (doc, pdf etc) at process level from task form but it goes to task level some how. I was able to verify that by looking into WFATTACHMENT table.
    UI side
    <af:selectOneRadio value="#{bindings.attachmentScope.inputValue}"
    label="#{resources.UPLOAD_TO_PROCESS}"
    id="uploadToProcAttach"
    I am making sure attachmentscope is going as 'BPM' not 'TASK' by binding to my own managed bean and set scope to process level.
    This is working because if I do URL instead of desktop file then URL attaches to process level. I verified this too by looking into WFATTACHMENT table.
    So not sure why
    addAttachmentBean.uploadFile no matter what attaches pdf, doc etc attachment to task level and also notices that WFATTACHMENT table has row for this record with taskID as something like f76a60ad-53f2-40dc-ac75-af53d64854e4 instead of taskID as process instance Id like 4000001.
    I am using Oracle BPM 11.1.1.6.0 PS5.
    Attaching URL to process level from a task is working but from the same task attaching real doucment to process level goes to task level.
    I am not using UCM.
    I really appreciate any inside.

    Finally, I was able to solve this issue.
    Project was migrated from Oracle BPM PS4 to Oracle BPM PS5 so some how human tasks created in earlier version were not working in new version for new functionalities (adding attachment to process level). When I deleted these human tasks and recreated in newer version. Everything started working great.
    I am not sure it is Oracle bug issue or what....

  • Unable to open URL attachment from SBWP in CRM WEB UI

    Hello Gurus,
    Need your help please. I'm having some problem opening the URL attachment from SBWP via CRM 7 WEB UI (I used a Transaction Launcher for SBWP). The attachment is a Webdynpro application.  I am able to open the attachment in SAP GUI, but not in CRM WEBUI. This problem occured when we update the SP level of CRM 7.
    Here's the scenario,
    - whenever I click the attachment, it open a new window, which also happen even before SP level update, with the following information:
      Execute an Application on FrontEnd
      Please wait. You will be forwarded automatically.
      This page is included for technical reason.
      Execute program.
      Status: Displaying Office Document ..........
      After a couple of seconds, it will return to the Workflow Workplace screen.
    I have checked the workflow log and found no inconsistency on the attached URL.
    Immediate response would be highly appreciated. Thanks in advance.
    Regards,
    Edwin

    Thanks for the reply WD ABAP.
    Yes, I did try to use the functionality of Worklist and the URL attachment successfully opened. However, there are some limitation in its functionality as indicated in the link below that opted us to use the SBWP in CRM WEB UI via transaction launcher.
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWorklist-AdvancewithDialognotSupported
    We don't want to adjust the logic of our existing workflow at this point as described in the above link as it will entails end-to-end testing again. We just encountered this issue when we update the SP level of CRM 7.
    Hope there is an alternative solution without shifting us to Worklist.
    Regards,
    Edwin

  • Function to fade audio smoothly from one level to another in AS2

    Greetings all.
    I'm a newcomer to Actionscript programming and trying to modify a Flash site template downloaded from TemplateMonster.com (which is an AS2 template).  I've almost succeeded at what I need to do but have run into a couple of brick walls.  One is that I've added a video player to the site and need to make the background music track smoothly fade out when the video starts and fade back in when it ends (or is stopped).  I set up a listener object for the video player that works.  It's the smooth fade of audio levels that doesn't.
    I found an excellent thread from last year (http://forums.adobe.com/message/3236495) in which kglad address the issue of fading audio from one level to another.  Since TemplateMonster's templates set up a master movie clip and then load pages to play within it, and I need to call the function from within the pages, I tried setting it up as a global function.
    So when the overall site initializes, I have this:
    this.createEmptyMovieClip("mcMusictrackHolder", this.getNextHighestDepth());
    var sndAudio:Sound = new Sound(mcMusictrackHolder);
    var nMaxMusicVolume:Number = new Number(mcMusictrackHolder);
    nMaxMusicVolume = 30;
    sndAudio.attachSound("MusicTrack");
    sndAudio.setVolume(nMaxMusicVolume);
    sndAudio.start(0,9999);
    // Here is kglad's function converted to a global function
    _global.fadeSoundF = function(mc:MovieClip,s:Sound,vol:Number,sec:Number):Void
         trace("Getting here with sound at " + s.getVolume());
         clearInterval(mc.fadeI);
         var volumeInc:Number = vol-s.getVolume()/(10*sec);
         mc.fadeI=setInterval(fadeF,100,mc,s,volumeInc,vol);
         trace("Leaving with sound at " + s.getVolume());
    function fadeF(mc:MovieClip,s:Sound,inc:Number,endVol:Number):Void
         s.setVolume(s.getVolume()+inc);
         if(Math.abs(s.getVolume-endVol)<inc)
              clearInterval(mc.fadeI);
    Then within the page that contains the video player (a child of the above), I have this:
    var listenerObject:Object = new Object();
    var sCurrentState:String;
    listenerObject.stateChange = function(eventObject:Object):Void
    sCurrentState = my_FLVPlybk.state;
    if (sCurrentState == "playing")
      fadeSoundF(_root.mcMusictrackHolder,_root.sndAudio,0,1);
    else
      fadeSoundF(_root.mcMusictrackHolder,_root.sndAudio,_root.nMaxMusicVolume,1);
    my_FLVPlybk.addEventListener("stateChange", listenerObject);
    The listener object is working fine - so if instead of calling fadeSoundF I simply do _root.sndAudio.setvolume(0) to mute and _root.sndAudio.setvolume(30) to restore it works fine except that the volume changes abruptly instead of ramping.
    But obviously there's a problem with my effort to convert kglad's function to global and use it that way, because the trace statements tell me the audio is getting set to random levels.  It smoothly ramps all right - but tries to get to -472 or +8212 or other insane numbers.
    Any help with where I'm going wrong would be deeply appreciated.  Keep in mind that although I have some long-ago programming experience in other languages, this environment is completely alien to me and you can feel free to assume I'm completely ignorant.  What I've managed to piece together is largely pulled from online research, which is why there's probably an obvious glaring error in there.  Feel free to provide a response that assumes I know nothing.
    Best,
    Pete

    I added a few more traces.  Here's the new main page:
    this.createEmptyMovieClip("mcMusictrackHolder", this.getNextHighestDepth());
    var sndAudio:Sound = new Sound(mcMusictrackHolder);
    var nMaxMusicVolume:Number = 30;
    sndAudio.attachSound("MusicTrack");
    sndAudio.setVolume(nMaxMusicVolume);
    sndAudio.start(0,99999);
    _global.fadeSoundF = function(mc:MovieClip,s:Sound,vol:Number,sec:Number):Void
              trace("Getting here with level at " + sndAudio.getVolume());
              trace("asking to set it to " + vol + " in " + sec + " second(s).");
              clearInterval(mc.fadeI);
              var volumeInc:Number = vol-s.getVolume()/(10*sec);
              mc.fadeI=setInterval(fadeF,100,mc,s,volumeInc,vol);
              trace("Leaving with sound at " + sndAudio.getVolume());
              trace(" ");
    function fadeF(mc:MovieClip,s:Sound,inc:Number,endVol:Number):Void
              s.setVolume(s.getVolume()+inc);
              if(Math.abs(s.getVolume-endVol)<inc)
                        clearInterval(mc.fadeI);
    Here's sample trace output:
    Getting here with level at 30                  <---- this is on first visiting the page where the listener object initializes and asks it to ramp the audio from its
    asking to set it to 30 in 1 second(s).             current level to the same level (probably because the video is buffering or rewinding and that counts as a state change).
    Leaving with sound at 30
    Getting here with level at 111                <---- this is a second triggering of the function (probably because the video is STOPPED and that counts as a
    asking to set it to 30 in 1 second(s).            state change after buffering).  As of yet the video hasn't been asked to play.
    Leaving with sound at 111
    Getting here with level at 3765               <---- This is what happens when the video is asked to play; since it is asking to leave the level at 30 I'm guessing it is buffering
    asking to set it to 30 in 1 second(s).              again but not playing yet, which is why it's still being asked to set the background to 30 instead of 0.
    Leaving with sound at 3765
    Getting here with level at 3765                <---- NOW the video is actually playing, so it asks to set the background audio to 0.
    asking to set it to 0 in 1 second(s).
    Leaving with sound at 3765
    Getting here with level at -41740             <---- ... and I hit STOP, which generates a request to bring the background audio back to 30.
    asking to set it to 30 in 1 second(s).
    Leaving with sound at -41740
    I should probably replace the if/else on the video player page with a switch/case so the function ONLY gets called when playback actually stops and starts, and doesn't get triggered for every state change.  But I think I still have an error in here someplace...
    Many thanks to kglad for your help!
    Pete

  • How can I delete an attachment from a received email but save the message?

    Hi all, how can I delete an attachment from a received email but save the message?*

    Over the years this issue crops up again and again. Here are the cases I know about:
    Case 1 - it simply doesn't work
    I have a message in my inbox with a jpeg of about 300Mb. Select message, choose option "remove attachment" which is not greyed out, and it does not work.
    Case 2 - it works if you save the message first
    I move the message from the inbox to a mail box. Open the mailbox (select), select the message, choose option "remove attachment", result: the attachment is removed, a small text file is added and an error appears in the message "missing plug-in". The message size is reduced from 300Mb to a few bytes.
    Case 3 - the option "remove attachment" is greyed out.
    I've googled this at least 10 times and read all the advice about editing various files from the library and all the other hacks. The simple truth here is that the user should not be inconvenienced by such inappropriate behaviour. We're not used to this from Apple any more, not since OS X. Even Windows does this stuff painlessly. In fact this kind of function is something that Outlook and Exchange do incredibly well. If they didn't the corporate world would have ground to a halt.
    My point: the remove attachment option should work all the time and should be redesigned. Right-click + save as + delete in the message would be a hundred times easier.

  • Email attachment from ibooks or file manager

    When I email a attachment from ibooks or file manager, the  text added to the email witch is visible in the send email on the ipad is not send except for the inserted file  Only the attachment is received but no text.  Is it possible to ad a text and signature?

    That issue has nothing to do with FileVault. The recipient's mail server is misconfigured.

  • Extract attachment from input sream?

    hi,
    how can i retrieve image/attachment from input stream.
    I am getting:
    <?xml version="1.0" ?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.csapi.org/schema/parlayx/multimedia_messaging/send/v2_4/local" xmlns:ns2="http://www.csapi.org/schema/parlayx/common/v2_1">
    <soapenv:Body>
    <ns1:sendMessage>
    <ns1:addresses>tel:070123456789</ns1:addresses>
    <ns1:senderAddress>tel:07123456789</ns1:senderAddress>
    <ns1:subject>GIF89a� > � p��Hl����������+Ut������
    <`Cf��������������� 2X!� , � > ��I��8����`xIbi�h�>���p��rm�"��|�����',C��r9b:��$tK@KJ�����c,8P��tQ ������ �B�_��� p|q
    ��
    �� 4hk �����:�l�:��� ��� ��c ���*X��Y�� �,� �n ���������
    ���� �{|
    Y�m���C��;` !�c���I| P��Z �r�= �1�F r���`Z_q 0oP�C4AP@��
    08�a��>H` ��o � Z� �:-���o�4`2����WH�� X�3���`Uu�@K ���d� �A� *�d+@��lv���C6��9�U�� ������WY�"a��B�8�} Z���c,��tH���(:00�x�4Hvl�0��� 8A�H��( �X��L 7�?
    �&���r�lW@m�� ��(^� ��E:�o��"0�Cu���N���
    ��,���]���Y6�e�]P t����\��@?�P�ud` � x����� �
    �� ���I0rH�
    B�*=�� 5dAi,���p7�N m����$�� �A4N8�Z����uHB�F6"o�5� ��[J�m���X-��6 � ,�@|m���c��-��' ���Ors4�hh�? ��P#���P�50��)���
    V�J�bX��D�<�iU���%M������ �c� &���$G@��a@*�: $$��8M���+�����r�#��)|c��&2`V��/&X� ��0�c`��� |��w���0�N2�z���Th���F/
    ��lro���r��XQ�%��X.�
    )Q��AT��i���P�M��Y��T�d�� ��"��� <I5�V_�H�Z�u�v|
    �b��E�fS��|d�A�u ��YRu��� a2���3��S�XR0^dw���xb�U���6A�����
    8�� �t�d�@���p���d�Dw ��a R�uq����%�
    $�:k�W��a�H`i$.Zt_IR@{`����}�/4�n�w��.:Jr�B
    �F���D;���{3W ?���U� �H�{���9�� ��AT���������[���>�%�Io�a���X���q�<P��y�� �� ��g�>�/
    ��$���$�S�C��"Sk���y X8�BZQ�L� �.�0\wC��� $�3��X�)� r3��e=k���q�1
    + 9��~tS��l����O���Kc����t������ 'U�OZ������
    oZ������e�� �t�w�A'���7�I ���%3�AE!mc[*� �U.���<,cY�Y�2���t��\����
    �)L��08&2] �e� ;
    </ns1:subject>
    <ns1:priority>Default</ns1:priority>
    </ns1:sendMessage>
    </soapenv:Body>
    </soapenv:Envelope>
    Please help me!
    Edited by: sumitbhatnagar007 on Feb 19, 2008 2:38 AM

    Try this 
    http://www.infopathdev.com/blogs/ernesto/archive/2012/01/13/extract-attachments-from-your-infopath-forms.aspx
    As far as I know, there isn't anything built into either SharePoint or InfoPath to do this; you would have to write code. Take a look at this article http://support.microsoft.com/kb/892730 for
    how to decode the base64 encoded string of an attachment. If you're using VB.NET, you can take a look at this InfoPath newsgroup threadhttp://groups.google.com/group/microsoft.public.infopath/browse_thread/thread/310fca090e9f708f/81376114cd5ee732?hl=en&lnk=gst&q=attachment+disk+infopath#81376114cd5ee732
    Once you've decoded the attachment, you can use either the WebClient class (if you're extracting from outside of SharePoint) or classes of the SharePoint Object Model (if you're extracting from somewhere inside of SharePoint) to upload the binary data
    as a file to a SharePoint document library.
    There are several ways to retrieve the form and extract the attachment; it all depends on your requirements and at which moment you want to do the extraction. You could use for example an ItemAdded event handler in SharePoint on the form library to do the extraction
    as soon as the form has been added to the form library. You could also extract after the fact by creating a utility program (outside of SharePoint) that would retrieve all forms in a form library and do the extraction.
    If this helped you resolve your issue, please mark it Answered. You can reach me through http://itfreesupport.com/
    If this helped you resolve your issue, please mark it Answered. You can reach me through http://itfreesupport.com/

  • Attachment from VA02 to be copied to VF01?

    Hi Friends,
    The user wishes to attach any kind of document in sales document. I had achieved the same by adding parameter u201CSD_SWU_ACTIVEu201D to the user id. After which I was able to attach document via VA02 and VA03.
    Now the user wants the same document to get copied in to the invoice. What does it take to make attachment from VA02 to be copied to VF01?
    Do you have any idea on how to achieve this functionality.
    Thanks in advance.
    Br,
    Raj.

    HI PJ,
    I have discussed the issue with my business. They actually want to send the attachment to the customer, along with invoice output (which is already being sent as PDF file throug Email).
    They want any of the two points below:
    Either the attachment should get copied from the order to invoice, and then the same should be sent to the customer along with invoice ouput.
    or
    Even if the attachment is not copied from sales order to invoice, they want it to be there in the mail which is sent to the customer. The mail at the moment contains PDF file  (which is nothing but basically invoice output).
    Hope my requirement is clear.
    Thanks for the help.
    Br,
    Raj.

  • Launch an attachment from SWF embedded in PDF

    Goal: To launch a PDF attachment from the embedded SWF (in PDF).
    Scenario: I have created a PDF with a SWF embedded in it and I have few attachments also in the same PDF. Now based on some user input I want to open one of the attachment in the PDF.
    Question: How do I open an attachment (in PDF) from a SWF embedded in the same PDF.
    Any help will be a big help :).
    Cheers !!

    First, you can only do this with Acrobat 9. Older methods for embedding SWF's didn't allow for this level of communication between the SWF and the PDF.
    Second, to do it, you would add some ActionScript to your SWF that would use the hostContainer methodology to connect to the PDF and then use the appropriate JS methods.

  • Attachments and instance size ? (Attaching from Global Create)

    Is it true that if you want to allow users to make attachments from Global Create, you must set your "MAX Instance Size" to be at least as big as the Attachments coming in?
    In Global Create, if you want to allow user to make attachments, it seems (from the documentaiton and the sample projects) that you must have an argument to recieve the binary data, and a corresponding instance variable to which it is mapped to. Then after the Begin activity, you can create the attachment using the instance variable.
    Is there some other way to do this without instance variables holding the binary data?
    Also, making the instance variable "SEPARATED" is not a solution, because there is a max size of 2Mb on separated instance variables. I am anticipating attachments up to 100Mb
    Edited by bcespinola at 09/21/2007 8:15 AM

    Manoj,
    We found a workaround that works in Studio workspace. We are getting ready to deploy it to our ALBPM server and test it there.
    Workaround:
    Instead of passing attachment (binary data and file names) to process via Process Arguments, then mapping the arguments to instance variables, then creating attachment from instance variables, we use the Fuego.Io.BinaryFile.
    there are 2 methods on this we use:
    1) writeFromBinaryTo
    2) readToBinaryFrom
    So from the screenflow in the global create, we have screenflow level variables receiving the binary data and filenames from the posted JSP. In the screenflow, we then use "writeFromBinaryTo" method of BinaryFile object and for the 'name' paramter, provide a full path on the server to where we want the file written.
    then we pass a string containing the file's full path as an argument to the process, mapped to an instance variable.
    Then, after instance is created, we have an automatic that uses local a variable (not instance variables) to hold Binary data and filenames. We then use "readToBinaryFrom" method of BinaryFile object, again using the string containing the full path to the file on the server, as the "name" parameter to the method. This method returns a object represting the binary data. then you can use the "create attachment" code, passing in the binary data and file name to create the instance attachment.
    Finally, we do some cleanup by deleting the file that was uploaded to the server (delete method of Fuego.File)
    So in summary, instead of passsing the filename and binary data as arguments to the process, we basically are using fuego object to do a file upload to the server, then after instace created, we get reference to file on server and create attachment from there. Now our instance size can be small, but process can still handle large attachments.
    Hope that helps.
    Edited by bcespinola at 10/03/2007 6:11 AM

  • Deleted the recently added section from the source area how can i add back

    how can i add back the recently added section from the source without reinstalling itunes thanks in advance....
    insp 8100   Windows XP  

    Ok that is easy.
    1) File > New Smart Playlist.
    2) Make sure match the following rule is checked
    3)The first drop down change to date added.
    4)Set the second drop down setting
    5) Enter the number you want based on step 4
    The rest of the check marks are up to you but make sure "Live Updating" is checked.
    Take some time playing around with the smartlists. I love them!! I have a 2 level smartlist at work, I hardly use the regular playlists.

  • Send mail with attachment from the uploaded file

    hi,
    From a form thread i got the following code to send mail with attachment with the file uploaded from the file upload ui element.
    public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionLoadFile(ServerEvent)
         WDWebResourceType FileType = null;
         String FileName = new String();
              //get attribute info for context attribute 'FileUpload'
              IWDAttributeInfo attributeInfo =
                   wdContext.getNodeInfo().getAttribute(
                        IPrivateEmailView.IContextElement.FILE_UPLOAD);
              //get modifiable binary type from the attribute info,requires type cast.
              IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
              IPrivateEmailView.IContextElement element =
                   wdContext.currentContextElement();
              //if a file in the 'FileResource' attribute exists
              if (element.getFileUpload() != null) {
                   try {
                        String mimeType = binaryType.getMimeType().toString();
                        byte[] file = element.getFileUpload();
                        //get the size of the uploaded file
                        element.setFileSize(this.getFileSize(file));
                        //get the extension of the uploaded file
                        element.setFileExtension(binaryType.getMimeType().getFileExtension());
                        //NOTE: context attribute 'FileName' must not be set
                        //because the FileUpload-UI-element property 'fileName'
                        //is bound to it. Consequently the fileName is automatically
                        //written to the context after file upload.
                        //report success message
                        wdComponentAPI.getMessageManager().reportMessage(
                        IMessageEmailComp.SF_UPLOAD,
                             new Object[] { binaryType.getFileName()},
                             false);
                        FileType = binaryType.getMimeType();
                        FileName = binaryType.getFileName();
                   } catch (Exception e) {
                        throw new WDRuntimeException(e);
              //if no file in the 'FileResource' attribute exists
              else {
                   //report error message
                   IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                   msgMgr.reportContextAttributeMessage(
                        element,
                        attributeInfo,
                        IMessageEmailComp.NO_FILE,
                        new Object[] { "" },
                        true);
              //clear the FileResource context value attribute
              //element.setFileUpload(null);
              String URL;
              URL = this.CreateAndGetPathFileUpload(
                                  wdContext.currentContextElement().getFileUpload(),
                                                      FileName);
    //          if (URL.length() == 1){
    //               //ERRORE
         wdContext.currentContextElement().setPATHFileUploaded(URL);
        //@@end
      public boolean send( java.lang.String subj, java.lang.String mess, java.lang.String dest, java.lang.String attach, java.lang.String FileName )
        //@@begin send()
         InitialContext ctx = null;
         Address[] address = null;
         Message msg = null;
         Session sess = null;
         MimeBodyPart bodyPart = null;
         Multipart mp = null;
         // "141.29.193.71" == milvl2ja.icn.siemens.it (SMTP di Siemens)
           try {
              Properties props = new Properties();
              props.put("domain","true");
              ctx = new InitialContext(props);
              sess = (Session) ctx.lookup("java:comp/env/mail/MailSession");
              msg = new MimeMessage(sess);
              IWDClientUser utente = WDClientUser.getCurrentUser();
              String senderEmail = utente.getSAPUser().getEmail();
              InternetAddress addressFrom = new InternetAddress(senderEmail);
              msg.setFrom(addressFrom);     
              String EmailDEST = dest;
              InternetAddress addressTo = new InternetAddress(EmailDEST);
              msg.setRecipient(Message.RecipientType.TO, addressTo);
              msg.setSubject(subj);
    //          if ((mess != null) && (mess.length()>0)) {
    //                 msg.setContent(mess, "text/plain");
    //            } else {
    //                 msg.setContent("", "text/plain");
              //Gestione ATTACHMENT...
              String attachedFileName = new String(wdContext.currentContextElement().getFileName());
              boolean hasAttachment = (attachedFileName != null) && (attachedFileName.length() > 0);
              boolean isMultiPart = (mess != null) && (mess.length() > 1);
              //adding an attachment makes the message multipart
                 if (isMultiPart || hasAttachment) {
                    mp = new MimeMultipart();
                    // add text parts
                      if (mess != null) {
                         for (int i = 0; i < mess.length(); i++) {
                           bodyPart = new MimeBodyPart();
                           bodyPart.setContent(mess,"text/plain");
                           mp.addBodyPart(bodyPart);
                    //attach the file to the message if needed
                    if (hasAttachment) {     // avoid the case with no text parts
                         bodyPart = new MimeBodyPart();
                           bodyPart.setContent("Allegato incluso nel messaggio.","text/plain");
                           mp.addBodyPart(bodyPart);
                           // the part with the file
                           FileDataSource fds = new FileDataSource(attach);
                           MimeBodyPart attachmentBodyPart = new MimeBodyPart();
                        attachmentBodyPart.setDataHandler(new DataHandler(fds));
                        //URL URLattachedFileName = new URL(attach);
                        //attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
                           attachmentBodyPart.setFileName(FileName);
                           mp.addBodyPart(attachmentBodyPart);
                    msg.setContent(mp);
                 } else {
                    if ((mess != null) && (mess.length() > 0)) {
                         msg.setContent(mess, "text/plain");
                    } else {
                         msg.setContent("", "text/plain");
              //fine ATTACHMENT 
              msg.setSentDate(new GregorianCalendar().getTime());
              msg.saveChanges();
              address = msg.getAllRecipients();
              Transport.send(msg, address);
           } catch (Exception e) {
                 e.printStackTrace();
                 return false;
           return true;
        //@@end
    When i used the same code in my application i am gett ing error in many places..
    1)FileDataSource fds = new FileDataSource(<b>attach</b>);
    attach cannot be resolved
    2)attachmentBodyPart.setFileName(<b>FileName</b>);
    fliename cannot be resolved
    3)byte[] file = element.getFileUpload();
    type mismatch cannot convert sting to byte[]
    4)element.setFileSize(this.getFileSize(file));
    method getFileSize() is undefined
    5)element.setFileExtension(binaryType.getMimeType().getFileExtension());
    method getFilExtension() is undefined
    6)URL = this.CreateAndGetPathFileUpload(wdContext.currentContextElement().getFileUpload(),FileName);
    method CreateAndGetPathFileUpload() is undefined.
    7)wdContext.currentContextElement().setPATHFileUploaded(URL);
    from the above error i can understand that only i have got the part of the code.
    Please send me the complete coding.
    some method definitions are missing....
    Please help me to send the mail with attachment from the file uploaded from the file upload ui element.
    Thanks in advance,
    shami.

    hi,
    I got this from the following link
    Re: Attaching an excel file
    plz help me ...
    I am using 2004s with nwds 7.0.06.
    also tell me what should be the type of the context variable FileUpload
    Thanks in advance,
    shami.

  • Our etext output needs a combination of XML tags from multiple levels

    Our etext output needs a combination of XML tags from multiple levels. Each unique combination of <OutboundPayment>/<Payee>/<SupplierNumber> and <OutboundPayment>/<DocumentPayable>/<ReferenceNumber> needs to be on a unique line. That means we need to combine information from different levels into a single e-text line before there is an end of record.
    Right now, it pulls the supplier number for the first invoice and matches it up to the proper line, but each line after that just repeats the supplier number it pulled the first time and uses that on each line matched to the different invoices instead of looping back and picking up the correct supplier associated with each invoice in the Format Payments Instructions.
    I have Oracle Support trying to resolve this in an SR, but so far they have made no progress. Has anyone else done this before? What command do I need to use to combine these two levels into one line of output.
    If I create a header line just above the detail line just for the supplier number it gives me exactly what I need, but on two lines in the etext output. I need it all on a single line.
    Thanks.

    If anyone needs the solution, I finally have it:
    I created a level for grouping criteria as PaymentReferenceNumber/Payee/Address/AddressName, DocumentInternalIDSegment2, called InvoiceDetailLevel. The base level is OutboundPayment.
    I then added a level (InvoiceDetailLevel) between OutboundPaymentInstruction and the DocumentPayable level.
    Then in the syntax for the supplier number and the address I entered this in the Data column:
    ../../ OutboundPayment/Payee/SupplierNumber
    and
    ../../ OutboundPayment/Payee/Address/AddressName
    That did the trick and now it is working correctly on every line, looping back to get the proper information.

  • Adding attachment via File browse not working

    Hi, I'm using Apex 4.1.1 through GlassFish server 3.1.1. Recently I've imported my database application and after running my app, adding of an attachment isn't working anymore. Before I used Apex via Emb. PL/SQL Gateway(from which I've exported app sql) and everything worked just fine. My code for adding attachment is like this:
    IF (:P2_ATTACHMENT IS NOT NULL)
    THEN
    INSERT INTO ATTACHS
    (ID_ATACHMENT,NAME_ATTACH, TYPE_ATTACH, ATTACHMENT, DATE_ATTACH)
    SELECT ID,NAME, mime_type,blob_content, sysdate
    FROM wwv_flow_files
    WHERE NAME = :P2_ATTACHMENT;
    DELETE wwv_flow_files
    WHERE NAME = :P2_ATTACHMENT;
    :P2_ATTACHMENT := NULL;
    END IF;
    If I skip this piece of code, and try to submit page(where is also couple of other insert statements), then is ok.
    What is the problem of this, GlassFish, wwv_flow_files table, apex listener...?
    Thanks.

    Hi,
    >
    isn't working anymore.
    >
    Do you get an error? What diagnostic details do you have? E.g. what do see in View Debug if you run the page in Debug mode?
    Prima facie, there is nothing wrong in the code or in the infrastructure.
    Regards,
    PS: Please post code in &#123;code&#125; tags.
    Edited by: Prabodh on Jun 21, 2012 5:00 PM

Maybe you are looking for

  • Server 2012 Failover Cluster No Disks available / iSCSI

    Hi All, I am testing out the Failover Clustering on Windows Server 2012 with hopes of winding up with a clustered File Server once I am done.  I am starting with a single node in the cluster for testing purposes; I have connected to this cluster a si

  • Video calling with kindle fire

    I cannot get this to work! I can't find my contacts how to call and no one can call me. It just keeps routing me back to my profile or to no where screens telling me to get skype.

  • Extract all DDL of all dbms_jobs

    Hi , We did export and import of all the schemas , But it didnt import all the dbms_jobs. So we have to do it manually , Is there any simple way to extract DDL of all the Jobs. Regards Kumar

  • Frm-40665

    hi i am working on my test server with database release 2 with the same configurations my production server is working in release 1. here, in release 2, i get frm:40665 sql error forced rollback clear screen and reeneter transactions. i have not done

  • SAP BI Ceritification (C_TBW45_70 - Associate level)

    Asking for copyrighted material is prohibited ... and if you want to know about certification - please search the forums for the same Dear Experts,    I want to take the SAP BI Certification test for Associate Level (C_TBW45_70); however, I still don