Attaching file to Web Service

I have the this code inside my web method:
MessageContext context = null;
Message responseMessage = null;
SOAPBody responseBody = null;
SOAPEnvelope responseEnvelope = null;
SOAPElement responseElement = null;
context = MessageContext.getCurrentContext();
if( context!=null )
responseMessage = context.getResponseMessage();
if( responseMessage!=null )
try {
responseBody = (SOAPBody)responseMessage.getSOAPBody();
} catch (SOAPException e) {
try {
responseEnvelope = responseMessage.getSOAPEnvelope();
} catch (AxisFault e) {
AttachmentPart attachPart = null;
DataHandler dh = new DataHandler( new FileDataSource("C:/t1.txt"));
attachPart = (AttachmentPart)responseMessage.createAttachmentPart(dh);
attachPart.setContentId("attachment-1");
responseMessage.addAttachmentPart(attachPart);
But a I have this error:
java.lang.RuntimeException: No support for attachments
Help me :(

I've just struggled though the same problem.
The Exception handling and logging around this area is a bit dodgy.
Ensure that you have:
-javax.activation.DataHandler (activation.jar)
-javax.mail.internet.MimeMultipart (mailapi.jar)
in your classpath.
If the code cannot find these classes, it thows an exception which is silently handled...

Similar Messages

  • Download a XML file from Web Services Using Flex

    Hi All...
    I am new for flex, im developing a windows application using Flex/Air, i have connected the web services with user authentication, now I want to download a xml file using web services in flex,
    how can i do this?? please reply...
    Thanks in advance
    Vasanth

    Hi All....
    I have done this myself using sample tutorials...
    here is the code for your reference guys
              plyLoginName = txtEmailIdDownload.text;                
                     var urlpath:String = new String("your url p?LoginName=");
                    urlpath = new String(urlpath.concat(plyLoginName));
                    urlpath = new String(urlpath.concat("&PlayerType="));
                    urlpath = new String(urlpath.concat(chkseasonvalue));
                    Alert.show(urlpath);
                var request:URLRequest = new URLRequest(urlpath)
                var fileRef:FileReference = new FileReference();           
                fileRef.download(request,"yourfilename.xml");
                Alert.show('File downloaded Successfully');   
                 txtEmailIdDownload.text = "";
                txtPWDownload.text = "";
    thanks
    Vasanth

  • Unable to Find the Type Mapping Resource File (Two web services)

    Hello,
    I am using BEA weblogic 7.0 to deploy my applications. I have a web service and was able to deploy it sucessfully. I am trying to access this web service from another web service previously succesfully deployed too. When I call the second one, I have the next problem:
    java.io.IOException: unable to find the type mapping resource file for:tuoprec.sinsesion.TuOPRecService
    at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegistry.java:62)
    at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
    at tuoprec.sinsesion.TuOPRecService_Impl.<init>(TuOPRecService_Impl.java
    I put the client jar file (2nd web service) obtained from the <clientgen> in the class path of the ear file (1st web service), but I have the same error.
    Can anybody help me?,
    jose luis

    Hello,
    I am using BEA weblogic 7.0 to deploy my applications. I have a web service and was able to deploy it sucessfully. I am trying to access this web service from another web service previously succesfully deployed too. When I call the second one, I have the next problem:
    java.io.IOException: unable to find the type mapping resource file for:tuoprec.sinsesion.TuOPRecService
    at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegistry.java:62)
    at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
    at tuoprec.sinsesion.TuOPRecService_Impl.<init>(TuOPRecService_Impl.java
    I put the client jar file (2nd web service) obtained from the <clientgen> in the class path of the ear file (1st web service), but I have the same error.
    Can anybody help me?,
    jose luis

  • File to Web service (SOAP) to File scenario with out BPM in PI 7.1

    Hi All,
    I have scenario File to Web service (SOAP) to File scenario with out BPM.i am getting the below error:
    1) Error MP: unexpected exception caught com.sap.aii.af.service.cpa.impl.exception.CPAObjectKeyException: Value of key must not be null: ObjectId
    2) Error ROB: error during processing: com.sap.aii.af.lib.mp.processor.ModuleProcessorException: Processing Error
    PI server is 7.1 with SP:8
    I have configured the scenario like this
    1) 2 File channels - Sender & Receiver ,1 RFC channel - Receiver. We need to note that, the additional Module parameters need to be added only for sender File channel
    2) Created Sender Agreement
    3)Created Receiver Determination
    4)Created Interface Determination
    5)Created Receiver Agreement
    Regards,
    Ramesh

    Hi,
    Thanks for your reply!!
    My Scenario is File to SOAP to File.
    Configred modules  in Sender channal below:
    Prcessing sequence:
    Number       Module Name                                        Module Key
    1..........       AF_Modules/RequestResponseBean.......1
    2..........       CallSapAdapter..........................................2
    3..........       AF_Modules/ResponseOnewayBean.......3
    Module Configuration:
    Module Key                                       Parameter Name                                       ParameterValue
    1                                                        passThrough                                            true
    3                                                        receiverChannel                                       receiverChannel name
    3                                                        receiverService                                        receiverService name
    please tell any more confiration requered.
    Regards,
    Ramesh

  • How to download a file via web service in Windows Phone 8.1?

    My project just got 2 part.
    1.Pivot app
    2.Webclient server (provide data for pivot app the view the data)
    My concert that how do i do a download button to download a file via web services in to isolated storage.
    urgent!

    something like this:
    public async System.Threading.Tasks.Task DownloadFile()
    using (var client = new Windows.Web.Http.HttpClient())
    var stream = await client.GetInputStreamAsync(new System.Uri("http://urltomyfile"));
    var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("myfile.txt", CreationCollisionOption.GenerateUniqueName);
    using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
    IBuffer buffer = new Windows.Storage.Streams.Buffer(1024);
    while ((buffer = await stream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None)).Length > 0)
    await fileStream.WriteAsync(buffer);
    await fileStream.FlushAsync();
    how is your webservices offering the file?
    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

  • File to Web Service - No back system in hoplist

    Hi guys
    I've implemented a File to Web service Scenario with XI. The file is picked up from the server.
    The message monitoring in the Runtime Workbench shows the following error:
    "XI-Systemfehler erhalten. ErrorCode: NO_BACK_SYSTEM_IN_HOPLIST ErrorText: ErrorStack: Legacy system to which acknowledgment message is to be sent is missing in hoplist (with wasread=false)"
    Has anybody a clue?

    Hi Gokhan,
    please go thru the links below and see if u have followed the steps mentioned in it while defining the web service..if it still doesnt help you, pleease do let me know.
    http://help.sap.com/saphelp_erp2004/helpdata/en/31/daa0404dd52b54e10000000a1550b0/content.htm
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    /people/david.burdett/blog/2005/01/28/why-using-web-services-for-b2b-is-hard-to-do
    /people/dj.adams/blog/2004/06/24/forget-soap--build-real-web-services-with-the-icf
    /people/renald.wittwer/blog/2005/01/05/develop-a-web-service-that-sends-an-email
    I hope the info provided will help you to atleast some extent solve your problem.
    Regards,
    abhy

  • Problem while attaching file to create service notification(IW51) iView

    Hi,
    We are using Create Service Notification (IW51) transaction iView (SAP GUI for HTML) in one of our portal workset.
    Few users are facing issue while trying to attach file to the Service Notification. When they open the file dialogue to attach the file
    it keeps on spinning and hangs, nothing proceeds further. Does anyone faced similar issue if so can you provide solution for this?
    Regards,
    Abhiram.

    Hi,
    Check the users experiencing issues java runtime on their systems. The file system object uses the JRE. Also check that if the java runtime is up-to-date and of teh same version whose systems are working, that their browser security setting as well as trusted sites have been configured correctly.

  • Unable to attach file to create service notification(IW51) transactio iView

    Hi,
    We are using Create Service Notification (IW51) transaction iView (SAP GUI for HTML) in one of our portal workset.
    Few users are facing issue while trying to attach file to the Service Notification. When they open the file dialogue to attach the file
    it keeps on spinning and hangs, nothing proceeds further. Does anyone faced similar issue if so can you provide solution for this?
    Regards,
    Abhiram.

    << Do not post the same question across a number of forums >>

  • Trasport file by web services

    hi sdn boys
    i have a problem.
    i have a abap program that trasfer a file to server, than this file is put on a web page.
    now i must download the file using web services.
    it 's possible and How can I do?
    thanks

    Hello everyone.
    I have the same problem like it is described in the first post.
    I create a Web Service and also in WSADIMN my Service doesn’t appear.
    When I go to WSCONFIG it is not possible for me to save the created (press F5) Web Service. It seems that it is not possible for me to save in the whole system. Doesn’t matter what I do, the save button is disabled.
    I extend my license and I specify as user “student” and not “developer”. Could that be the problem?
    Anyone an Idea
    Thx a lot

  • File upload - web services

    Hello All,
    I have to upload a file through web services...The file has content type: text/plain and can have max size - 7 MB...
    I tried converting the file into byte[] and send it over the web services ..it is working fine for small files but it hangs for large files...
    Please help...Help is greatly appreciated
    Thanks....

    Hai,
    I'm looking to upload file(pdf/doc) with size limitation less than 500KB using web service and store the file as an blob in the Oracle DB. Please help me if you used any similar approach in your project. I would appreciate your help/suggestions.
    Thank you for your time
    Regards
    VK

  • How to create a proxy to retrieve the xml file from web services

    Hi Every one,
    We have a requirment where we receive a xml file from Kenexa, a third party HR tool using a middleware tool. from SAP side We have to create a proxy to retrieve the xml  file from web services by initiating call through middleware tool i used earlier.
    these are the steps i intend to follow to accomlish the requirement.  
    1) middleware tool has to initiate the call to kenexa web services to  receive the xml file when it is available.
    2) On SAP we need to create a ABAP Proxy service provider to middleware where this file can be received.
    Can any one guide me how i can create a proxy to retrieve the xml  file from web services by initiating call through other middlewre (its not PI). 
    Any help would be really great, i am not a ABAP developer, so please help me with this. Thanks.

    Thank for reply.
    The computers are in different locations, but yes it's possible, the users in this enviroment are all local administrator of the machines, and we can distribute the script centrally from the DC automatically
    Acrobat use Java, right? I'm not so expert in java, but something about it could not be so difficult to manage.
    Do you know some place where i can get some info about JS and acrobat?

  • Sending audio files through web service

    Hi,
    How can we send audio (mp3,wmv) files through web services ? i have tried making a byte array of the file and then sending the byte array through the web service, but it give OutOfMemory error. so is there any better and practical way of doing it ?

    Just read catalina.bat and find where $JAVA command is called, for NT it should be "%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% "
    "%_EXECJAVA% is java
    %JAVA_OPTS% and %CATALINA_OPTS% are enviroment parameter for java command. Just added one of them in your case.
    By the way, " i am using a HP PDA on the client side, so i cannot increase the JVM heap size there", you should info. the client, otherwise the client may be get "out of memory".

  • Down-/Upload files via Web Services using a NON-SAP system!?

    Hello,
    is it possible to down-/upload files via web services using a NON-SAP system!?
    Regards,
    Jens

    Hi Jens,
    I am not sure about your requirement here. What i could understand is that you want to check whether service could handle file processing?
    1) Uploading file - You can build a Webservice which has import/export parameters as the file structures and implement the proxy class in such a way that the passed data is written to application server.
    2) Downloading file - Same as uploading file, but the proxy class would have the code to extract data from the application server and pass them as output parameter.
    Functionality of Non SAP system: The system which calls these services should be able to convert the output of proxy data into file in case of downloading the file and it should be able to convert the file data into export parameters in case of uploading file.
    Hope this helps.
    Regards,
    Prasanna

  • How to pass .txt file as an attachment to the web service (SOAP Attachment)

    Hi,
    I am creating web service using NetBeans 6.5 IDE and JAX-WS. I create a web application and then create web service using provided interface. I want to add .txt file as an attachment/parameter to the web service operation using "Add operation" interface. Don't want to add as an attachment to the SOAP message by creating it explicitly. IDE generates SOAP request and response automatically when the service is tested using "Test Web service" option. How can I add attcahment when I add operation so that it will appear in the generated SOAP message ?
    TIA.

    Hi AnitaDP,
    Attachment doesn't work in web service. You have to pass the content of the text file as a String or as an array of bytes to a method of your web service. From there, you may save the passed data in a file.

  • Setting the attachment name in web service call scheduleReport

    Hi there,
    I searched the forum for this, found lots of threads but no useful solution...
    I am using BI Publisher 10.1.3.4.1 and I need to send a PDF report by email using its web service functionality. This works fine but the report is attached as "attachment.pdf" which is far from ideal. Is it possible to specify what the attachment should be called (e.g. "veryimportantreport.pdf")
    See below an example of the web service call I am doing.
    Thanks
    Luis
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:pub="http://xmlns.oracle.com/oxp/service/v11/PublicReportService"
          xmlns:pub1="http://xmlns.oracle.com/oxp/service/PublicReportService">
       <soapenv:Header/>
       <soapenv:Body>
          <pub:scheduleReport>
             <pub:scheduleRequest>
                <pub:cronExpression></pub:cronExpression>
                <pub:deliveryRequest>
                   <pub:contentType>pdf</pub:contentType>
                   <pub:documentData></pub:documentData>
                   <pub:emailOption>
                      <pub:emailBody>Message body</pub:emailBody>
                      <pub:emailFrom>[email protected]</pub:emailFrom>
                      <pub:emailReplyTo>[email protected]</pub:emailReplyTo>
                      <pub:emailServerName>emailserver</pub:emailServerName>
                      <pub:emailSubject>Subject</pub:emailSubject>
                      <pub:emailTo>[email protected]</pub:emailTo>
                   </pub:emailOption>
                </pub:deliveryRequest>
                <pub:reportRequest>
                   <pub:reportAbsolutePath>/Order/Order.xdo</pub:reportAbsolutePath>
                   <pub:attributeFormat>pdf</pub:attributeFormat>
                   <pub:parameterNameValues>
                      <pub:item>
                         <pub:name>P_ORDER_ID</pub:name>
                         <multiValuesAllowed>false</multiValuesAllowed>
                         <pub:values>
                            <pub1:item>123</pub1:item>
                         </pub:values>
                      </pub:item>
                   </pub:parameterNameValues>
                </pub:reportRequest>
             </pub:scheduleRequest>
             <pub:userID>luis</pub:userID>
             <pub:password>luis</pub:password>
          </pub:scheduleReport>
       </soapenv:Body>
    </soapenv:Envelope>

    mdonohue wrote:
    Sorry, product currently does not provide a way to name the attachment. I have entered an enhancement request to get that into a future release.That is a bit disappointing but thanks for letting me know!
    We are using BIP to generate reports from Apex and it works very well, except for this small detail.
    By the way, you sound very sure; are you related to Oracle in any way (I mean, is this an "official" answer)? I can't tell from your profile...
    Cheers
    Luis

