Send SOAP DIME Attachment (please comment on my sample code)

Hi All,
I had hard time trying to find a send SOAP DIME attachment
code for the web service. And here it is, I wrote one,
but I use to easy way to deploy the service.
I just simply change the extension .java to .jws,
so, can you all tell me whether it will be a problem or not ?
And please review my code below, I debugged and no error,
but I am not sure if it is working right.
Basiclly 2 operations:
public String generateID(int artID)
public File detachFile(String filename)
Please comment on this code, I am trying to make it
more robust, so, that I can redo it and post it to share with
everybody.
thanks,
Derek
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.io.*;
import java.security.*;
import java.security.NoSuchAlgorithmException;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.soap.AttachmentPart;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.attachments.Attachments;
import org.apache.axis.attachments.AttachmentsImpl;
import org.apache.log4j.Logger;
public class AttachmentYPMG
     private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
     public AttachmentYPMG()
     public String generateID(int artID)
          String artid = Integer.toString(artID);
          String md5_hash_string = plainStringToMD5(artid);
          return md5_hash_string;
     private String plainStringToMD5(String input) {
            // Some stuff we will use later
            MessageDigest md = null;
            byte[] byteHash = null;
            StringBuffer resultString = new StringBuffer();
            // Bad things can happen here
            try {
              // Choose between MD5 and SHA1
                   md = MessageDigest.getInstance("MD5");
            } catch(NoSuchAlgorithmException e) {
                System.out.println("NoSuchAlgorithmException caught!");
                System.exit( -1);
            // Reset is always good
            md.reset();
            // We really need some conversion here
           md.update(input.getBytes());
            // There goes the hash
            byteHash = md.digest();
           //  Now here comes the best part
            for(int i = 0; i < byteHash.length; i++) {
              resultString.append(Integer.toHexString(0xFF & byteHash));
          // That's it!
          return(resultString.toString());
     public File detachFile(String filename)
          InputStream is = null;
          FileOutputStream os = null;
          File file = null;
          int totalAttachments ;
          try
               //Get all the attachments
               AttachmentPart[] attachments = getMessageAttachments();
               * getMessageAttachments() as provided by Steve Loughran in his mail
               * to axis-user group
               * http://www.mail-archive.com/[email protected]/msg08732.html
               //Put the logic in a loop for totalAttachments for multiple
               // attachments.
               totalAttachments = attachments.length;
               _logger.debug("saveFile(String filename = " + filename + ") - " +
                              "Total Attachments Received Are: "+ totalAttachments);
               //Extract the first attachment. (Since in this case we have only one attachment sent)
               DataHandler dh = attachments[0].getDataHandler();
               //Extract the file name of the first attachment.
               String name = filename;
               _logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
               //Get the streams to file and from attachment, then stream to disk
               is = dh.getInputStream();
               file = new File(name);
               os = new FileOutputStream(file);
               this.writeBuffersAndClose(is, os);
          } catch (Exception e)
               _logger.error("detachFile(String filename = " + filename + ")", e);
               //throw new AttachmentException(e);
          //if(file!= null)
                    return file;
          //else
               //throw new AttachmentException("The attachment was not saved");
     * extract attachments from the current request
     * @return a list of attachmentparts or an empty array for no attachments
     * support in this axis buid/runtime
     private AttachmentPart[] getMessageAttachments() throws AxisFault
          * Reusing the method implementation for AttachmentPart[]
          * getMessageAttachments() as provided by Steve Loughran in his mail to
          * axis-user group
          * http://www.mail-archive.com/[email protected]/msg08732.html
          MessageContext msgContext = MessageContext.getCurrentContext();
          Message reqMsg = msgContext.getRequestMessage();
          Attachments messageAttachments = reqMsg.getAttachmentsImpl();
          if (null == messageAttachments)
               System.out.println("no attachment support");
               return new AttachmentPart[0];
          int attachmentCount = messageAttachments.getAttachmentCount();
          AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
          Iterator it = messageAttachments.getAttachments().iterator();
          int count = 0;
          while (it.hasNext())
               AttachmentPart part = (AttachmentPart) it.next();
               attachments[count++] = part;
          return attachments;
     * Simple method for writing one stream from another.
     * @param is
     * @param os
     * @throws IOException
     private void writeBuffersAndClose(InputStream is, OutputStream os)
          throws IOException
          int i = 0;
          byte [] buffer = new byte[1024];
          while (i != -1)
               i = is.read(buffer, 0, buffer.length);
               if(i > 0)
                    os.write(buffer, 0, buffer.length);
          is.close();
          os.close();

Hi All,
I had hard time trying to find a send SOAP DIME attachment
code for the web service. And here it is, I wrote one,
but I use to easy way to deploy the service.
I just simply change the extension .java to .jws,
so, can you all tell me whether it will be a problem or not ?
And please review my code below, I debugged and no error,
but I am not sure if it is working right.
Basiclly 2 operations:
public String generateID(int artID)
public File detachFile(String filename)
Please comment on this code, I am trying to make it
more robust, so, that I can redo it and post it to share with
everybody.
thanks,
Derek
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.io.*;
import java.security.*;
import java.security.NoSuchAlgorithmException;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.soap.AttachmentPart;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.attachments.Attachments;
import org.apache.axis.attachments.AttachmentsImpl;
import org.apache.log4j.Logger;
public class AttachmentYPMG
     private static final Logger _logger = Logger.getLogger(AttachmentYPMG.class);
     public AttachmentYPMG()
     public String generateID(int artID)
          String artid = Integer.toString(artID);
          String md5_hash_string = plainStringToMD5(artid);
          return md5_hash_string;
     private String plainStringToMD5(String input) {
            // Some stuff we will use later
            MessageDigest md = null;
            byte[] byteHash = null;
            StringBuffer resultString = new StringBuffer();
            // Bad things can happen here
            try {
              // Choose between MD5 and SHA1
                   md = MessageDigest.getInstance("MD5");
            } catch(NoSuchAlgorithmException e) {
                System.out.println("NoSuchAlgorithmException caught!");
                System.exit( -1);
            // Reset is always good
            md.reset();
            // We really need some conversion here
           md.update(input.getBytes());
            // There goes the hash
            byteHash = md.digest();
           //  Now here comes the best part
            for(int i = 0; i < byteHash.length; i++) {
              resultString.append(Integer.toHexString(0xFF & byteHash));
          // That's it!
          return(resultString.toString());
     public File detachFile(String filename)
          InputStream is = null;
          FileOutputStream os = null;
          File file = null;
          int totalAttachments ;
          try
               //Get all the attachments
               AttachmentPart[] attachments = getMessageAttachments();
               * getMessageAttachments() as provided by Steve Loughran in his mail
               * to axis-user group
               * http://www.mail-archive.com/[email protected]/msg08732.html
               //Put the logic in a loop for totalAttachments for multiple
               // attachments.
               totalAttachments = attachments.length;
               _logger.debug("saveFile(String filename = " + filename + ") - " +
                              "Total Attachments Received Are: "+ totalAttachments);
               //Extract the first attachment. (Since in this case we have only one attachment sent)
               DataHandler dh = attachments[0].getDataHandler();
               //Extract the file name of the first attachment.
               String name = filename;
               _logger.debug("saveFile(String filename = " + filename + ") - File received on server is: " + name);
               //Get the streams to file and from attachment, then stream to disk
               is = dh.getInputStream();
               file = new File(name);
               os = new FileOutputStream(file);
               this.writeBuffersAndClose(is, os);
          } catch (Exception e)
               _logger.error("detachFile(String filename = " + filename + ")", e);
               //throw new AttachmentException(e);
          //if(file!= null)
                    return file;
          //else
               //throw new AttachmentException("The attachment was not saved");
     * extract attachments from the current request
     * @return a list of attachmentparts or an empty array for no attachments
     * support in this axis buid/runtime
     private AttachmentPart[] getMessageAttachments() throws AxisFault
          * Reusing the method implementation for AttachmentPart[]
          * getMessageAttachments() as provided by Steve Loughran in his mail to
          * axis-user group
          * http://www.mail-archive.com/[email protected]/msg08732.html
          MessageContext msgContext = MessageContext.getCurrentContext();
          Message reqMsg = msgContext.getRequestMessage();
          Attachments messageAttachments = reqMsg.getAttachmentsImpl();
          if (null == messageAttachments)
               System.out.println("no attachment support");
               return new AttachmentPart[0];
          int attachmentCount = messageAttachments.getAttachmentCount();
          AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
          Iterator it = messageAttachments.getAttachments().iterator();
          int count = 0;
          while (it.hasNext())
               AttachmentPart part = (AttachmentPart) it.next();
               attachments[count++] = part;
          return attachments;
     * Simple method for writing one stream from another.
     * @param is
     * @param os
     * @throws IOException
     private void writeBuffersAndClose(InputStream is, OutputStream os)
          throws IOException
          int i = 0;
          byte [] buffer = new byte[1024];
          while (i != -1)
               i = is.read(buffer, 0, buffer.length);
               if(i > 0)
                    os.write(buffer, 0, buffer.length);
          is.close();
          os.close();

Similar Messages

  • I just need a little help to connect with eCommerce API. Could anyone please give a JAVA sample code

    Hi All,
    I am looking for a sample code to just to connect with Business Catalyst eCommerce API. My aim is to simply retirieve the list of the products and update them.
    It would be really helpful, if anyone please provide me a sample code in JAVA, just to connect with the API.
    Thanks
    Ani

    public static void main(String[] args) throws RemoteException, MalformedURLException {
                        String endpoint = "https://CC.sys.com/CatalystWebS1ervice/CatalystEcommerceWebservice.asmx?WSDL"; // endpoint url can be found under Site Settings -> API -> click on eCommerce and copy the URL on the browser here.
                        CatalystEcommerceWebserviceSoapProxy sq = new CatalystEcommerceWebserviceSoapProxy(endpoint);
                        Products[] prod = new Products[2];
                        prod = sq.product_ListRetrieve(Username , Password, SiteID, CatalogueID);
                        System.out.println(prod[1].getDescription());

  • What is the Extract statement? Please give me some sample code.?

    What is the Extract statement? Please give me some sample code.?

    Hello ,
    Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT . When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
    Sample program:
    REPORT  ZSPFLI  LINE-SIZE 132 LINE-COUNT 65(3)
                                                 NO STANDARD PAGE HEADING.
    TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
    SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
    FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
    INSERT:
            SPFLI-CARRID
            SPFLI-CONNID
            SFLIGHT-FLDATE
            SBOOK-BOOKID
           INTO HEADER,
            SPFLI-CARRID
            SPFLI-CONNID
            SPFLI-CITYFROM
            SPFLI-AIRPFROM
            SPFLI-CITYTO
            SPFLI-AIRPTO
            SPFLI-DEPTIME
            SCARR-CARRNAME
          INTO SPFLI_FG,
            SFLIGHT-FLDATE
            SFLIGHT-SEATSMAX
            SFLIGHT-SEATSOCC
            SFLIGHT-PRICE
          INTO SFLIGHT_FG,
            SBOOK-BOOKID
            SBOOK-CUSTOMID
            SBOOK-CUSTTYPE
            SBOOK-SMOKER
           INTO SBOOK_FG.
    SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
      SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
      EXTRACT SPFLI_FG.
      SELECT * FROM SFLIGHT
       WHERE CARRID = SPFLI-CARRID AND  CONNID = SPFLI-CONNID.
        EXTRACT SFLIGHT_FG.
        SELECT * FROM SBOOK
               WHERE CARRID = SFLIGHT-CARRID AND
               CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
          EXTRACT SBOOK_FG.
          CLEAR SBOOK.
        ENDSELECT.
        CLEAR SFLIGHT.
      ENDSELECT.
      CLEAR SPFLI.
    ENDSELECT.
    SORT.
    LOOP.
      AT SPFLI_FG.
        FORMAT COLOR COL_HEADING.
        WRITE: / SCARR-CARRNAME,
                 SPFLI-CONNID, SPFLI-CITYFROM,
                 SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
        FORMAT COLOR OFF.
      ENDAT.
      AT SFLIGHT_FG.
        WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
                   SFLIGHT-SEATSOCC.
      ENDAT.
      AT SBOOK_FG.
        WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
                     SBOOK-CUSTTYPE, SBOOK-SMOKER.
      ENDAT.
    ENDLOOP.

  • How to use the LAN NetStream for peer transmission, please help, write a sample code

    How to use the LAN NetStream for peer transmission, please help, write a sample code

    No reply, I reply, Oh

  • Certificate based authentication with sender SOAP adapter. Please help!

    Hi Experts,
       I have a scenario where first a .Net application makes a webservice call to XI via SOAP Adapter. Then the input from the .Net application is sent to the R/3 system via RFC adapter.
    .Net --->SOAP -
    >XI -
    >RFC -
    R/3 System
    Now as per client requirement I have to implement certificate based authentication in the sender side for the webservice call. In this case the .Net application is the "client" and XI is the "server". In other words the client has to be authenticated by XI server. In order to accomplish this I have setup the security level in the SOAP sender channel as "HTTPS  with client authentication". Additionally I have assigned a .Net userid in the sender agreement under "Assigned users" tab.
    I have also installed the SSL certificate in the client side. Then generated the public key and loaded it into the XI server's keystore.
    When I test the webservice via SOAPUI tool I am always getting the "401 Unauthorized" error. However if I give the userid/password for XI login in the properties option in the SOAPUI tool then it works fine. But my understanding is that in certificate based authentication, the authentication should happen based on the certificate and hence there is no need for the user to enter userid/password. Is my understanding correct? How to exactly test  certificate based authentication?
    Am I missing any steps for certificate based authentication?
    Please help
    Thanks
    Gopal
    Edited by: gopalkrishna baliga on Feb 5, 2008 10:51 AM

    Hi!
    Although soapUI is a very goot SOAP testing tool, you can't test certificate based authentication with it. There is no way (since I know) how to import certificat into soapUI.
    So, try to find other tool, which can use certificates or tey it directly with the sender system.
    Peter

  • Want to send PDF as attachement using Java Mail

    HI,
    I am using Java mail API for sending PDF as attachment. Here is my sample code
    messageBodyPart = new MimeBodyPart();
    messageBodyPart.setDataHandler(new DataHandler("String data for PDF using iText", "text/plain" ));
    I am generating String for PDF file using iTEXT but I am unable to find out mimetype for passing into DataHandler as second paramete.
    Any idea?
    Thanks
    Shailesh

    Don't convert the data to String. It isn't text so
    you'll damage the binary content by doing that. In
    the "demos" directory of your JavaMail download
    you'll find a ByteArrayDataSource class you can use
    instead of a FileDataSource. Yes, this worked for me. I create the pdf in memory as as StringBuffer and I just changed the code from
    messageBodyPart.setDataHandler(new DataHandler(pdf.toString(), "application/pdf"));
    to
    messageBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(pdf.toString(), "application/pdf")));
    and it worked.
    Thanks a lot for your help,
    Dennis

  • Sender SOAP Adapter: zipped Payload or zipped Attachement possible?

    Hi,
    I've a SOAP --> PI --> Proxy Scenario. As the payload of the message can become quite huge (around 10MB), I'd like to zip the message.
    From the documentation it's not clear for me if the Sender SOAP Adapter can be enhanced with the standard PayloadZipBean:
    "You cannot add your own modules to this adapter" --> so is it possible to use modules provided by SAP?
    If it's not possible: is there another way to send the message zipped via SOAP, e.g. as a additional attachement to the SOAP message, and to unzip the attachement / use the content of it as message payload for mapping?
    Please note: usage of SOAP is a must for that scenario.
    Best regards
    Holger

    > File size is a question due to limited network speed between sender and PI. If I can reduce the data package to be transferred, it'd be a big help. Therefore I'd like to zip the message.
    In this case it would be sufficient to use Content-Encoding gzip.
    This is part of the HTTP protocol and will be unzipped automatically by the HTTP framework, so you need not do anything special in SOAP adapter.
    See http://tools.ietf.org/html/rfc2616#section-14.11
    Check if your SOAP client is able to use that.
    Regards
    Stefan
    Edited by: Stefan Grube on Mar 31, 2009 2:11 PM

  • Problem: Original Attachment Name from SOAP Sender changes to attachment-1

    Hi everybody,
    we have a scenario where a SOAP sender receives a xml message describing several documents. Each document has a mime type and a file name, size, md5 checksums etc as attributes.
    The documents are send as attachments with the same Web service in SWA(SOAP with attachment style).
    The web service calls an ABAP proxy provider class in a R/3 backend.
    The ABAP proxy class will save the attached documents for further processing and must use the original document names.
    At the soap communication channel monitoring(Java Stack) we still see the original attachment names in the message content tab.
    At the Integration Server(sxmb_moni) the attachment name changes to attachment-1, attachment-2 and so on.
    Using the method
    IF_AI_ATTACHMENT ->GET_DOCUMENT_NAME
      in the provider ABAP proxy class returns the name attachment-1.
    We can see that there is a mapping of the new attachment-1 name to the old, original name in the manifest section of this message on the Integration server.
    Is there a way to access the manifest section at a provider ABAP proxy class?  Or otherwise a PI configuration setting to preserve the original attachment names.
    Thanks a lot,
    Heiko
    => PI 7.1 SP9

    Hi Stefan,
    (I was hoping you would find that thread ...)
    I see a good reason why the attachment names are changed as the PI message protocol sends the main document as an attachment as well. So no problem with that because the information of the mapping old to new names still exists in the manifest part and is visible at the sxmb_moni.
    We see a manifest part like this (Sorry cant post the whole xml doc as the formatting for longer messages isn't working in the forum)
    <SAP:Payload xlink:href="cid:4cc43edd-839f-423f-b7c6-7e44294d663a_sig.p7m">
      <SAP:Name>attachment-1</SAP:Name>
      <SAP:Description>attachment</SAP:Description>
      <SAP:Type>ApplicationAttachment</SAP:Type>
    </SAP:Payload>
    The (red) cid entry is the original file name. This manifest is from the sxmb_moni in the r/3 backend. So all the information is there..  The question is how to retrieve this information .. Any idea?
    Best Regards,
    Heiko Bergmann

  • How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

    How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

    How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

  • Using Nightly to access web-based email - Won't allow me to send an attachment - Please Help

    I sometimes need to access my email through a browser. When using nightly I have, on several, been unable to send a file attachment. A few minutes ago I got a pop-up that said that nightly was blocking all attachments for security reasons. - The popup disappeared before I was able to read it fully. The attachment was an innocuous document from a standard word processor with no macros or other potentially hazardous content. I do, from time to time, need to send attachments to colleagues using a web-based email interface. How can I get Nightly allow this?
    Thanx in advance.

    HI CosmicWolf,
    In about:settings please check the list of pop up exceptions under Content. It is also possible to click on the icon next to the url and look at "Page Info". From this menu under Permissions see is pop ups are blocked.
    Its a bit hidden, but it can be changed. [[Pop-up blocker settings, exceptions and troubleshooting]]

  • SMIME in sender soap adapter

    Hi,
    I'd like to know the proper format of the POST request to a sender soap adapter with SMIME activated. I've found almost no documentation about it.
    I'm trying to send a document ciphered to PI via soap adapter (HTTP POST). I've done the following steps
    1. I activate SMIME in the sender soap adapter, and I specify "Decrypt" as the security procedure in the sender agreement. I also incorporate the private key in the keystore DEFAULT and reference to it in the sender agreement.
    2. I use OpenSSL to cipher an xml document like this (I use the public certificate associated to the previous private key) :
    --> openssl smime -encrypt -in fich.txt -out fich_encrypted.txt certTesting.pem
    What I get is:
    MIME-Version: 1.0
    Content-Disposition: attachment; filename="smime.p7m"
    Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
    Content-Transfer-Encoding: base64
    MIIC....[base64 content of the file encrypted]
    3. I use CURL to send the HTTP POST request to PI. Previously I get the binary file from the base64 content.
    > POST /XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_1[...]
    > Authorization: Basic c2U[...]
    > Host: pi.[...].com:50000
    > Accept: /
    > Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name=fich_encrypted.der
    > User-Agent: Jakarta Commons-HttpClient/3.1
    > Accept-Encoding: text/xml
    > Content-Disposition: attachment; filename=fich_encrypted.der
    > Content-Length: 620
    > Expect: 100-continue
    but I get this error from the SOAP Adapter:
    --> java.io.IOException: invalid content type for SOAP: APPLICATION/PKCS7-MIME.
    I also get the same error if I remove the header Content-Disposition.
    4. If I send the xml file without ciphering (header Content-Type: text/xml;charset=UTF-8) I get the error:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: call failed: java.lang.SecurityException: Exception in Method: VerifySMIME.run(). LocalizedMessage: SecurityException in method: verifySMIME( MessageContext, CPALookupObject ). Message: IllegalArgumentException in method: verifyEnvelopedData( ISsfProfile ). Wrong Content-Type: text/xml;charset=UTF-8. *Expected Content-Type: application/pkcs7-mime or application/x-pkcs7-mime*. Please verify your configuration and partner agreement
    PROBLEM --> I really don't know what the SOAP sender channel is expecting when SMIME is activated. I've tried to send the binary file encripted as an attachment and also directly, but the soap adapter complains.
    Thanks

    HI,
    for XI EP
    Please see the below links so that you can have clear Idea..
    /people/saravanakumar.kuppusamy2/blog/2005/02/07/interfacing-to-xi-from-webdynpro
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/integrating%20web%20dynpro%20and%20sap%20xi%20using%20jaxb%20part%20ii.article
    Consuming XI Web Services using Web Dynpro – Part II-/people/riyaz.sayyad/blog/2006/05/08/consuming-xi-web-services-using-web-dynpro-150-part-ii
    Consuming XI Web Services using Web Dynpro – Part I -/people/riyaz.sayyad/blog/2006/05/07/consuming-xi-web-services-using-web-dynpro-150-part-i
    /people/sap.user72/blog/2005/09/15/creating-a-web-service-and-consuming-it-in-web-dynpro
    /people/sap.user72/blog/2005/09/15/connecting-to-xi-server-from-web-dynpro
    Regards
    Chilla..

  • DIME Attachement IOException using IIS Plug-in / OK without Plug-in

    Hi,
    I have a deployed axis servlet (1.2.1) running on a weblogic server (8.1.5) wich accepts a DIME attachment. The client sends the attachment via axis rpc call.invoke() methods. If I send the attachment via a IIS proxy plug-in URL, I get IOExceptions (shown below with IIS plugin debug output). I'm able to send the attachement successfully, however, if I bypass the proxy and use a real weblogic server URL. The IIS plugin works for all other types of soap calls.
    I've tried changing the wsdd http transport on the client/server to use the axis CommonsHTTPSender without any luck, see: <http://wiki.apache.org/ws/FrontPage/Axis/AttachmentProblems>
    I hope someone may have an idea what the problem is using the IIS proxy. Thanks.
    Setup:
    Clustered Servers: Axis Servlet, WebLogic 8.1 SP5, jrocket jdk
    Client: Axis 1.2.1
    Proxy: WebLogic IIS Plug-in
    IOException (truncated):
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.RuntimeException: java.io.IOException: End of physical stream detected when 33924 more bytes expected.AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.io.IOException: End of physical stream detected when 33924 more bytes expected.
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.io.IOException: End of physical stream detected when 33924 more bytes expected.
    at org.apache.axis.attachments.DimeDelimitedInputStream._read([BII)I(DimeDelimitedInputStream.java:273)
    at org.apache.axis.attachments.DimeDelimitedInputStream.read([BII)I(DimeDelimitedInputStream.java:201)
    at org.apache.axis.attachments.DimeDelimitedInputStream.read([B)I(DimeDelimitedInputStream.java:445)
    at org.apache.axis.attachments.ManagedMemoryDataSource.<init>(Ljava/io/InputStream;ILjava/lang/String;Z)V(ManagedMemoryDataSource.java:146)
    at org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound([Ljava/lang/String;)Lorg/apache/axis/Part;(MultiPartDimeInputStream.java:163)
    at org.apache.axis.attachments.MultiPartDimeInputStream.readAll()V(MultiPartDimeInputStream.java:100)
    at org.apache.axis.attachments.MultiPartDimeInputStream.getAttachments()Ljava/util/Collection;(MultiPartDimeInputStream.java:108)
    at org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments()V(AttachmentsImpl.java:156)
    at org.apache.axis.attachments.AttachmentsImpl.getAttachmentByReference(Ljava/lang/String;)Lorg/apache/axis/Part;(AttachmentsImpl.java:315)
    at org.apache.axis.encoding.DeserializationContext.getObjectByRef(Ljava/lang/String;)Ljava/lang/Object;(DeserializationContext.java:617)
    at org.apache.axis.encoding.ser.JAFDataHandlerDeserializer.startElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Attributes;Lorg/apache/axis/encoding/DeserializationContext;)V(JAFDataHandlerDeserializer.java:70)
    at org.apache.axis.encoding.DeserializationContext.startElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Attributes;)V(DeserializationContext.java:1048)
    at org.apache.axis.message.SAX2EventRecorder.replay(IILorg/xml/sax/ContentHandler;)V(SAX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHandler(Lorg/xml/sax/ContentHandler;)V(MessageElement.java:1141)
    at org.apache.axis.message.RPCElement.deserialize()V(RPCElement.java:236)
    at org.apache.axis.message.RPCElement.getParams()Ljava/util/Vector;(RPCElement.java:384)
    at org.apache.axis.providers.java.RPCProvider.processMessage(Lorg/apache/axis/MessageContext;Lorg/apache/axis/message/SOAPEnvelope;Lorg/apache/axis/message/SOAPEnvelope;Ljava/lang/Object;)V(RPCProvider.java:148)
    at org.apache.axis.providers.java.JavaProvider.invoke(Lorg/apache/axis/MessageContext;)V(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(Lorg/apache/axis/Handler;Lorg/apache/axis/MessageContext;)V(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(Lorg/apache/axis/MessageContext;Lorg/apache/axis/HandlerIterationStrategy;)V(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(Lorg/apache/axis/MessageContext;)V(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(Lorg/apache/axis/MessageContext;)V(SOAPService.java:453)
    at org.apache.axis.server.AxisServer.invoke(Lorg/apache/axis/MessageContext;)V(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(AxisServlet.java:699)
    at com.sigmadynamics.services.SDServiceDeployerServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V(SDServiceDeployerServlet.java:95)
    IIS Plugin Debug Output
    ================New Request: [soap/services/WorkbenchServer.wlforward] =================
    Wed Apr 19 10:28:12 2006 SSL is not being used
    Wed Apr 19 10:28:12 2006 resolveRequest: wlforward: /soap/services/WorkbenchServer
    Wed Apr 19 10:28:12 2006 URI is /soap/services/WorkbenchServer, len=30
    Wed Apr 19 10:28:12 2006 Request URI = [soap/services/WorkbenchServer]
    Wed Apr 19 10:28:12 2006 found 'Transfer-Encoding: chunked' header
    Wed Apr 19 10:28:12 2006 Going to save the post data in file
    Wed Apr 19 10:28:12 2006 Temp Post File name = [c:\TEMP\_wl_proxy\_post_4832_0]
    Wed Apr 19 10:28:12 2006 sysMkdirs() on 'c:\TEMP\_wl_proxy':
    Wed Apr 19 10:28:12 2006 sysMkdirs() on 'c:\TEMP\_wl_proxy' OK...
    Wed Apr 19 10:28:12 2006 Going to readClient [0] bytes
    Wed Apr 19 10:28:12 2006 ReadPostToFile(): Read the file completely 49152 bytes
    Wed Apr 19 10:28:12 2006 attempt #0 out of a max of 10
    Wed Apr 19 10:28:12 2006 Trying a pooled connection for '10.111.222.76/7002/0'
    Wed Apr 19 10:28:12 2006 getPooledConn: No more connections in the pool for Host[10.111.222.76] Port[7002] SecurePort[0]
    Wed Apr 19 10:28:12 2006 general list: trying connect to '10.111.222.76'/7002/0 at line 1265 for '/soap/services/WorkbenchServer'
    Wed Apr 19 10:28:12 2006 INFO: New NON-SSL URL
    Wed Apr 19 10:28:12 2006 Connect returns -1, and error no set to 10035, msg 'Unknown error'
    Wed Apr 19 10:28:12 2006 EINPROGRESS in connect() - selecting
    Wed Apr 19 10:28:12 2006 Local Port of the socket is 3848
    Wed Apr 19 10:28:12 2006 Remote Host 10.111.222.76 Remote Port 7002
    Wed Apr 19 10:28:12 2006 general list: created a new connection to '10.111.222.76'/7002 for '/soap/services/WorkbenchServer', Local port: 3848
    Wed Apr 19 10:28:12 2006 WLS info in sendRequest: 10.111.222.76:7002 recycled? 0
    Wed Apr 19 10:28:12 2006 URL::parseHeaders: StatusLine set to [500 Internal Server Error]
    Wed Apr 19 10:28:12 2006 parsed all headers OK
    Wed Apr 19 10:28:12 2006 sendResponse() : uref->getStatus() = '500'
    Wed Apr 19 10:28:12 2006 Going to send headers to the client. Status :500 Internal Server Error
    Wed Apr 19 10:28:12 2006 Content Length Unknown
    Wed Apr 19 10:28:12 2006 canRecycle: conn=1 status=500 isKA=0 clen=-1 isCTE=1
    Wed Apr 19 10:28:12 2006 closeConn: URL.canRecycle() returns false, deleting URL '10.111.222.76/7002'
    Wed Apr 19 10:28:12 2006 request [soap/services/WorkbenchServer] processed successfully ..................

    I too am getting the same exception trying to go throuh IIS going to a Tibco CIM application hosted on WebLogic server.
    Everything worked fine with my demo certs. The problem came in when I tried to use a cert generated by my customer's internal certificate authority.
    The certificate works fine when going directly to the application servers through SSL. However, when going through with IIS, I get the stack thread in this thread.
    Did anyone get an answer to this. I would appreciate it if they would post it.

  • Error while trying send emai with attachment

    Hello,
    I am facing an error while trying to send email with attachment (spreadsheet).
    Error is:  "Error in calling 'SBCOMS_SEND_REQUEST_CREATE'   in  'SO_DOCUMENT_SEND_API1' with Sy-subcr = 1".
    Do I need to configure the sender email address or some configuration at the sender system?
    I followed the example given in the below link.
    http://wiki.sdn.sap.com/wiki/display/ABAP/HowtowriteanABAPProgramtoplaceanExcelfileinapathandsenditasan+Attachment
    Could you please help on this?
    Thanks & regards,
    Ravish

    Hi Ravish,
    sure you can create local excel using [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf], load as binary and attach.
    More elegant, future-oriented and advanced is the [excel-from-scratch-approach abap2xlsx by Ivan Femia|http://wiki.sdn.sap.com/wiki/display/ABAP/abap2xlsx]
    Regards,
    Clemens

  • Sending SOAP request from XI and writing a scheduler for this

    Dear XI Experts,
    My scenario is as follows.
    We have two landscapes
    1)     XI, R/3
    2)     Client System(Remote, Other than SAP)
    Now we have to pull the data from client system using WSDL (There will be one method for pulling the data in the WSDL file). The WSDL is provided by the client. We are importing that WSDL as external definition in Integration Repository and implementing the scenario “SOAP to XI to RFC” and configuring it Integration Directory.
    Remember the client will not send the data to XI. Only we have to pull the data as mentioned above.
    Problems:-
    (i)     How to send SOAP request to the client using XI only?
    (ii)     How to write a scheduler for this?
    please help us.
    Thanks...
    Praveen Gujjeti

    Ur Suggestion
    "My proposition looks like that. in R/3 you have scheduled RFC call in some program. This RFC calls XI and XI is calling using SOAP adapter your client. Then response go back to your RFC and you can handle this data."
    As you mentioned, I am not scheduling any RFC call in R/3. If you go through my first query u can find two points where I am having some doubts......
    How to send SOAP request to the client using XI only? Is it possible to send a SOAP request from XI?
    If so,
    (ii) How to write a scheduler for this? So that it will invoke the webservice and get the data from client application(system)

  • HTTP error while sending SOAP request using wsdl file

    We created SOAP request using the wsdl file ; while sending SOAP request from Altova XMLSpy, we are getting the below error.
    HTTP error: could not post file
    Can you please explain how to resolve this issue
    Regards,
    Sanghamitra

    there is very little information to help you here.
    Can you confirm if this is a SOAP sender scenario or SOAP receiver scenario?
    Also do go to thru these links to help you out;
    Troubleshooting
    Troubleshooting - RFC and SOAP scenarios *** Updated on 20/04/2009 ***
    RFC -> SOAP
    RFC -> XI -> WebService - A Complete Walkthrough (Part 1)
    RFC -> XI -> WebService - A Complete Walkthrough (Part 2)
    SOAP <-> XI <-> RFC/BAPI
    Walkthrough - SOAP  XI  RFC/BAPI

Maybe you are looking for