Socket sending xml format

Hi Guys,
I have here this scenario....
I'm listening into a socket and there will be a client that will send string that is in xml format... I'm just confused with xml parsing and with the data that i'm going to receive. Is it the same getting a string and xml?
And for the string (xml format)... how am i going to parse it?

On the client side:
String xml = ....... // Populate as needed
DataOutputStream dataOut = new DataOutputStream(socket.getOutputStream());
dataOut.writeInt(xml.length());
dataOut.writeString(xml);
dataOut.flush();
On the server side:
DataInputStream dataIn = new DataInputStream(socket.getInputStream());
int length = dataIn.readInt();
byte[] buffer = new byte[length];
dataIn.readFully(buffer);
String xml = new String(buffer);
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • Send XML over Sockets

    I am beginning and I need to send XML formatted data from Swing Client to Server for parsing/processing/and response.
    There are no web server available to use. I think its best to use socket connection, but how do I send xml data over socket, and how do I receive it from server and parse it?
    I have read and cannot find a similar example.

    Xerces has DOMSerializer which can be used to serialize a Document object to a string. Once it's a string it's trivial to transmit over a socket connection. On the other side, to parse it, you'll have to create a StringReader for the received string and then an InputSource from the StringReader. You'll then be able to pass the InputSource to the DocumentBuilder.parse( ) method to generate a Document on the receiving side.
    Hope that helps,
    - Jesse

  • How to generate Campaign details in XML format for sending to downstream sy

    Dear gurus,
    we have a requirement to send the Campaign details from CRM to some Downstream system in the XML format through PI interfaces. We want to include the following campaign details in the structure.
    <SAPTOAL DATE="03-MAR-2011" TIME="13:25pm">
          <CAMPAIGN>
                <ID></ID>
                <NAME></NAME>
                <RUNDATE></RUNDATE>
                <RUNTIME></RUNTIME>
                <STARTDATE></STARTDATE>
                <ENDDATE></ENDDATE>
                <RECORDCOUNT></RECORDCOUNT>
          </CAMPAIGN>
          <TARGETGROUP>
                <ID></ID>
                <NAME></NAME>
    </TARGETGROUP>
          <BUSINESSPARTNERS>
                <BUSINESSPARTNER>
                      <ID>001</ID>
                <TARGETGROUPID></TARGETGROUPID>
                <FIRSTNAME></FIRSTNAME>
                      <LASTNAME></LASTNAME>
                      <TITLE></TITLE>
                      <SUFFIX></SUFFIX>
                      <EMAIL></EMAIL>
                      <REPFIRSTNAME></REPFIRSTNAME>
                      <REPLASTNAME></REPLASTNAME>
                      <REPPHONE></REPPHONE>
                      <REPSIGNATUREURL></REPSIGNATUREURL>
                      <REPPICTUREURL></REPPICTUREURL>
                      <REPEMAIL></REPEMAIL>
                </BUSINESSPARTNER>
                <BUSINESSPARTNER>
                      <ID>002</ID>
                <TARGETGROUPID></TARGETGROUPID>
                      <FIRSTNAME></FIRSTNAME>
                      <LASTNAME></LASTNAME>
                      <TITLE></TITLE>
                      <SUFFIX></SUFFIX>
                      <EMAIL></EMAIL>
                      <REPFIRSTNAME></REPFIRSTNAME>
                      <REPLASTNAME></REPLASTNAME>
                      <REPPHONE></REPPHONE>
                      <REPSIGNATUREURL></REPSIGNATUREURL>
                      <REPPICTUREURL></REPPICTUREURL>
                      <REPEMAIL></REPEMAIL>
                </BUSINESSPARTNER>
          </BUSINESSPARTNERS>
    </SAPTOAL>
    We have already tried the following things in SPRO.
    CRM --> Marketing --> Marketing Planning and Campaign Management --> Campaign Execution --> Define File Export Variants
    But with this we were not able to get the full XML structure, as required above. We got only this much.
    <?xml version="1.0" encoding="utf-8" ?>
    <DATA>
    <ITEM>
       <Field_1>Test Email.</Field_1>
       <Field_2>Test Email.</Field_2>
       <Field_3>ABC Company.</Field_31>
    </ITEM>
    </DATA>
    Any pointers or help on this will he greatly appreciated.rgrds,
    Randhir Soni

    Hi Prabhu,
    The program SAPFPAYM generates the payment Medium  on the basis of your configuration and background settings, this program does not bydefault give the output in the XML.
    Varient creation for the PMW in T. Code OBPM4, use the same program, which i already done it, even without this it is not be possible to create any payment Medium.
    Regards,
    Rony

  • Customization of DAC to send emails in XML format

    Hi,
    We need to customize DAC to send emails in XML format to the support team whenever there is a failure of the ETL load.
    We use the HPSC ticketing system.
    Any help to achieve this functionality is much appreciated.
    we have tried to customize the existing email template of DAC, but it is not serving the purpose to generate the ticket in HPSC.
    To generate the HPSC ticket, we have a XML format. We need to customize DAC to use this format.
    This is the version of Oracle BI application we are using:
    Build: 10.1.3.2.1.070411.1900
    Release Version: Oracle Business Intelligence 10.1.3.2.1
    Package: 070411.1900
    Build: 7.9.1.032307.0900
    Release Version: Oracle Business Intelligence Applications 7.9.1
    Package: 032307.0900
    Regards,

    Hi,
    We have raised a SR with Oracle support and are in touch with Engineering also today onwards. However, would like to try out options while waiting for a solution/workaround for this issue.
    Regards,

  • Converting String To XML Format and send as attachment

    Hi
    My requirement is to convert String into XML Format and that XML File i have to send as an attachment
    can any one one give solution for this Problem.
    Thank you
    Venkatesh.K

    hi,
    i m filling the itab first and converting to xml
    itab contaning these data
    GS_PERSON-CUST_ID   = '3'.
    GS_PERSON-FIRSTNAME = 'Bill'.
    GS_PERSON-LASTNAME  = 'Gates'.
    APPEND GS_PERSON TO GT_PERSON.
    GS_PERSON-CUST_ID   = '4'.
    GS_PERSON-FIRSTNAME = 'Frodo'.
    GS_PERSON-LASTNAME  = 'Baggins'.
    APPEND GS_PERSON TO GT_PERSON.
    after conversion data is coming like that
    #<?xml version="1.0" encoding="utf-16"?>
    <CUSTOMERS>
      <item>
        <customer_id>0003</customer_id>
        <first_name>Bill</first_name>
        <last_name>Gates</last_name>
      </item>
      <item>
        <customer_id>0004</customer_id>
        <first_name>Frodo</first_name>
        <last_name>Baggins</last_name>
      </item>
    </CUSTOMERS>
    but errors are  1) # is coming at the first
                            2)for 'encoding="utf-16"?>', it is not coming perfectly, some other data (iso-8859-1) should come here
    can anybody plz solve it.
    regards,
    viki

  • Steps to send data from BI 7.0 to PI in XML format...

    Hello everybody,
    Can somebody share any direct link to a document or thread where I can find step by step details as to how to send data from BI 7.0 to PI in XML format?
    I extracted data from ODS objects into CSV files through Open Hub Destination before, but need to know how to send same ODS data from BI to PI in XML format...
    Thanks in advance.
    ~S.H.

    just an idea:
    Maybe one way could be creating xml data via simple transformation or standard transformation in sap bw. After maybe there could create an inbound message in xi for getting the data.
    I never done it, but I thought this could be a practice?
    Hope there will be better comments for that problem, soon!

  • Sender/receiver JMS Adapter XML Format

    What is the XML format do we need to pass to Sender/receiver JMS adapter to get it processed. Do we have any specific format like JDBC adapter.
    Thanks,
    Sam

    Hi,
    1) The JMS adapter (Java Message Service) enables you to connect messaging systems to the Integration Engine or the PCK
    2) Before to use the JMS adapter we must first install the relevant JMS driver.
    The required Java libraries are product-specific The provider setting specifications are the same for the receiver and sender adapter
    3)We need to configure the JMS adapter in the configuration part of the Integration Builder/PCK
    4) The Sender JMS adapter is configured to send JMS messages to the Integration Engine or the PCK.
    5)The Receiver JMS adapter is configured to be able to convert XI messages from the Integration Server or the PCK into JMS messages
    Please go through this link
    1)http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm
    2)http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm - Configuring the Sender JMS Adapter
    3)http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm -
    Configuring the Receiver JMS Adapter
    4)http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm -
    JMS-Provider-Specific Settings
    5)http://help.sap.com/saphelp_nw04/helpdata/en/f4/2d6189f0e27a4894ad517961762db7/frameset.htm -
    JMS Adapter Modules
    6)http://help.sap.com/saphelp_nw04/helpdata/en/45/20d1dec20a0732e10000000a155369/frameset.htm -
    Async/Sync and Sync/Async Bridge in the JMS Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/10/b1b4c8575a6e47954ad63438d303e4/content.htm
    Thanks,
    Soumya.

  • Need to send XML msg to TP using B2B, but format should be Orcl XML Gateway

    Current Interface:
    ==================
    We have an EBS 11.5.10 with XML Gateway.
    Actively we were exchanging XML data with 5 trading partners (different application maintained by 3rd party) using EBS XML Gateway.
    XML Gateway uses OAG Format (attached the format bellow)
    Future Interface:
    =================
    Our company is in process of moving our EBS 11.5.10 app to Oracle Fusion Apps.
    Oracle Fusion app interfaces will be using Fusion Middleware and B2B.
    For that we doing a POC interface between a Fusion MDM and 1 Trading Partner.
    Problem:
    ========
    But, when sending XML message to other TP using B2B, the format is different. i.e. Message in the XML Format.
    Eg.
    <?xml version="1.0" ?><OUTB_FUS_IND_DATA> <OUTB_FUS_IND TRANSACTION_TYPE="TP_INDIVIDUAL_OB" TRANSACTION_SUBTYPE="INDIVIDUAL.UPDATE"> <OUTB_FUS_IND KEYVALUE="100010058799220" PERSON_FIRST_NAME="Xyz" PERSON_LAST_NAME="Abc"/> </OUTB_FUS_IND></OUTB_FUS_IND_DATA>
    Oracle XML Gateway send message with message envelop, which have attributes as text field and payload in the XML message format (XML Gateway envelope details is below).
    (Sample XML messages goes out: HTTP Body
    TRANSPORT_PROTOCOL=OXTA
    TRANSPORT_PROTOCOL_VERSION=1.0
    REQUEST_TYPE=SEND
    MESSAGE_ID=A1234567890ZZ0987654321
    MESSAGE_TYPE=XML
    MESSAGE_STANDARD=OAG
    TRANSACTION_TYPE=TP_INDIVIDUAL_IB
    TRANSACTION_SUBTYPE=INDIVIDUAL.UPDATE
    DOCUMENT_NUMBER=12345
    PARTYID=9999
    PARTY_SITE_ID=8888
    PROTOCOL_TYPE=HTTPSu2013OXTA
    PROTOCOL_ADDRESS=HTTPS://www.me.com/servlets/oracle.ecx.oxta.
    Therefore, when I receive the document in PI the mapping fails due to an incorrectly formed message payload. For example:
    TRANSPORT_PROTOCOL=OXTA&TRANSPORT_PROTOCOL_VERSION=1.0&REQUEST_TYPE=SEND&MESSAGE_ID=9EA3BD2......
    We want B2B send messages to other TP as same way XML gateway use to send.
    How we solve this issue?
    XML Gateway Envelope (Manual)
    =====================
    In addition to the business document such as a purchase order or invoice in the XML Payload, a set of message attributes are transmitted. Collectively, these attributes are called the XML Gateway envelope.
    This section discusses the XML Gateway envelope and its data in the validation process for inbound messages, or its source of data for its creation for outbound messages. Data entered into the Trading Partner Setup form is referred to as data in the trading partner table. Data entered into the Define Transactions form is referred to as data in the transaction table.
    Most of the data elements are copied from the Trading Partner tables or the Transaction tables to the XML Gateway envelope.
    Attribute
    =========
    MESSAGE_TYPE
    MESSAGE_STANDARD
    TRANSACTION_TYPE
    TRANSACTION_SUBTYPE
    DOCUMENT_NUMBER
    PARTYID
    SOURCE_TP_LOCATION_CODE
    PARTY_TYPE
    PROTOCOL_TYPE
    PROTOCOL_ADDRESS
    USERNAME
    PASSWORD
    ATTRIBUTE1
    ATTRIBUTE2
    ATTRIBUTE3
    ATTRIBUTE4
    ATTRIBUTE5
    PAYLOAD

    First of all EBiz and B2B/BPEL are two different products meant for different purpose and hence you cannot expect that EBiz and B2B/BPEL should have same functionality.
    Whatever headers you have mentioned, those are added by OXTA (Oracle Transport Agent) which is part of EBiz. You can add almost all these headers in Oracle B2B in "Additional transport headers" section of Transport Protocol Parameter.
    Search for "Additional transport headers" at below link -
    http://docs.oracle.com/cd/E23943_01/user.1111/e10229/b2b_tps.htm#BABBCDHI
    Regards,
    Anuj

  • Send Idoc to URL in XML format

    Dear All
    We are working on SAP ECC6 version. Where my  customers requirement is send an idoc
    Which contains dispatch details to there customer on URL (HTTP) in XML format
    Plz suggest how to send an Idoc to URL.
    Regards
    Arun

    Hi Arun,
    Check this links
    [idoc|http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm]
    [Port Creation|http://wiki.sdn.sap.com/wiki/display/XI/StepbyStepprocessforsendingCustomerorVendorMasterDatafromECCsystemtoanexternalsystemmysqldatabasethroughSAPProcess+Integration]
    Regards,
    Madhu.

  • Can a ibot send report in xml format? is it possible?

    Hi,
    When you choose an analysis and want to schedule it you have several option in the drop down menu; however, I have a requirement where I would need to send out the report in an XML format. Is that doable?
    Thanks in advance for your response.

    Hi SaichandVaranasi,
    Well, I need it as the report needs to be scheduled and sent out to a client via email; They use the xml to extract data from us.
    As far as getting the static data to show the xml file, it is not working or may be i am unclear on this.
    I have enabled the report links and from export i am able to get the xml file generated. Now if i copy the link of the xml output it points to my c drive. (C:\Users\username\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\CCQABWMX\FX_SEF[3].xml)
    Once i paste this link to a static view it does not generate the xml view.
    in addition even this link is to work, how would it take in the dynamic variable for each day for example where the date range will be changing.
    Am i doing it wrong?
    Thanks for your suggestion btw.

  • Send xML packet to TCP/IP socket in SOA 11g

    Send xML packet to TCP/IP socket in SOA 11g
    Hi,
    I have a requirement like
    I need to pass xml data to TCP/IP socket in the form of packets in SOA11g.
    How we can do this.Please advise me.step by step procedure helps more.

    Hi,
    There is a JCA Adapter for Sockets available... Have a look at this doc...
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_sock.htm#BABEBEJH
    Cheers,
    Vlad

  • Send idocs to SAP in SAP's XML format

    Hi!
    currently we are sending idocs to SAP using the RFC IDOC_INBOUND_ASYNCHRONOUS. this requires us to break up the data so that we can populate rows in the EDI_DC40 and EDI_DD40 table.
    Is it possible, via a RFC call, (or rather, via some programmatic interface if via RFC is not possible) to send idocs to SAP in XML format?
    Thanks,
    Mustansir

    Hi Satish,
    Thanks for the reply. Do I need to do event driven message processsing in XI for this? The other way is to schedule the RBDAPP01 in R/3 to post idocs in sequence based on the message type and Partner number
    Does this makes sense?
    And any idea bout the second question for roll back?
    Thanks

  • Why did you send me a download in XML format, instead of WORD?

    Why did you send me a download in XML format?

    balancedphoto, I just sent you a private message. Please check your inbox. :: Yuri

  • Sending data from final internal table  to application server in xml format

    hi to all ,
    can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.

    welcome to SDN.
    are you using call transformation to convert itab to XML? the XML string is in which format?
    convert it to xstring and then use the following code to store it in application server.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    TRANSFER XML_content TO FNAME.
    CLOSE DATASET FNAME.
    where fname is the path to the file name.
    Regards
    Raja

  • How do I send XML to a web service?

    I am brand new to Flex. I am trying to write a program that
    uses web services to send and receive data. I have gotten it so
    that it can receive XML from the web service. However, I also need
    to send it, and I am stuck.
    I have tried the following code:
    <mx:WebService id="MyService"
    wsdl="
    http://localhost/FlexTest/service1.asmx?WSDL"
    useProxy="false"
    result="resultHandler(event)">
    <!-- Input: XML Document...Output: String -->
    <mx:operation
    name="HelloPersonAcceptsXmlDocumentReturnsString">
    <mx:request>
    <personXmlDoc>xmlPerson</personXmlDoc>
    </mx:request>
    </mx:operation>
    <!-- Input: XML Node...Output: String -->
    <mx:operation
    name="HelloPersonAcceptsXmlNodeReturnsString">
    <mx:request>
    <personXmlNode>
    xmlPerson.Person
    </personXmlNode>
    </mx:request>
    </mx:operation>
    <!-- Input: String (XML Format)...Output: String -->
    <mx:operation
    name="HelloPersonAcceptsXmlStringReturnsString">
    <mx:request format="xml">
    <personXmlString><p1:Person xmlns:p1="
    http://impact-tech.com/schemas/FlexTest"><p1:ID>f1bd45fc-544b-489d-83cf-349d1f9740ec</p1:I D><p1:FirstName>Joe</p1:FirstName><p1:MiddleName>C.</p1:MiddleName><p1:LastName>Blow</p1:L astName><p1:BirthDate>2006-09-11T14:03:04.4755443-04:00</p1:BirthDate><p1:IsMarried>false< /p1:IsMarried><p1:NumChildren>0</p1:NumChildren><p1:NetWorth>100000</p1:NetWorth></p1:Pers on></personXmlString>
    <!--<personXmlString>{xmlPerson.toXmlString()}</personXmlString>-->
    <!--<personXmlString>{txInput.text}</personXmlString>-->
    </mx:request>
    </mx:operation>
    </mx:WebService>
    In the first operation,
    "HelloPersonAcceptsXmlDocumentReturnsString", I try to send an XML
    object. In the second operation,
    "HelloPersonAcceptsXmlNodeReturnsString", I try to send the root
    node, xmlPerson.Person. In both cases, what actually gets sent is
    literally the text that I put in the <request>node, not the
    object that text is referencing. So for the first, "xmlPerson" gets
    sent to the target, not the XML doc that it refers to.
    In the third operation, I tried three different things, and
    two are commented out. I tried to reference the XML object using
    the toXmlString() method, but again, it literally sent the text
    "xmlPerson.toXmlString()". I tried the curly-brace binding, but
    then nothing gets sent to the web service. I also tried building
    the actual XML document node by node, with values, but I get an
    error from the web service saying it can't be parsed because there
    is an illegal character at Line 1, Position1. The only thing which
    has worked has been to add an Input Text box, copy-and-paste the
    exact same XML structure as I tried to manually build, and then use
    binding to the text property of the InputText control. Then it
    works fine. But I can't actually do that, it's just for testing.
    So my question is how to make a <request> node that is
    part of the web service operation that references an object and
    sends the value of that object to the web service, not literally
    whatever text is typed in that node. I looked at the Web Services
    and Data Binding sections of the help, and didn't see any examples
    covering this. Everything was far more simplistic with binding to
    controls. Can anyone help a newbie, please?

    I don't understand how this isn't a Flex Builder question,
    since it has to do with how Flex Builder interacts with web
    services and how objects are used in binding in MXML.
    But at any rate, I got this code to work, for future
    reference of anyone else looking in this forum:
    Declaring a custom class in MXML was key to allow proper
    binding:
    <CustomClasses:Person id="testPerson" xmlns:local="*"/>
    <mx:WebService id="MyService"
    wsdl="
    http://66.129.123.211/FlexTest/service1.asmx?WSDL"
    useProxy="false"
    result="resultHandler(event)">
    <!-- Input: XML Document...Output: String -->
    <mx:operation
    name="HelloPersonAcceptsXmlDocumentReturnsString">
    <mx:request>
    <personXmlDoc>{testPerson.GetXmlDoc()}</personXmlDoc>
    </mx:request>
    </mx:operation>
    </mx:WebService>

Maybe you are looking for

  • Using Powermac G5 as a Base Station w/Airport Extreme Card...

    Hello. Can anyone tell me if I am able to install an Airport Extreme card into my Powermac G5 and use it as a virtual base station to share the internet and network with my Powerbook (which has an Airport card)? I have DSL going to my G5 via ethernet

  • Stock Categories

    Where can I go to add in (or change the settings of) a new stock category? We are running the AFS version of SAP and I am looking for a way to block a grid value from being purchased or sold before it is completely setup.  This would be so that we do

  • One album, 12 different tracks

    Hi. I imported an album of my own songs into iTunes from a CD burned with Toast from the studio where they were recorded. They import ok but appear as 12 different albums with only one track on each. I've never had this problem before and can't figur

  • HT1414 Unable to Install Updates iOS 6.0.1

    Im trying to install the latest software update on my iphone5 but it its tellin Unable to Install Update An error occured installing iOS 6.0.1

  • After Effect CS5.5_Pen tool problem: No Handles display, can't creat straight line

    Hi, I wonder why in After effects CS5.5, the pen tool doesn't work correctly! 1. "no handles display", ex: when I click an area whilst holding the mouse and clicking / or hold Alt and clicking the point in order to see the handles. 2. cannot make "st