Web Services Attachments

Any advice on the following would be greatly appreciated!
I am trying to send an attachment to CRMOD via a java web service. I am able to create the message fine in Soap UI so I know the encoding is correct and the structure of the message is correct.
My java webservice will send the message but all attachments are interpreted as text. The proxy generator I'm using is axis2. The attachment method is calling for a datahandler and i don't know what to feed it (inputstream, outputstream, bytes, string). String works but is only interpreted as a text document. What shoud be the mime type for the datahandler, I've tried application/octet-stream and text/plain.
I'm using MimeUtility.encode as the encoder but it's cumbersome, is there a better one out there?
I can provide much more specifics if needed, a snip it would be great as well. I've been working on this for over a week. I can't capture the message from axis2 but the debug objects in eclipse look ok.
Thanks,
James

Hi,
this is a new WS Interface released in R15 but there are somelimitation
1. This is exposed only for Activity, you will not find this in other business entity
2. You can's upload the file by using this, u can use this only for URL attachement.
Dinesh

Similar Messages

  • Web Service to Create a Document Info Record with attachments (e.g. PDF)

    Hello guys,
    we are looking forward to create a Web Service that should be able to create a Document Info Record on SAP ERP Application Server. As we don't have installed the SAP Standard Web Services on our SAP ERP ECC 6.0 system we will manually create a Web Service with the help of the standard BAPI_DOCUMENT_CREATE2.
    The current problem is that the Web Service based on the Standard BAPI can not upload Files (PDF or Word files) from the Users Client PC to the Application Server.
    Is there a possibility to Create a Web Service that can handle files and create DIRs on application server?
    Thanks a lot!!
    Regards,
    Christian

    Hello Natallia,
    Well, in this case you don't really need the CV01N transaction. This represents the user interface (UI), and you only need an interface (that is, an API), which in SAP is represented by a BAPI
    I'm not familiar with CRM, but I assume that at some point when saving a Service Contract, you have a BAdI, where you can check the status and insert some custom code.
    So, all you have to do is call BAPI_DOCUMENT_CREATE or BAPI_DOCUMENT_CREATE2 (if available on your installed version), with the required attributes (this can be master data, classification, custom data...). After this function is called successfully, you should receive the document key (DOKAR, DOKNR, DOKVR, and DOKTL). Which you can also save in the Attachments tab.
    Hope this helps,
    Tudor

  • Adding attachments to web service

    Hi,
    I am working on a project which requires me to add pictures as attachments of a web service.
    This is what I do:
    messageContext = endpointContext.getMessageContext();
    SOAPMessageContext soapContext = (SOAPMessageContext) messageContext;
    SOAPMessage msg = soapContext.getMessage();
    //URL url = new URL("file:///attachments/jhe061.gif");
    URL url = new URL("http://www.google.ro/images/hp0.gif");
    DataHandler dataHandler = new DataHandler(url);
    AttachmentPart attachment = msg.createAttachmentPart(dataHandler, "image/gif");
    attachment.setContentId("image/gif");
    msg.addAttachmentPart(attachment);
    According to the J2EE tutorial, an image attachment should be added to the service. On the client side no sign of a multipart is found....
    Could anybody tell me what I do wrong?
    Thanks, d3m0

    Attachment support for webservices is not defined using the mime binding in the
    current jaxrpc1.1 implementation. It is done in an implementation specific manner.
    See the jaxrpc1.1 specfication chapter 7 where it talks about SOAP messages with
    attachments. This is optional functionality in the jaxrpc1.1 release.
    In jaxrpc1.1.2 (a follow on release) support for WS-I Attachment Profile1.0 is
    in this release defined via the wsdl mime binding. You can get this release by
    downloading the JWSDP1.4 release. This contains the required attachment support
    you need for handling attachments in webservices in a portable way. To create
    a webservice with attachments using this release is quite easy. You simply
    define your attachments in your wsdl using the wsdl mime binding. You can send
    attachments to a webservice in the SOAP request by defining the mime binding
    on the operation input and you can get attachments back from the webservice by
    defining the mime binding on the operation output. You will need to look at
    at the WS-I Attachment Profile 1.0 Specification to see how this is done.
    Also look at the documentation and release notes for the JWSDP1.4 release.
    Here is an example of the mime binding for a webservice operation on the
    output.
    <binding name="SwaTestSoapBinding1" type="tns:SwaTest1">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
    <operation name="getMultipleAttachments">
    <soap:operation/>
    <input>
    <soap:body parts="request" use="literal" namespace="http://SwaTestService.org/wsdl"/>
    </input>
    <output>
    <mime:multipartRelated>
    <mime:part>
    <soap:body parts="response" use="literal" namespace="http://SwaTestService.org/wsdl"/>
    </mime:part>
    <mime:part>
    <mime:content part="attach1" type="text/plain"/>
    </mime:part>
    <mime:part>
    <mime:content part="attach2" type="text/html"/>
    </mime:part>
    </mime:multipartRelated>
    </output>
    </operation>
    An example of using attachments in jaxrpc1.1:
    To do attachments in jaxrpc1.1 you can start from java and develop an SEI with
    signatures as follows:
    Sample SEI
    package attachmentstest;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.awt.Image;
    import javax.mail.internet.MimeMultipart;
    import javax.xml.transform.Source;
    import javax.activation.DataHandler;
    import java.util.*;
    // Service Defintion Interface - as outlined in JAX-RPC Specification
    public interface AttachmentsTest extends Remote {
    public Image echoImage(Image v) throws RemoteException;
    public Image[] echoImageArray(Image[] v) throws RemoteException;
    public MimeMultipart echoMimeMultipart(MimeMultipart v) throws RemoteException;
    public MimeMultipart[] echoMimeMultipartArray(MimeMultipart[] v) throws RemoteException;
    public Source echoSource(Source v) throws RemoteException;
    public Source[] echoSourceArray(Source[] v) throws RemoteException;
    public DataHandler echoDataHandler(DataHandler v) throws RemoteException;
    public DataHandler[] echoDataHandlerArray(DataHandler[] v) throws RemoteException;
    Sample Client
    private boolean dataHandlerTest() {
         TestUtil.logMsg("AttachmentsTest:(dataHandlerTest)");
         boolean pass = true;
         DataHandler response;
    try {
    DataHandler dataHandler = new DataHandler(sourceFileURL);
         TestUtil.logMsg("Test request/response of DataHandler ...");
         TestUtil.logMsg("dataHandler="+dataHandler);
         response = port.echoDataHandler(dataHandler);
         if (!(response.getContent().equals(dataHandler.getContent()))) {
              TestUtil.logErr("DataHandler comparison mismatch");
              pass = false;
    } catch (Exception e) {
         TestUtil.logErr("Caught exception: " + e.getMessage());
    TestUtil.printStackTrace(e);
         pass = false;
         printTestStatus(pass, "AttachmentsTest:(dataHandlerTest)");
         return pass;
    private boolean sourceTest() {
         TestUtil.logMsg("AttachmentsTest:(sourceTest)");
         boolean pass = true;
         Source response;
    try {
    Source source = new StreamSource(xmlFileURL.openStream());
         TestUtil.logMsg("Test request/response of Source ...");
         response = port.echoSource(source);
         // Code for comparison here
    } catch (Exception e) {
         TestUtil.logErr("Caught exception: " + e.getMessage());
    TestUtil.printStackTrace(e);
         pass = false;
         printTestStatus(pass, "AttachmentsTest:(sourceTest)");
         return pass;

  • Adding attachments to Web Service call

    Hi
    Does Bea's web service classes include support for adding attachments to the soap message sent by a web service?
    How do I do it? or otherwise, how do I get through the abtraction down to the soap message so I can add it manually?
    I have both a weblogic.webservice.core.rpc.StubImpl and a javax.xml.rpc.Service to work with, I'm guessing it's somewhere deep down in the context of the Service...?

    Hi
    Does Bea's web service classes include support for adding attachments to the soap message sent by a web service?
    How do I do it? or otherwise, how do I get through the abtraction down to the soap message so I can add it manually?
    I have both a weblogic.webservice.core.rpc.StubImpl and a javax.xml.rpc.Service to work with, I'm guessing it's somewhere deep down in the context of the Service...?

  • Calling web services constructed with swaref attachments

    Hi All,
    BPEL has support for attachments, either in MIME or DIME manner.There are attachment examples under BPEL_HOME/samples/demos/Attachment folder.
    Unfortunately, these examples does not cover swaref (Soap with attachment reference) which is widely used for our customers.
    What I would like to ask is:
    Is there any way to call some external systems introducing web services with swaref elements in their interfaces,from BPEL processes?
    When I tried such kind of a web service, I get a remoteFault with summary:
    "Caught exception while handling request: missing cid for attachment"

    If your question is whether a Web service can be accessed from Java by directly progamming on the HTTP level, then the answer is yes.

  • Web Service with attachments (SOAP with attachments) without PI

    Hi,
    Is it possible to send across file(say PDF) using ABAP web services. I know it can be done with Java using SOAP with attachments. Is something similar available for ABAP ? since if we transfer raw binary data as type string / xstring it may have a performance impact.
    I could not see any option for attachments when using web service wizard from SE37 / soamanager
    Note I am not using PI, this Web service would be consumed by a 3rd party tool. There is very little material available on transferring files using web service with SOAP attachments.
    Regards,
    Aditya

    Hi thanks for your input, but did you have to encode your binary data stream in say Base64 / utf-8 ? Also if you are transferring files in bulk(say 10 -100 files)  how does your web  service indicate end of one file or what is the best way so as to avoid performance problems.
    Regards,
    Aditya

  • Future direction of BEA Web Services? - binary / attachments

    Hello,
    I'm looking at needing to transfer binary data through a web service,
    but can't handle the 4/3+ size increase that occurs when embedding the
    data with base64 encoding.
    I know that WL 8.1sp3 support SwA, but that standard is being deprecated
    in favor of newer technologies like Fast Web Services (based on ASN.1
    encoding rules), MTOM/XOP, Basic Attachments Profile.
    We'd prefer to be able to rely on the support of the application server.
    What is BEA's future direction in terms of this technology? Will they be
    supporting one or all of these binary standards? When is the estimated
    date for this technology to be implemented?
    If these technologies won't be implemented for a while, is it possible
    to plug in 3rd party web services solutions into BEA WL8.1 (e.g. Sun's
    JWSDP, Axis, etc)? I believe it is, but am just asking for the sake of a
    full answer.
    Thanks

    Steve,
    Due to BEA's award winning support they offer, I had to figure this out on my own. After weeks of dealing with a support case they provided me with absolutely nothing. Just as they have done in this thread. I will share what I have done for the mean time to get around their limitations using attachments.
    I used the Axis libraries to create a DIME attachment and call a BEA web service. Since BEA doesn't support Dime, a servlet filter had to be implemented and parse the DIME message prior to the web service received it. I'm sending 2GB files with transfer rates of 6MB/S.
    This is a response from BEA's award winning support:
    "We do not have good specification standard as yet as to how to best solve the issue. It appears like a pretty larger issue to solve because of the lack os standards and specification. Engineering is still researching on the issue and we don't know which version will have the fix."

  • Consuming web services with Attachments

    Hello,
    I need to consume a web service with attachements (mime type) from sap was j2ee 7.0 (nw2004s).
    When I try to generate the web service deployable proxy using nwds (version 7.0.06), I get the following error message
    "Invalid WSDL or WSDL not found, please specify different WSDL.."
    Removing references to"wsi:swaRef" from wsdl, above error is not displayd and wsdl is correctly processed
    <complexType name="ArrayOf_tns2_swaRef">
    - <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="swaRef" nillable="true" type="wsi:swaRef" />
      </sequence>
      </complexType>
    Unfortunately, we have not been able to find any SAP documentation (online help, oss note,,,) describing if SAP WAS Java 7.0 supports this standard.
    Has anybody already worked with Web Services with attachments ?
    Thanks in advace,
    Regards
    Berta

    hi berta,
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/ea656273b74cf386a1f29fc55721fd/frameset.htm
    HTTP error 406 when consuming a Web Service with attachment
    let me know u need any further info
    bvr

  • Web Services with Attachments

    Hello,
    I need to consume a web service with attachements (mime type) from sap was j2ee 7.0 (nw2004s).
    Unfortunately, we have not been able to find any SAP documentation (online help, oss note,,,) describing if SAP WAS Java 7.0 supports this standard, or how to generate ws proxies for consuming these web services.
    Has anybody already worked with Web Services with Attachments ?
    Thanks in advace,
    Regards
    Berta

    hi berta,
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/ea656273b74cf386a1f29fc55721fd/frameset.htm
    HTTP error 406 when consuming a Web Service with attachment
    let me know u need any further info
    bvr

  • Java Web Service that accepts DIME attachments?

    Hi guys here's my situation..
    I am required to build a Java webservice that can take a file attachment and various other parameters(I have the parameters bit sorted, and can access them fine using .net's WSE). I need to access this webservice and send the file attachment via a .Net web application. Can anyone please help me by pointing me in the right direction? I've spent hours now trying to google examples, but I cant' really find anything that gives me a clear example on how to create a web service in Java that integrates well with .net when dealing with file attachments. I see things such as Axis (JAX-RPC), SOAP with Attachments, etc.. which one is recommended for this situation?
    for what its worth, I'm using Tomcat 5.5, Eclipse 3.1 with the lomboz plug in and jdk 1.5.5.
    would appreciate some code samples, tutorials, etc..
    Also.. .net is more my comfort zone at present, although I did do some J2EE work for a while about 2 yrs ago, so apologies for not being entirely up to scratch with current java WS technologies.
    Thanks in advance!!..

    CF doesn't support DIME "natively", but Apache Axis does, and that's the library that CF uses. So, you'll have to drop to Java to do this.
    Dave Watts, CTO, Fig Leaf Software
    http://www.figleaf.com/
    http://training.figleaf.com/

  • JDev: Generating Web Services for Streaming Attachments

    Hi,
    I am a newbie in this field. I am trying to generate web service code using JDev (10.1.3.3). I have an interface class and the implementation class. When I am trying to generate J2EE Web Service for the implementation class, I am getting the following error:
    "The selected class doesn't contain any public method publishable in a web service".
    Following is my code:
    Interface:
    package testing;
    import oracle.webservices.attachments.Attachments;
    public interface ImageStore extends java.rmi.Remote {
    public void storeImage (String name, String desc, Attachments attachments) throws java.rmi.RemoteException;
    Impl:
    package testing;
    import java.io.InputStream;
    import javax.activation.DataHandler;
    import oracle.webservices.attachments.Attachment;
    import oracle.webservices.attachments.Attachments;
    import oracle.webservices.attachments.IncomingAttachments;
    public class ImageStoreImpl {
    public static String storeImage(String name, String desc, Attachments attachments) throws Exception {
    IncomingAttachments incomingAtts = attachments.getIncomingAttachments();
    if (incomingAtts == null || !incomingAtts.hasNextAttachment())
    throw new Exception("Expected request attachments");
    Attachment imageAtt = incomingAtts.nextAttachment();
    String id = imageAtt.getId();
    DataHandler dataHandler = imageAtt.getDataHandler();
    InputStream imageStream = dataHandler.getInputStream();
    //-- Store image metadata and stream image bytes
    if (incomingAtts.hasNextAttachment())
    throw new Exception("Expected only one attachment");
    return "success";
    Can someone please let me know how can I generate the web service for this code using JDev.
    Thanks,
    J

    Hi J,
    Why is the concrete class not implementing the ImageStore interface? Anyways, I believe the ImageStoreImpl#storeImage method cannot be static if you want to generate a WS.
    Furthermore, you should consider posting your question in the JDev 10G (JDeveloper and ADF forum as this one is for 11G.
    Olivier

  • Web Services Sending Large Size Attachments - INTEROPERABILITY

    Hi
    I am really interested with Streaming attachments in OC4J.
    But I assume it is not interoperable.
    When I try to use Streaming for my Web Service, i get an error message that my JAX-RPC handler cannot unmarhall the WS operation (I know weird error).
    So it seems that if I want to use Streaming - I have to forget about JAX-RPC handlers (for example logging handler)
    Additionally when you open WSDL (of WS + Streaming) file you will see that there is a xml part which is not a WS-I standard:
    <sa:stream-attachments xmlns:sa="http://oracle.com/schemas/webservices/streaming-attachments" name="attachments"/>
    - and using wsi-test-tools you will get a failure message that it is not
    a part of standard namespace: http://schemas.xmlsoap.org/wsdl/soap/
    So i guess that client of a Web Service with Streaming must be a JAVA client - and additionally with a usage of oracle WS jar libraries.
    So there is a question now, how to enable in OC4J sending big attachments with Interoperability.
    I think using AXIS2 module is not an answer, as it also uses JAX-RPC approach based on DOM xml parsers, which means loading whole attachments into memory (no matter if its MTOM, SwA or Base64Encoding).
    My question is: IS THERE ANY WAY TO SEND LARGE ATTACHMENTS IN OC4J WITH FULL INTEROPERABILITY (maybe some chunk options)?
    Thanks a lot for any answer
    Jerzy

    I don't know of any way to do this from within Mail.app -- the Rules by default only are applied to incoming email & there is no way I know of to apply them to a new message you are composing.
    One (non-automatic) workaround you might find useful is to right or control click on any attachment not shown as an icon in your message & select "View as icon." This will at least show you the size of the attachment.

  • SAAJ API Web Services With Attachments

    I have developed a Web Service and it is running successfully. Now I want to pass attachments to it in the form of SOAP Messages (using SAAJ API). I saw several examples on the web of how to create a request with a SOAP Message and include attachments/body parts in it. But what I cannot understand is how to recieve this message in my web service. I came across an example which used a servlet to recieve the message but I cannot understand how a servlet can be fitted between the web service and the request. I am new to Web Services in Java and would appreciate any help. A detailed tutorial would be great as to how to implement SOAPMessages receiver. I am using Eclipse with Tomcat.

    hi berta,
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/ea656273b74cf386a1f29fc55721fd/frameset.htm
    HTTP error 406 when consuming a Web Service with attachment
    let me know u need any further info
    bvr

  • Running web services on OC4J with attachments problem

    Hi,
    I have problem with running Web Services with Attachment on AS 10.1.3 (SOAP: RCP/LItteral 1.1).
    I generate WS Bottom-Up from java class in Jdeveloper 10.1.3 (3673) :
    package project2;
    import javax.xml.soap.AttachmentPart;
    public class TestWS {
    public TestWS() {
    public String getText() {
    return "testWS text" ;
    public AttachmentPart getAttach() {
    AttachmentPart ap = null ;
    /* try {
    javax.xml.soap.MessageFactory mf = MessageFactory.newInstance();
    javax.xml.soap.SOAPMessage message = mf.createMessage();
    ap = message.createAttachmentPart(attachmentObj,"application/pdf");
    } catch (Exception e) {e.printStackTrace(); return null ;}
    return ap ;
    When testing WS through EM - Web services - Test Web Service, failed with exception:
    500 Internal Server Error
    java.lang.NullPointerException
    at oracle.j2ee.ws.server.WebServiceServlet.displayErrorPage(WebServiceServlet.java:742)
    at oracle.j2ee.ws.server.JAXRPCServlet.doGet(JAXRPCServlet.java:422)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    WS without attachment works fine. Any advice?
    Thx.
    Wollis

    It's probably "web services home page" bug, ws proxy client works fine.

  • Getting Soap Attachments from a Web Services Call

    Hi,
    We are using Studio Creator 2 and we need to connect to a web service that returns an attachment.
    We added the web service in the Servers/Web Services tab, and Creator created the Web Service Client jars automatically.
    The problem is that these classes that were produced does not seem to allow access to the attachment in the response (of the SOAP message).
    It appears that the classes that are generated hides the ability to get at the Soap body or message. Is there any way to get the attachment using the generated client classes, or do we have to create our own set of client classes to call the web service, and extract the attachment?
    Is there any sample code for Creator that calls a web service and then saves an attachment that is returned in the Soap message response?
    Thank you
    Matt

    Here is some general information with examples which you might find useful
    to solve your problem.
    Patterns and Strategies for Building Document-Based Web Services
    http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index5.html

Maybe you are looking for

  • Getting Error while creating ResultSetDynaClass

    Hi, I am getting 'Cannot load column class 'java.lang.String': java.lang.NullPointerException ' while executing the below code ResultSetDynaClass rsdc = new ResultSetDynaClass(resultSet,true);. I have displayed the resultset and am able to get the da

  • Flash Player doesn't work with Windows 8.1

    Just purchased a new computer it has Windows 8.1 on it--Wanted to watch a You Tube video---and it said to update Flash Player--well It doesn't work at all.  Nothing I can do to make it work---any ideas on how I can get this to work--or what ever it t

  • My ipad mini was a gift. Am I still able to buy applecare with no receipt?

    My ipad mini was a gift. Am I still able to buy applecare with no receipt?

  • Why won't external HD open into Finder Window?

    I've got a handful of the palm sized 2 T hard drives here, most of the Western Digital.  They appear on the desktop, with their yellow USB3 icons.  If I double click the icon the hard drive opens into a Finder Window.  All except one drive.  It's the

  • Video and audio problem, please help!

    Every time I stream a video or play a DVD, the video and sound freezes for about ten to twelve seconds continously. It is very irritating and rather inconvenient. Does anyone have any idea why? I just switched to a Mac and am loving it so far. I woul