Java.nio.BufferUnderflowException when send a idoc xml using sapjco3.jar

When I use sapjco3.jar to send a idoc
I have 2 IDOC ,one size is 200kb ,another is 336kb
the first one can send to sap correct, but the bigger one got Exception (java.nio.BufferUnderflowException)
If any thing I have to note when writing java code ? thanks ....
Exception:
send TXLOG-12918467-ToIDOC_20110513161427170_1125436.xml
send idoc D:\TXLOG-12918467-ToIDOC_20110513161427170_1125436.xml to SAP GateWay finished ,IDoc Tid is AC1140540B534DD1EAE61781
send TXLOG-12964100.xml
java.nio.BufferUnderflowException
     at java.nio.Buffer.nextGetIndex(Buffer.java:486)
     at java.nio.HeapCharBuffer.get(HeapCharBuffer.java:129)
     at com.sap.conn.idoc.rt.xml.DefaultIDocXMLParser.parse(DefaultIDocXMLParser.java:365)
     at com.sap.conn.idoc.rt.xml.DefaultIDocXMLProcessor.parse(DefaultIDocXMLProcessor.java:87)
     at com.sap.conn.idoc.rt.xml.DefaultIDocXMLProcessor.parse(DefaultIDocXMLProcessor.java:68)
     at com.testrite.msg.dex.sender.SAPSender.sendMessage(SAPSender.java:61)
     at com.testrite.msg.dex.sender.SAPSender.main(SAPSender.java:37)
