Creating ebXML message from InputStream.

I am using the Java XML summerpack 02.
I have the complete ebXML file as a InputStream and I
want to construct an EbXMLMessageImpl object from this input stream.
A sample ebXML file I have is as follows:
Host: www.example.com
SOAPAction: "ebXML"
Content-type: multipart/related; boundary="BoundarY"; type="text/xml";start="<[email protected]>"
--BoundarY
Content-ID: <[email protected]>
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
http://www.oasis-open.org/committees/ebxml-msg/schema/envelope.xsd
http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd
http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
<SOAP:Header>
<eb:MessageHeader SOAP:mustUnderstand="1" eb:version="2.0">
<eb:From>
<eb:PartyId>urn:duns:123456789</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId>urn:duns:912345678</eb:PartyId>
</eb:To>
<eb:CPAId>20001209-133003-28572</eb:CPAId>
<eb:ConversationId>20001209-133003-28572</eb:ConversationId>
<eb:Service>urn:services:SupplierOrderProcessing</eb:Service>
<eb:Action>NewOrder</eb:Action>
<eb:MessageData>
<eb:MessageId>[email protected]</eb:MessageId>
<eb:Timestamp>2001-02-15T11:12:12</eb:Timestamp>
</eb:MessageData>
</eb:MessageHeader>
</SOAP:Header>
<SOAP:Body>
<eb:Manifest eb:version="2.0">
<eb:Reference xlink:href="cid:[email protected]"
xlink:role="XLinkRole" xlink:type="simple">
<eb:Description xml:lang="en-US">Purchase Order 1</eb:Description>
</eb:Reference>
</eb:Manifest>
</SOAP:Body>
</SOAP:Envelope>
--BoundarY
Content-ID: <[email protected]>
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<purchase_order>
<po_number>1</po_number>
<part_number>123</part_number>
<price currency="USD">500.00</price>
</purchase_order>
BoundarY
Is there a straight forward way of creating a SOAP message object from an input stream ?
Any information relating to this would be very helpful.
Thanks,
Anant.

easy: MimeHeaders mh = new MimeHeaders();
mh.addHeader("Content-Type", "text/xml");
message = MessageFactory.newInstance().createMessage(mh, myInputStream)i use it to rebuild SOAP messages received on a socket!