Maybe you are looking for

  • FI Open Interface (BTE) vs FQEVENTS

    Hi, My understanding is that FQEVENTS transaction is only active for FICA (contract account). Please correct. Is this also available for FI-AP? If FQEVENTS is not available for FI-AP, we then need to use BTE (Business Transaction Evetnts-FIBF). I hav

  • OIM 9.1.0.2 Upgrade issue/ Loading metadata into the database

    I am getting the following error when I try to execute LoadXML_XACM.bat jdbc:oracle:[email protected]:1521:orcl oimuser oimuser Unable to load XML in REP where REP_CODE = UserProfileHistory java.sql.SQLException: invalid Oracle URL specified My tnsna

  • Get Guid of service order from Document nos !

    Hello, Can anybody tell me the function module which will import Document nos of service order and return me the Guid of that document. Similarly i need function module which would accept document nos and return me the process type. I know its direct

  • Receiver Mail adapter - mail package - mail not received

    Hi guys! I'm using receiver mail adapter and when I want to use Mail Package (subject is assign dinamically based on mapping) I do not receive the e-mail. When I switch to not using Mail Package, the mail is sent correctly.. In RWB everything seems t

  • Triggers or Programs, which is better?

    Hello, I have a simple question, say, I have 40Mil records to process or even higher and which is better, to have the functions in a program that reads the database or as a database triggers with functions? How good is Oracle to process 200Mil record