My Code :
JCoDestination destination;
String dest = "BCE";
destination = JCoDestinationManager.getDestination(dest);
IDocRepository iDocRepository = JCoIDoc.getIDocRepository(destination);
String tid = destination.createTID();
IDocFactory iDocFactory = JCoIDoc.getIDocFactory();
IDocXMLProcessor processor = iDocFactory.getIDocXMLProcessor();
IDocDocumentList iDocList = processor.parse(iDocRepository, new BufferedInputStream(new FileInputStream("D:
TXLOG-12964100.xml"));
JCoIDoc.send(iDocList, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);

hi,
it only works with idoc to idoc scenarios I think
when you send from SAP to SAP through XI
have a look at my weblog:
/people/michal.krawczyk2/blog/2005/11/21/xi-idoc-to-idoc-tunneling--how-fast-and-easy-can-you-get
Regards,
michal

Similar Messages

  • Oracle JDBC driver throwing java.nio.BufferUnderflowException exception

    Hi,
    We have a an application for which the middleware(SAR file) is running on Jboss.
    We have configured a DCN (data change notification) listener (As part of SAR file) to listen for the databases changes on port 56090.
    A weekly machine security scan has been scheduled. As part of the system scan, it scans the port 56090. Following exception has been thrown by the JDBC driver at the time of scanning.
    2009-05-24 16:29:37,874 INFO [STDOUT] java.nio.BufferUnderflowException
    2009-05-24 16:29:37,874 INFO [STDOUT] at java.nio.Buffer.nextGetIndex(Buffer.java:398)
    2009-05-24 16:29:37,874 INFO [STDOUT] at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:117)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.readByte(NTFConnection.java:616)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.readInt(NTFConnection.java:650)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.unmarshalNSDataPacket(NTFConnection.java:498)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.unmarshalOneNSPacket(NTFConnection.java:404)
    2009-05-24 16:29:37,875 INFO [STDOUT] at oracle.jdbc.driver.NTFConnection.run(NTFConnection.java:181)
    And during scanning time very high CPU usage (90%) is encountered. Normal CPU usage of the application server system will be around 20%.
    Can you please give any information on the event/data which is causing the above exception. and how it can be handled, so as to minimize CPU usage back to 20%?
    Please give more information about oracle.jdbc.driver.NTFConnection class.
    Thanks in Advance
    Abdur Rahman
    Edited by: user11269361 on Jun 15, 2009 8:57 AM

    Hi,
    The DCN protocol is synchronous so if the security system scan sends a byte to the port 56090 the protocol will break. I recommend you configure the system scan to not interfere with DCN.
    Regards,
    Jean

  • Lock table overflow 1 & Error 7 when sending an IDoc

    dear all,
    we r getting error in purchasing cube for itm datasource
    2lis_o2_itm for delta...
    1.Lock table overflow 1
    2.Error 7 when sending an IDoc
    3.Errors in source system
    when i check in details it is showing :
    Data Package 1 : arrived in BW ; Processing : Selected number does not agree with transferred n
    its daily delta..plz give me solution its urgent....
    at request in manage...we got some records...wat shud  the process..
    Thanks in adv
    pinky reddy
    Edited by: pinky reddy on Apr 8, 2008 7:42 AM

    solved

  • Java.nio.BufferUnderflowException in adapter engine

    Hi experts,
    I checked the adapter engine for file comm.channel and found error as:
    Delivering the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.nio.BufferUnderflowException.
    I tried to restart but it did not worked.
    Please help on this..

    This might be due to out of memory or space error in the file system.  Check your file system and see there is no space disk error.  Create some room for memory by deleting some files and run the interface to see whether you are able to read or write the file using file adapter.

  • Error when reading data from XML using JAXB?

    Hi all,
    I get the error message when reading data from XML using JAXB.
    [org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
    (AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:481)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:199)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142)
    I don't find the reason, please help!
    Thanks in advance!

    The problem is sovled.

  • When sending an email I used to be able to add a distribution list from my contacts, I now have to add each email address individually, does anyone know how I can add the whole list?

    When sending an email I used to be able to click on a distribution list in my contacts and it would add all the email addresses, I now have to add each email address individually and this takes a lot of time.  Could someone tell me how I can add a distibution list/group to my emails?

    Barney,
    I have four groups.
    I just typed the name of one of those groups in the To field on the iPhone's email, and received:
    Invalid Address
    "<group name>" does not appear to be a valid email address.  Do you want to send it anyway?
    I clicked continue and it remains in my outbox.
    Help is appreciated.
    Thanks,
    Michael

  • RFC to send an idoc PEXR2002 using HTTP connection to an external server

    Hi,
      Iam working on RFC to send an idoc PEXR2002 using HTTP connection to an external server. first time iam working on this particular scenario on http connections. please clarify on this and explai me in detail about this.
    Points will be rewarded **
    Thanks & Regards,
    Ravi

    HI Jagruthi,
    Have you loaded the metadata into the XI system by using IDX2?
    If it is done then try to delete once and do once again.
    And also delete the IDoc from IR and reimport the IDoc and activate it once again.
    Regards
    Goli Sridhar

  • Send/Receive IDOCs (XML) from/to SAP R/3 with XI-SOAP without XI!

    Dear SAP specialists,
    (BACKGROUND) We are using the Microsoft BizTalk Adapter for SAP 1.0, developed on top of the SAP DCOM Connector (we are using the version 6.20 Patch Nr. 177), with Microsoft BizTalk Server 2002 SP1 in order to send and receive IDOC via the tRFC transport protocol. We are using the Microsoft BizTalk Adapter for SAP 1.0 since February 2002, and today we are exchanging more than 25,000 IDOC/day with this architecture.
    When we migrate our SAP R/3 system to the version 4.7 with WAS 6.20, I was very enthusiastic about the possibility of sending the IDOC in XML via the standard HTTP transport protocol, because it would considerably simplify my architecture, i.e. no need of any (expensive) adapter any more! But, I had to realise that the quality of service exactly once will not be there anymore with HTTP as it exists with tRFC. Then, we carry on using the tRFC transport protocol with the adapter.
    (QUESTION) But recently, I followed the SAP Course TBIT40 XI Foundations and I learn that:
    1.     On one hand, the XI-SOAP protocol supports the quality of service exactly once by the usage of a message GUID within the XI-SOAP envelope;
    2.     On the other hand, all mySAP solutions using WAS 6.20 (or higher) carry a “small” Integration Engine (with XI-SOAP as the “native” transport protocol).
    Then, my question is: << Is it possible to exchange IDOC (XML) directly with an SAP R/3 4.7 (WAS 6.20) via the XI-SOAP transport protocol using the “small” Integration Engine embedded into it, with the quality of service exactly once? >>
    Many thanks in advance and best regards,
    Patrice Krakow

    Hello Patrice
    We have same issue. Is it possible to use IDoc (XML) directly with SAP 5.0 with SOAP (HTTP) without XI?
    Since your que is three years old, I'm sure you must have found some method for this.
    We'll highly appreciate your help.
    Regards: Gaurave

  • Java.lang.NumberFormatException when sending mails

    Gurus,
    I am using java mail 1.4 to send mails from my application and the code to do so is
        public void postMail(String recipient, String message) {
            logger.fine("in postMail method..");
            boolean debug = true;
            Properties props = new Properties();
            props.put("mail.transport.protocol", "smtp");
            props.put("mail.smtp.host", ConfigProperty.getProperty("mail.smtp.host"));
            props.put("mail.smtp.auth","true");
            props.put("mail.smtp.port", ConfigProperty.getProperty("mail.smtp.port"));
            props.put("mail.smtp.from", ConfigProperty.getProperty("mail.from"));
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);
            Message msg = new MimeMessage(session);
            try {
                String from = ConfigProperty.getProperty("mail.from").trim();
                InternetAddress addressFrom = new InternetAddress(from);
                msg.setFrom(addressFrom);
                InternetAddress addressTo = new InternetAddress(recipient);
                msg.addRecipient(Message.RecipientType.TO, addressTo);
                msg.setSubject(ConfigProperty.getProperty("mail.subject"));
                msg.setContent(message, "text/plain");
                logger.info("Sending mail now...............................");
                Transport trans = session.getTransport("smtp");
                trans.connect("casarray.arg.ae",username,password);
                trans.send(msg);
            } catch (Exception e) {
                e.printStackTrace();
        }However i am getting the strange error when sending mails. My email is is very simple [email protected]
    Please help me understand the issue here
    java.lang.NumberFormatException: For input string: ""
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:470)
         at java.lang.Integer.parseInt(Integer.java:499)
         at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
         at javax.mail.Service.connect(Service.java:288)
         at javax.mail.Service.connect(Service.java:169)
         at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)
         at com.roadMiles.view.unsecure.page.bean.LoginPageBean.forgotPassword(LoginPageBean.java:180)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:788)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:306)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

    The error message is telling you exactly what's wrong:
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:470)
    at java.lang.Integer.parseInt(Integer.java:499)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
    at javax.mail.Service.connect(Service.java:288)
    at javax.mail.Service.connect(Service.java:169)
    at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)At line 54 of EmailNotification.java (which I assume is your class), you're calling connect(), but that fails, because, deeper down, it's trying to parse the empty String ("") as a number. So don't pass the empty String to connect(); pass a valid number instead.

  • Send / Receive Idoc(XML) in SAP ECC 5.0

    Hi Experts,
    We are using SAP standard idocs to exchanges master data and Sales data between SAP and non SAP system. currently all the idocs are generated and posted as flat file structure.
    There is possiblity to use idoc(XML) and HTTP service instead of standard process without XI?
    All info related with this is welcome. is it possible? how?
    all suggestion n helpful ans will be rewards with points.
    regards: gaurave.

    Hi Gaurave,
    I have comae accross this type of issue once and hope the below link will give you an idea.
    http://msdn2.microsoft.com/en-us/library/cc185479.aspx
    thanks,
    KIRAN

  • SAP ECC Interface w/ IDOC-XML using TCP/IP, HTTP, or FTP to 3rd-Party Syst.

    I am trying to understand if the following interface options can occur (without the use of SAP PI or any other middleware):
    Option 1A: Can I process an SAP ECC outbound IDoc in XML using TCP/IP to a non-SAP 3rd party system?  Can you please explain the reason for why I can or can NOT do this.  If possible, please provide supporting documentation on how-to do this?
    Option 1B: Can I process an SAP ECC inbound XML-IDOC from a non-SAP calling system that used TCP/IP?  Can you please explain the reason for why I can or can NOT do this. If possible, please provide supporting documentation on how-to do this?
    Option 2A: Can I process an SAP ECC outbound IDOC in XML using HTTP to a non-SAP 3rd-party system?  Can you please explain the reason for why I can or can NOT do this. If possible, please provide supporting documentation on how-to do this?
    Option 2B: Can I process an SAP ECC inbound XML-IDOC from a non-SAP calling system that used HTTP?  Can you please explain the reason for why I can or can NOT do this. If possible, please provide supporting documentation on how-to do this?
    Option 3A: Can I process an SAP ECC outbound IDOC in XML using FTP to a non-SAP 3rd-party system?  Can you please explain the reason for why I can or can NOT do this. If possible, please provide supporting documentation on how-to do this?
    Option 3B: Can I process an SAP ECC inbound XML-IDOC from a non-SAP calling system that used FTP?  Can you please explain the reason for why I can or can NOT do this. If possible, please provide supporting documentation on how-to do this?

    Hello Kirk  ,
    The answers for your question are:
    Option 1A: Yes you can .you can use TCP/IP but you must have a middleware component for that such as BC/JCO .
    Please see the link : [http://help.sap.com/saphelp_nw04/helpdata/EN/09/c88442a07b0e53e10000000a155106/frameset.htm]
    Option 1B: See the link above.
    Option 2A: You can use ABAP code :
    [http://help.sap.com/saphelp_nw04/helpdata/EN/e5/4d3514c11411d4ad310000e83539c3/frameset.htm]
    Option 2B: [http://help.sap.com/saphelp_nw04/helpdata/EN/90/4f3c2ec3c511d6b2b400508b6b8a93/frameset.htm]
    Option 3A: Only with ABAP code :[Reg: FTP Connection;
    Option 3B: See the link of Option 3A.
    Good Luck,
    Boaz
    Edited by: Boaz Ornan on Feb 21, 2010 4:33 PM

  • [java.nio] StreamCorruptedException when deserializing objects

    Hello everybody!
    I made a messaging (chat) program using java.io where all the client-server communication is done by serializing small objects. Now I would like to covert the server side to the NIO concept and I'm already struck. I successfully pass objects to the client and the client deserializes them, but only the first one! When it try to read the second it fails with a StreamCorruptedException.
    Here�s a sample (testing) code. In the server run() method I first serialize a string, then get its byte array from ByteArrayOutputStream and in the loop periodically send this byte array through the channel. On the client side I just read the deserialized object.
    Server run():
    public void run() {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                oos.writeObject("abcdefgh");
                byte[] objectArr = baos.toByteArray();
                baos.close();
                oos.close();
                ByteBuffer buff = ByteBuffer.allocate(objectArr.length);
                buff.put(objectArr);
                buff.flip();
                while(true) {
                    selector.select();
                    Set keys = selector.selectedKeys();
                    for (Object o : keys) {
                        SelectionKey key = (SelectionKey)o;
                        if (key.isAcceptable()) {
                            ServerSocketChannel server = (ServerSocketChannel) key.channel();
                            clientChannel = server.accept();
                            if (clientChannel == null)
                                continue;
                            clientChannel.configureBlocking(false);
                            SelectionKey clientKey = clientChannel.register(selector, SelectionKey.OP_WRITE);
                        } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                    try {
                        Thread.currentThread().sleep(2000);
                    } catch (InterruptedException e) {
                        return;
            } catch (IOException e) {
                e.printStackTrace();
        }Client run():
    public void run() {
            try {
                soc = new Socket("localhost", 4000);
                ObjectInputStream ois = new ObjectInputStream(soc.getInputStream());
                while(true) {
                    Object d = ois.readObject();
                    System.out.println("data = " + d.toString());
            } catch (Exception ex) {
                ex.printStackTrace();
        }At the second read I get a StreamCorruptedException.
    Apart from this I would like some hints in how to implement the application with NIO. For example how can I tell the objects apart on the client side � should I send every time a byte array before the object, which tells the length of the next coming object? This is probably not a 100% bulletproof solution and presents additional data transfer?
    Than you in advance!

    OK, I found a solution but I don't like it, because I don't understand it.
    The ObjectOutputStream adds a header (4 bytes) to the stream - if I send the array with those four bytes I get an StreamCorruptedException. If I send the array without the header I also get a StreamCorruptedException: "invalid stream header".
    If I reconstruct the object, by calling ObjectOutputStream.writeObject() and get it's byte array from ByteArrayOutputStream.toByteArray(), every time I have to fill the ByteBuffer, then it works.
    Here's the modified sending block, for the above example:
    } else if (key.isWritable()) {
                            SocketChannel client = (SocketChannel) key.channel();
                            if (buff.hasRemaining()) {
                                client.write(buff);
                            } else {
                                //* ---- added code ---------
                                baos.reset();
                                oos.writeObject("abcdefgh");
                                objectArr = baos.toByteArray();
                                buff.clear();
                                buff.put(objectArr);
                                buff.flip();
                        }   I really don't understand why I have to write the object in the object stream every time. I used ObjectOS and ByteArrayOS, to get the object byte array and then I thought I could forget about those streams and use this array to fill the ByteBuffer. What changes if I send the object through this process with every iteration (and how this harms speed - it's like sending everything twice)? If someone would explain this to me I would appreciate it much.

  • How to send a IDOC-XML to a non-sap system

    Hai Frnds,
                      Can you give me a hint , if i would like to Convert a IDOC into xml and need to send it to a Non-sap system.And can i use change pointers here...
    i have have similar one but it stores in the Front End system only....
    waiting for ur replies...

    Hi Mr. Jeevan,
    And can i use change pointers here..>>>.
    i think it wont be useful.. as change pointer only replicates master datas in the target system.
    Actually u can use CHANGE POINTER in such cases where When ever changes occur in  the field values then idoc triggers automatically and send changed information via ALE to other system.
    for example:
    u r setting up ALE for material master.
    suppose u change material description in one side then change pointers triggers idoc and generate idoc with changed description and send to other end.
    main use of change pointers is to track changes and send to other end if there is any changes.
    i will suiggest u to follow this....
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e07dcaa0-a92b-2a10-3a96-b3d942bd1539
    also see
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
    regards
    biplab

  • Error when sending INVOICE01 iDoc to SAP R/3 system

    Hi,
    I was trying to send an INVOICE01 iDoc to SAP R/3 system. I checked the iDoc list (transaction code we02), the iDoc I sent was in the status 51 with the error message as "Program parameters LS <Logic System Name> <Company code> have not been set". Could someone help me how to resolve this error?
    Thanks,
    Trifire

    SLG1 or IDOC in idoc status WEDI

  • Exception When trying to Format XML using JSTL

    Hi all
    I m trying to display content of XML in a .jsp page using JSTL ,
    When i try to dispaly the content it is thowing an exception :
    org/saxpath/SAXPathException
    Can any one please help ....
    i m using jstl1.0.6.jar and standard-1.0.6.jar
    Code Snppet Used:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <c:set var="someXML">
    <name>Sri</name>
    </c:set>
    <x:parse var="parsedDocument" xml="${someXML}" />
    <x:out select="$parsedDocument/name" />
    Thanks in Advance

    Thank for reply
    I had even tried with this code:
    <c:set var="someXML">
         <person>
              <name>Joe</name>
              <age>30</age>
         </person>
    </c:set>
    <x:parse varDom="parsedDocument" xml="${someXML}" />
         <x:set var="name" select="$parsedDocument/person/name" />
         <c:out value="${name}" />
    even then i m getting the same exception:
    Message: org/saxpath/SAXPathException

Maybe you are looking for