Similar Messages

  • Create ebXML message from a InputStream

    I am using the Java XML summerpack 02.
    I have the complete ebXML file as a InputStream and I
    want to construct an EbXMLMessageImpl (or SOAPMessage - speaking generically) from this input stream.
    A sample ebXML file I have is as follows:
    Host: www.example.com
    SOAPAction: "ebXML"
    Content-type: multipart/related; boundary="BoundarY"; type="text/xml";start="<[email protected]>"
    --BoundarY
    Content-ID: <[email protected]>
    Content-Type: text/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP:Envelope xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
    http://www.oasis-open.org/committees/ebxml-msg/schema/envelope.xsd
    http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd
    http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd">
    <SOAP:Header>
    <eb:MessageHeader SOAP:mustUnderstand="1" eb:version="2.0">
    <eb:From>
    <eb:PartyId>urn:duns:123456789</eb:PartyId>
    </eb:From>
    <eb:To>
    <eb:PartyId>urn:duns:912345678</eb:PartyId>
    </eb:To>
    <eb:CPAId>20001209-133003-28572</eb:CPAId>
    <eb:ConversationId>20001209-133003-28572</eb:ConversationId>
    <eb:Service>urn:services:SupplierOrderProcessing</eb:Service>
    <eb:Action>NewOrder</eb:Action>
    <eb:MessageData>
    <eb:MessageId>[email protected]</eb:MessageId>
    <eb:Timestamp>2001-02-15T11:12:12</eb:Timestamp>
    </eb:MessageData>
    </eb:MessageHeader>
    </SOAP:Header>
    <SOAP:Body>
    <eb:Manifest eb:version="2.0">
    <eb:Reference xlink:href="cid:[email protected]"
    xlink:role="XLinkRole" xlink:type="simple">
    <eb:Description xml:lang="en-US">Purchase Order 1</eb:Description>
    </eb:Reference>
    </eb:Manifest>
    </SOAP:Body>
    </SOAP:Envelope>
    --BoundarY
    Content-ID: <[email protected]>
    Content-Type: text/xml
    <?xml version="1.0" encoding="UTF-8"?>
    <purchase_order>
    <po_number>1</po_number>
    <part_number>123</part_number>
    <price currency="USD">500.00</price>
    </purchase_order>
    BoundarY
    Is there a straight forward way of creating a SOAP message object from an input stream ?
    Any information relating to this would be very helpful.
    Thanks,
    Anant.

    While trying to create an ebXMLMessageImpl object using
    EbXMLMessageImpl(javax.xml.soap.MimeHeaders headers, java.io.InputStream in)
    I am getting an exception:
    Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred instead
    Exception in thread "main" java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl
    at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.fillInHeaders(EbXML
    MessageImpl.java:137)
    at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.<init>(EbXMLMessageImpl.java:117)
    My code has created the following MimeHeaders :
    Mime Header name : Host , MimeHeader Value : www.example2.com
    Mime Header name : SOAPAction , MimeHeader Value : "ebXML"
    Mime Header name : Content-type ,
    and its corresponding MimeHeader Value is : multipart/related; boundary="BoundarY"; type="text/xml";start="<[email protected]>"
    and I used the inputstream along with it to create the object.
    Pls. reply if you have any info on this or how to create an ebXMLMessage object from an inputstream.
    Thanks,
    Anant.

  • Reading an ebXML message from a JAXMServlet

    I have the following servlet in Tomcat 4.1.18, using the contents of java_xml_pack-summer02_01:
    public class Consume extends JAXMServlet implements OnewayListener
    private ProviderConnectionFactory pcf;
    private ProviderConnection pc;
    private static final String providerURI = "http://java.sun.com/xml/jaxm/provider";
    //private MessageFactory messageFactory;
    public void init(ServletConfig servletConfig) throws ServletException
    super.init(servletConfig);
    try
    pcf = ProviderConnectionFactory.newInstance();
    pc = pcf.createConnection();
    setMessageFactory(new EbXMLMessageFactoryImpl());
    catch (Exception e)
    e.printStackTrace();
    throw new ServletException("Couldn't initialize " + this.getClass().getName() + " servlet: " + e.getMessage());
    public void onMessage(SOAPMessage message)
    EbXMLMessageImpl ebXML = null;
    try
    System.out.println("== messagetype=" + message.getClass().getName());
    System.out.println("== constructing EbXMLMessage");
    ebXML = (EbXMLMessageImpl)message;
    System.out.println("== got EbXMLMessage " + ebXML.toString());
    catch(Exception e)
    System.out.println("== Couldn't create ebXML message from SOAP message: " + e);
    if(ebXML!=null)
    System.out.println("EbXML: From " + ebXML.getFrom().toString());
    System.out.println("EbXML: To " + ebXML.getTo().toString());
    System.out.println("EbXML: Sender " + ebXML.getSender().toString());
    System.out.println("EbXML: Receiver " + ebXML.getReceiver().toString());
    System.out.println("EbXML: CPAId " + ebXML.getCPAId());
    System.out.println("EbXML: Conversation " + ebXML.getConversationId());
    System.out.println("EbXML: Action " + ebXML.getAction());
    System.out.println("EbXML: MessageId " + ebXML.getMessageId());
    Manifest manifest = ebXML.getManifest();
    Reference[] refs = manifest.getReferences();
    for(int i=0; i<refs.length; i++)
    System.out.println("EbXML ref " + refs.getId() + ": " + refs[i].getDescription());
    ...etc
    However, after the "ebXML = (EbXMLMessageImpl)message;" line, all of the ebXML.get*() calls return null. If I use "ebXML = new EbXMLMessageImpl(message);", I get the same null results.
    I can continue on successfully deal with the SOAPMessage, but how do I correctly interpret the SOAPMessage as an EbXMLMessageImpl?
    Thanks.
    PJDM

    After investigating this, the problem seems to be that com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl is using the namespace
    NS_URI = "http://www.ebxml.org/namespaces/messageHeader";
    instead of
    NS_URI = "http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd";
    Subsequently, the same class attempts to parse timeStamp as a long, instead of an ISO8601 string.

  • Not able to create a message from satellite system

    Hello Everyone.
    We have been working on Solution Manager .We have managed with successfull installation,Uploaded required support packages,configured the system according to SAP Solution Manager Guide.
    Faced with some problem regarding support desk,we are not able to create a message from satellite system to Solution Manager.
    Note : Error Message related to this problem is ....
    <b>"Error in Local Message System : External number assignment, Enter notification num message was not Created."</b>
    Thanks in advance.
    Regards,
    Nimesh V . Master

    Hi, you need to check the number ranges for the notifications and make sure they are correct.  Look in the IMG of the SAP Solution Manager system for the instructions.  You also need to make sure that the Service Desk BC Sets are activated if you are NOT on 4.0 and SP Stack 09+.  In the later SPs much of this configuration from the IMG is automated in the wizard.

  • Roles required to create support message from satellite system

    Hi Team,
    I am trying to create support message from satellite system. i have assigned S_RFC and S_RFCACL to the Zrole. Apart from that, is there any other roles to be assined in satelite system to create support message?
    Regards
    Kumar

    I think that's it.
    Of course they roles in the central system too: SAP_SV_FDB_NOTIF_BC_ADMIN and SAP_SUPPDESK_CREATE (or copies thereof).
    Regards,
    Sean

  • Creating Support Messages from Satellite System without SolMan user account

    Hi
    We are having some problems with users "creating support message" from our ECC system  to SolMan, if the user does not have a user account in Solution Manager.
    It is not correct, that users from Satellite systems can create support messages from these systems, without the user having an account in Solution Manager? And that the user is identified by the business partner for the user, that must exist in the Solution Manager system ?
    We have set up the RFC for the supportmessages between SolMan and the ECC system as trusted RFC, with the "Current user" as the user, but how should this be set up, if the user does not have an account in the Solution Manager system. If we enter a user with the right authorizations in the RFC, will the messages that come through not just appear as created by that user, instead of the ECC user and corresponding business partner ?
    Regards
    Lars

    Hi,
    you can use the use the user for the RFC-Connection in that case. I have customizied a similar scenario. In my scenario the System from which the message was created, is the business partner (SOLD-TO-PARTY). For that you have to create a communication user (i.e SOLMAN<SYSID>). In TA SM59 in the satellite-system you assign this user for the connection. (Don't forget to assign the user to the role "SAP_SV_FDB_NOTIF_BC_ADMIN"). Now, it schould be possible to create messages from the satellite system to the solution manager. Additionally you should create business-partner for each user of the satellite system, by using TA DSWP>EDIT>CREATE BUSINESS PARTNER.
    With this TA, it is easy to create BP for each satellite system.
    Best regards
    Marc

  • Create Support Message from external system

    HI experts,
    I would like to change the Create Support Message screen(Menu->Help->Create Support Message) and add three fields namely: Category, Subject and Solution Number because currently these fields are not populated in the Service desk if I create message in this way unlike in using NOTIF_CREATE tcode where there are selection fields for these.
    Also, I'm creating the support message from an external SAP system and the messsage is sent to the Solution Manager system. The NOTIF_CREATE tcode does not exist in the external system as well as the whole package DSWP.
    Please let me know you rthoughts on this.
    Thanks
    Eric

    Hi guys,
    Thanks for your answers... But is it possible to call transaction NOTIF_CREATE from an external system?
    I have done something already so that those 3 fields will be automatically populated for a message sent from an external system.
    I changed the screen and called FM BAPI_NOTIFICATION_CREATE(a remote enabled FM which is the one being used by transaction NOTIF_CREATE to create a message) inside FM BCOS_SEND_MSG.
    I populated the category, subject and solution in the FM export parameters as well as the solution number in the sap data table. I put a destination also..
    This FM calls another FM DNO_OW_CREATE_NOTIFICATION which is the one being used from the external system but do not cater the functionality to send the 3 fields that we need.
    As you will notice, there are lots of standard objects that I've changed. =)
    My problem now is that the system data sent is the same with the system data if you create the message using NOTIF_CREATE. Some system that were sent when a message is sent from an external system is missing but at least the sap system and client ID is sent. There is no external reference number also. But hopefullly, the users will accept it. Can't find any other solution to this.
    Thanks,
    Eric

  • Ibase/Component issue while creating a message from satillite system

    Hi experts,
    we have implemented the service desk functionality in solution manager system.
    User is able to create message in solution manager directly.
    While creating message from a satellite system IBASE/component fields are filled with incorrect values.
    Because of this user unable to create message from satillite system.
    Has someone any ideas where we do some settings to get correct Ibase/Component values while creating message from satillite system?
    Thank you in advance,
    Babu

    Hi  Babu,
    For Creating messages in SOLMAN make sure that in T code SM30  under the table BCOS_CUST data is maitained
    OSS_MSG     W     NONE     CUST620     1.0
    First your should make your solman ready for posting issues within.
    Then connect it to ECC systems and try posting issues there.
    Do not user Tcode NOTIF_CREATE for posting issues  always use HELP- Create Support message.
    Thanks
    Nand

  • How to create File object from InputStream

    Hi everybody
    Can I know a way to create a File object from InputStream object
    Here's my code:
    URL url = loader.getResource(xsdFile); //Thats a schema file..not to worry
    InputStream istream = url.openStream();
    Now from that 'istream' I need to build File object.
    Thank you all

    didn't know fileinputstream was made to read url objects ; in the doc, it just says "A FileInputStream obtains input bytes from a file in a file system." ; according to me, website is something outside the filesystem, but i could be wrong
    edit: thought from the beginning it was all about FILEinputstream whereas it just says "inputstream" in the post ; my bad, it's still early in the morning here X)

  • With SP16-17 we can't create support message from satellite system anymore

    hello,
    We have implemented the support package 16 and 17 SAPKITL427 in solution manager last week-end and since then all satellite systems can not create support message anymore.
    The process is perfectly working in solman itself and we don't think we have thus a process customizing issue here but who knows...
    The key user creates the message with the help -> create support message
    and when he saves it (clicking the mailbox button) he gets the following error
    Error in Local Message System: Function not available Message was Not
    Created
    In fact the error Message is BCOS088
    We debugged the function BCOS_CREATE_MSG and we found out that the function
    DNO_OW_CREATE_NOTIFICATION is returning error code 1.
    We checked out RFC connection and it looks ok
    There is no dumps in ST22, no error in SLG1 in both system...a nightmare
    The notification SLF1 is created in solman but the status field of the notification is empty and it looks that the record is somehow corrupted because you can't modify it with dnotifwl.
    Due to the fact that the notification is not correctly created the support message is also not created.
    SAP and our solman consultant are working on it since 2 days but don't have a clue.  Maybe some program where no regenerated correctly ?
    If you would have any idea in which direction to look, i would greatly appreciate
    thanks a lot
    best regards Xavier

    hi Rohit,
    on the satellit I have the following versions
    SAP_BASIS     700     0012     SAPKB70012     SAP Basis Component
    SAP_ABA     700     0012     SAPKA70012     Cross-Application Component
    PI_BASIS     2005_1_700     0012     SAPKIPYJ7C     PI_BASIS 2005_1_700
    ST-PI     2005_1_700     0006     SAPKITLQI6     SAP Solution Tools Plug-In
    SAP_BW     700     0013     SAPKW70013     SAP NetWeaver BI 7.0
    SAP_AP     700     0009     SAPKNA7009     SAP Application Platform
    SAP_HR     600     0018     SAPKE60018     Human Resources
    SAP_APPL     600     0010     SAPKH60010     Logistics and Accounting
    EA-IPPE     400     0010     SAPKGPID10     SAP iPPE
    EA-APPL     600     0010     SAPKGPAD10     SAP Enterprise Extension PLM, SCM, Financials
    EA-DFPS     600     0010     SAPKGPDD10     SAP Enterprise Extension Defense Forces & Public Security
    EA-HR     600     0018     SAPKGPHD18     SAP Enterprise Extension HR
    EA-FINSERV     600     0010     SAPKGPFD10     SAP Enterprise Extension Financial Services
    FINBASIS     600     0010     SAPK-60010INFINBASIS     Fin. Basis
    EA-PS     600     0010     SAPKGPPD10     SAP Enterprise Extension Public Services
    EA-RETAIL     600     0010     SAPKGPRD10     SAP Enterprise Extension Retail
    EA-GLTRADE     600     0010     SAPKGPGD10     SAP Enterprise Extension Global Trade
    IS-PS-CA     600     0010     SAPK-60010INISPSCA     IS-PUBLIC SECTOR CONTRACT ACCOUNTING
    IS-OIL     600     0010     SAPK-60010INISOIL     IS-OIL
    IS-M     600     0010     SAPK-60010INISM     SAP MEDIA
    IS-H     600     0010     SAPK-60010INISH     SAP Healthcare
    IS-CWM     600     0010     SAPK-60010INISCWM     Industry Solution Catch Weight Management
    INSURANCE     600     0010     SAPK-60010ININSURANC     SAP Insurance
    FI-CAX     600     0010     SAPK-60010INFICAX     FI-CA Extended
    FI-CA     600     0010     SAPK-60010INFICA     FI-CA
    ERECRUIT     600     0010     SAPK-60010INERECRUIT     E-Recruiting
    ECC-DIMP     600     0010     SAPK-60010INECCDIMP     DIMP
    IS-UT     600     0010     SAPK-60010INISUT     SAP Utilities/Telecommunication
    SEM-BW     600     0010     SAPKGS6010     SEM-BW: Strategic Enterprise Management
    LSOFE     600     0010     SAPK-60010INLSOFE     SAP Learning Solution Front-End
    ST-A/PI     01K_ECC600     0000          -     Application Servicetools for ECC 600
    APICON     1470000000     0000          -     APICON GmbH, Interface Add ON
    thank you Xavier

  • Create Support Message from satellite system

    Hi, when I create a ticket using "Help - Create support Message" the parameter  SY-UNAME is not passed to Service Desk
    in other word, the message is created but the field "Reported by" is not filled.
    if I want to display the entire message in the form, before saving, I can see that this value is correct...
    SY-SYSID             DE1                  
    SY-MANDT             300                  
    SY-UNAME             SOLMAN               
    SY-DATUM             20080410             
    etc.
    Any suggestion ?
    Regards,
    Nacho.

    Hi,
    1) Under identification tab in external BP no. put details as
    <Server short name>space<client>space<search term
    (which you have maintained in address tab or employee no.
    of that user in satellite system)>
    2) In ID type put CRM001
    3) Under identification put details as <Server short
    name>space<installation no.>space<client>space<search
    term (which you have maintained in address tab or
    employee no. of that user in satellite system)>
    4)Go to trns. BP>select BP role as "Employee"> Indentification tab--> Maintain user name same as user id of employee in satellite system or serch term you maintained while creating BP.
    Try this. Reward the points for useful answer.
    Regards,
    Niks

  • ALDSP 3.2 - How to create JMS message from ALDSP

    Is there a way to write a jms message from ALDSP?
    I want to be able to perform database updates to a database and also write a message to queue in a transaction.
    Thanks

    As per my understanding only one resource can be non-transactional. In this case it would be the Web Service.If you have n data sources and the first n-1 are transactional and the nth one is not - if you update the first n-1 successfully, and the nth one fails - then you just throw an exception and the updates to the n-1 data sources get rolled back. If an update to one of the n-1 data sources fails you throw an exception and the update to the nth data source never happens. In your case, it's up to you to ensure the updates are executed in the correct order (how you write your XQSE procedure).
    Will the call to write a jms message from a Java function in ALDSP participate in the database transaction? DSP doesn't suspend the current transaction when calling a Java function. So yes, the JMS call would participate in the same transaction as the database call.
    If you want to dump out the transactionId in your java function in the same format as it appears in the DSP Audit, you can use :
    public String byteArrayToHexString(byte in[]) {
    StringBuffer out = new StringBuffer(in.length * 2 + 2);
    out.append("0x");
    for(int i = 0; i < in.length; i++) {
    byte ch = 0x00;
    ch = (byte) (in[i] & 0xF0);
    ch = (byte) (ch >>> 4);
    ch = (byte) (ch & 0x0F);
    out.append(HEX[(int) ch]);
    ch = (byte) (in[i] & 0x0F);
    out.append(HEX[(int) ch]);
    return out.toString();
    }

  • Creating Mime-messages from String data

    How do I save string data of email received from Outlook Express by calling BufferedReader's readLine() method over a socket a connection so that it can be converted into MimeMessage.

    Sorry but i didn't read your code snipppet so well.
    So you have a Vector v wicht contains the client part of the dialog.
    This is a typical conversation: ( you don't use EHLO or HELO handshake!? it's considered rude not to introduce yourself :) )
    EHLO CLIENTNAME
    250
    MAIL FROM:<[email protected]>
    250 MAIL FROM:<[email protected]> OK
    RCPT TO:<[email protected]>
    250 RCPT TO:<[email protected]> OK
    DATA
    354 Start mail input; end with <CRLF>.<CRLF>
    Message-ID: <24569170.1093420595394.JavaMail.cau@PTWPC019>
    From: [email protected]
    To: [email protected]
    Subject: something
    Mime-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="----=_Part_0_17459938.1093420595224"
    ------=_Part_0_17459938.1093420595224
    Content-Type: text/plain; charset=US-ASCII
    Content-Transfer-Encoding: 7bit
    TEXT CONTENTS
    ------=_Part_0_17459938.1093420595224
    Content-Type: text/html; charset=US-ASCII
    Content-Transfer-Encoding: 7bit
    <b>HTML CONTENTS<b>
    ------=_Part_0_17459938.1093420595224--
    250 <412ADBC5000000B5> Mail accepted
    QUIT
    221 ontrob1.bmsg.nl QUIT
    The results in the vector from DATA to the ending dot . should be the part of your constructor string;
    Use this constructor
    MimeMessage mm = new MimeMessage(null,  ByteArrayInputStream( yourstring.getBytes() )  ) ;at this moment you can deconstruct the mime further.
    maybe this code will help:
    you should call the dumpPart method like this dumpPart( mm );
         Store store;
         Folder folder;
         static boolean verbose = false;
         static boolean debug = false;
         static boolean showStructure = true;
         private static void dumpPart(Part part) throws Exception {
              if (part instanceof Message)
                   dumpEnvelope((Message) part);
              /** //Dump input stream ..
              InputStream is = part.getInputStream();
              // If "is" is not already buffered, wrap a BufferedInputStream
              // around it.
              if (!(is instanceof BufferedInputStream))
                   is = new BufferedInputStream(is);
              int c;
              while ((c = is.read()) != -1)
                   System.err.write(c);
              pr("CONTENT-TYPE: " + part.getContentType());
              * Using isMimeType to determine the content type avoids
              * fetching the actual content data until we need it.
              if (part.isMimeType("text/plain")) {
                   pr("This is plain text");
                   pr("---------------------------");
                   if (!showStructure)
                        System.out.println((String) part.getContent());
              } else if (part.isMimeType("multipart/*")) {
                   pr("This is a Multipart");
                   pr("---------------------------");
                   Multipart mp = (Multipart) part.getContent();
                   level++;
                   int count = mp.getCount();
                   for (int i = 0; i < count; i++)
                        dumpPart(mp.getBodyPart(i));
                   level--;
              } else if (part.isMimeType("message/rfc822")) {
                   pr("This is a Nested Message");
                   pr("---------------------------");
                   level++;
                   dumpPart((Part) part.getContent());
                   level--;
              } else if (!showStructure) {
                   * If we actually want to see the data, and it?s not a
                   * MIME type we know, fetch it and check its Java type.
                   Object o = part.getContent();
                   if (o instanceof String) {
                        pr("This is a string");
                        pr("---------------------------");
                        System.out.println((String) o);
                   } else if (o instanceof InputStream) {
                        System.err.println("HELLO CAU 1111");
                        pr("This is just an input stream");
                        pr("---------------------------");
                        InputStream is2 = (InputStream) o;
                        int c2;
                        while ((c2= is2.read()) != -1)
                             System.out.write(c2);
                        System.err.println("\nHELLO CAU");
                   } else {
                        pr("This is an unknown type");
                        pr("---------------------------");
                        pr(o.toString());
              } else {
                   pr("This is an unknown type");
                   pr("---------------------------");
         private static void dumpEnvelope(Message msg) throws Exception {
              pr("This is the message envelope");
              pr("---------------------------");
              Address[] a;
              // FROM
              if ((a = msg.getFrom()) != null) {
                   for (int j = 0; j < a.length; j++)
                        pr("FROM: " + a[j].toString());
              //TO
              if ((a = msg.getRecipients(Message.RecipientType.TO)) != null) {
                   for (int j = 0; j < a.length; j++)
                        pr("TO: " + a[j].toString());
              // SUBJECT
              pr("SUBJECT: " + msg.getSubject());
              // DATE
              Date d = msg.getSentDate();
              pr("SendDate: " + (d != null ? d.toString() : "UNKNOWN"));
              //FLAGS
              Flags flags = msg.getFlags();
              StringBuffer sb = new StringBuffer();
              Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
              boolean first = true;
              for (int i = 0; i < sf.length; i++) {
                   String s;
                   Flags.Flag f = sf;
                   if (f == Flags.Flag.ANSWERED)
                        s = "\\Answered";
                   else if (f == Flags.Flag.DELETED)
                        s = "\\Deleted";
                   else if (f == Flags.Flag.DRAFT)
                        s = "\\Draft";
                   else if (f == Flags.Flag.FLAGGED)
                        s = "\\Flagged";
                   else if (f == Flags.Flag.RECENT)
                        s = "\\Recent";
                   else if (f == Flags.Flag.SEEN)
                        s = "\\Seen";
                   else
                        continue; // skip it
                   if (first)
                        first = false;
                   else
                        sb.append(' ');
                   sb.append(s);
              String[] uf = flags.getUserFlags(); // get user-flag strings
              for (int i = 0; i < uf.length; i++) {
                   if (first)
                        first = false;
                   else
                        sb.append(' ');
                   sb.append(uf[i]);
              pr("FLAGS: " + sb.toString());
              // X-MAILER
              String[] hdrs = msg.getHeader("X-Mailer");
              if (hdrs != null)
                   pr("X-Mailer: " + hdrs[0]);
              else
                   pr("X-Mailer NOT available");
         static String indentStr = " ";
         static int level = 0;
         * Print a, possibly indented, string.
         public static void pr(String s) {
              if (showStructure)
                   System.out.print(indentStr.substring(0, level * 2));
              System.out.println(s);
    Tricae

  • Creating EbXML from a stream

    I want to be able to create an EbXMLMessageImpl object from a stream, and I am running into errors.
    The following code makes teh EbXMLMessageImpl into a stream, and then I want to put the stream back into an EbXMLMessageImpl. (I am testing what I will have to do if I receive a stream and needed to convert it to a EbXMLMessageImpl object.)
    Am I setting the MIME headers correctly? Can the stream represent a multipart/related message?
    Here is a small sample of the code:
    public static void main(String [] args)
    try
    EbXMLMessageFactoryImpl factory = new EbXMLMessageFactoryImpl();
    // ProviderConnectionFactory factory = ProviderConnectionFactory.newInstance();
    // ProviderConnection connection = factory.createConnection();
    // MessageFactory fact = connection.createMessageFactory("ebxml");
    EbXMLMessageImpl message = (EbXMLMessageImpl)factory.createMessage();
    EbXMLMessageImpl ebxmlMsg = message;
    ByteArrayInputStream stream = new ByteArrayInputStream("<? xml version='1.0' ?><BEGIN></BEGIN>".getBytes());
    message.setAction("dasdf");     ebxmlMsg.setSender(new Party("[email protected]"));
         ebxmlMsg.setReceiver(new Party("edwardbying@[email protected]"));
         Service service = new Service("SupplierOrderProcessing");
         ebxmlMsg.setRefToMessageId("[email protected]");
         ebxmlMsg.setCPAId("http://example.com/cpas/ourcpawithyou.xml");
         ebxmlMsg.setConversationId("20001209-133003-28572");
         ebxmlMsg.setService(service);
         ebxmlMsg.setAction("NewOrder");
         Manifest manifest = new Manifest("manifest", "1.0");
         Reference ref = new Reference("pay01", "cid:pay01",
                        "http://regrep.org/gci/purchaseorder");
         Schema schema = new Schema(
                        "http://regrep.org/gci/purchaseorder.xsd",
                        "1.0");
         ref.setSchema(schema);
         Description desc = new Description("en-us");
         desc.setText("PurchaseOrder for widgets");
         ref.setDescription(desc);
         manifest.addReference(ref);
         ebxmlMsg.setManifest(manifest);
    SOAPPart part = message.getSOAPPart();
    SOAPEnvelope envelope = part.getEnvelope();
    envelope.getHeader().detachNode();
    SOAPHeader header = envelope.addHeader();
    Name eb_messageHeader = envelope.createName("MessageHeader","eb","http://www.ebxml.org/namespaces/messageHeader");
    header.addHeaderElement(eb_messageHeader);
    // message.saveChanges();
    AttachmentPart attachment = message.createAttachmentPart("<? xml version='1.0' ?><BEGIN></BEGIN>", "text/plain");
    attachment.setContentType("text/xml");
    message.addAttachmentPart(attachment);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    message.writeTo(out);
    message.writeTo(System.out);
    System.out.println(System.getProperty("user.dir"));
    FileOutputStream fileout= new FileOutputStream("file.dat");
    message.writeTo(fileout);
    fileout.flush();
    fileout.close();
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    MimeHeaders mimeheader = new MimeHeaders();
    LineNumberReader reader = new LineNumberReader(new InputStreamReader( new ByteArrayInputStream(out.toByteArray())));
    String line = reader.readLine();
    System.out.println(line);
    String bondary = line.substring(2, line.length());
    System.out.println(bondary);
    mimeheader.addHeader("Content-type","multipart/related; boundary=\""+bondary + "\"");
    EbXMLMessageImpl impl = new EbXMLMessageImpl(mimeheader,in);
    }catch(Exception e)
    e.printStackTrace();
    System.exit(0);

    Hi,
    I am also facing a problem creating an ebXMLMessageImpl object from a stream.
    The thing I am doing differently to read the headers : I create a MimeMessage from the stream and get the headers from there and then populate MimeHeaders object with it.
    I then use the MimeHeaders and the input stream to create
    a ebXMLMessageImpl object.
    Among other exceptions I get during my trial and error, I am getting an exception
    Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred instead
    Exception in thread "main" java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.fillInHeaders(EbXML
    MessageImpl.java:137)
    at com.sun.xml.messaging.jaxm.ebxml.EbXMLMessageImpl.<init>(EbXMLMessage
    Impl.java:117)
    If anybody knows a solution to create a ebXML message from an input stream - or know how I can solve this exception - please reply
    Thanks,
    Anant.

  • Service Desk - Create Message from Satellite System

    Hi Guru,
    I'm learning SAP Solution manager service desk tools (on EHP1 SP22). I've managed to activate it and I can create the message from satellite system (with SLFN as default transaction type). Is it possible to change default of transaction type while creating support message from satellite system (e.g. using ZSLF, etc)?
    Appreciate for your input.
    Thanks and Regards,
    Yan

    Yes. It is very much possible.
    Use transaction - SPPFCADM
    select the row - DNO_NOTIF
    click on - Define action profile and action
    Select the action profile - SLFN0001_STANDARD_DNO
    Select the action - SLFN0001_STANDARD_DNO_CRM
    in processessing type, change the container value to ZSFN.
    Hope this will be helpful.
    Regards
    K.Kumar

Maybe you are looking for

  • How do I UNINSTALL my CS4(Vista) from my WIN 8 NEW PC? It wont INSTALL, and NOW wants me to PAY TO UPGRADE to UNINSTALL.

    I purchased CS4 back when. And I never had any problems running it on my laptop (Vista). I finally used up all my 250gb hard drive and my husband just bought me a new WIN 8 desktop. I tried INSTALLING using my CD but WIN 8 wouldnt allow me to install

  • Whatsapp and E63 problem

    Hi. I've been using E63 for the past 3 years. And had whatsapp installed for more than a year. Recently, my phone started slowing down terribly. At first I thought it was a memory problem. So i cleaned up my phone. Also did a hard reset/soft reset an

  • Updated to Lion Ox

    I copied an IPhoto libray (as one file), most of the pictures are shown correctly but some folders are there but pictures are not shown at the screen but instead I see a black background and the small horizontal bar with the pictures, why some pics c

  • Snow Leopard 10.6.8 and Creative Cloud.

    I have a CC membership and would like to put Premiere & After Effects on my older Mac (10.6.8).  I am having issues finding a way to do that.  Any help would be great.

  • How to find which BAPI updates which table

    1) I am new to SAP. is there any way to find which BAPI updates which table.  I have been given task to write a custom progm to change sevice notifications using BAPI_ALM_MAINTAIN* .<br /> <br /> i would really appreciate if any one would come with s