How to extract payload data from SOA database schema using Java

I am trying to extract the payload data and output as XML text files using Java. Seems that is stored in SOA table XML_DOCUMENT. I am trying the following Java code to get started and it's not working as I would expect. I only get a few actual lines of output and, when I do, I only get the *<?xml version ... ?>* line.
I appreciate any advice to extract the payload data from the database. Ultimately I will want to include the composite instance ID in the SQL but for now I'm just using the code shown here:
OracleDataSource ods = new OracleDataSource();
ods.setURL("soa_db_connection_string");
ods.setUser("soa_db_user_id");
ods.setPassword("soa_db_password");
Connection conn = ods.getConnection();
String sql = "select document from xml_document where rownum < 10";
OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement(sql);
DBBinXMLMetadataProvider dbrep = BinXMLMetadataProviderFactory.createDBMetadataProvider();
dbrep.setConnectionPool(ods);
dbrep.associateDataConnection(conn);
OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
XMLDOMImplementation domimpl = new XMLDOMImplementation();
BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor(dbrep);
while (rset.next()) {
     Blob blob = rset.getBlob("DOCUMENT");
     BinXMLStream inpbin = proc.createBinXMLStream(blob);
     BinXMLDecoder dec = inpbin.getDecoder();
     InfosetReader xmlreader = dec.getReader();
     XMLDocument doc = (XMLDocument)domimpl.createDocument(xmlreader);
     doc.print(System.out);
}

I found a method using a slight variation of the code I originally posted. Essentially you remove the DBBinXMLMetadataProvider dbrep portion. I believe, with this included, the XML being extracted is validated against the database (which is referenced as a "metadata provider"). Since the SOA schema doesn't seem to contain the information to validate the XML it returns as blank. If you don't include the dbrep portion then the XML is extracted as desired.
OracleDataSource ods = new OracleDataSource();
ods.setURL("soa_db_connection_string");
ods.setUser("soa_db_user_id");
ods.setPassword("soa_db_password");
Connection conn = ods.getConnection();
String sql = "select document from xml_document where rownum < 10";
OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement(sql);
OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
XMLDOMImplementation domimpl = new XMLDOMImplementation();
BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor();
while (rset.next()) {
     BLOB blob = rset.getBLOB("DOCUMENT");
     BinXMLStream inpbin = proc.createBinXMLStream(blob);
     BinXMLDecoder dec = inpbin.getDecoder();
     InfosetReader xmlreader = dec.getReader();
     XMLDocument doc = (XMLDocument)domimpl.createDocument(xmlreader);
     doc.print(System.out);
}

Similar Messages

  • How to Extract the data from the database to XML Format

    Hi All,
    RepositoryItem userItem = getProfileRepository().getItem("user747", "user");
    String userAsXML = GetService.getItemAsXML(userItem,"profileMapping.xml");
    While searching, I got the above snippet. But i don't have any idea about to execute it. Can any one help me out.

    if you want to export all the repository data into an xml, you can use export
    C:\ATG\ATG 9.1\home
    bin\startSQLRepository -m ModuleName -export all outputfilename -repository pathtorepository
    C:\ATG\ATG9.1\home
    bin\startSQLRepository -m MotorPriseJSP -export all users.xml -repository /atg/userprofiling/ProfileAdapterRepository
    this will export all profile data from MotorPriseJSP to users.xml. Make sure you point correct datasource while executing this comamnd.
    Hope this helps !!!
    Thanks,
    Rajesh Akavaram

  • How to extract Inventory data from SAP R/3  system

    Hi friends How to extract Inventory data from SAP R/3  system? What are report we may expect from the Inventory?

    Hi,
    Inventory management
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how%20to%20handle%20inventory%20management%20scenarios.pdf
    How to Handle Inventory Management Scenarios in BW (NW2004)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f83be790-0201-0010-4fb0-98bd7c01e328
    Loading of Cube
    •• ref.to page 18 in "Upgrade and Migration Aspects for BI in SAP NetWeaver 2004s" paper
    http://www.sapfinug.fi/downloads/2007/bi02/BI_upgrade_migration.pdf
    Non-Cumulative Values / Stock Handling
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/93ed1695-0501-0010-b7a9-d4cc4ef26d31
    Non-Cumulatives
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/da1640dc88e769e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a62ebe07211d2acb80000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a62f8e07211d2acb80000e829fbfe/frameset.htm
    Here you will find all the Inventory Management BI Contents:
    http://help.sap.com/saphelp_nw70/helpdata/en/fb/64073c52619459e10000000a114084/frameset.htm
    2LIS_03_BX- Initial Stock/Material stock
    2LIS_03_BF - Material movements
    2LIS_03_UM - Revaluations/Find the price of the stock
    The first DataSource (2LIS_03_BX) is used to extract an opening stock balance on a
    detailed level (material, plant, storage location and so on). At this moment, the opening
    stock is the operative stock in the source system. "At this moment" is the point in time at
    which the statistical setup ran for DataSource 2LIS_03_BX. (This is because no
    documents are to be posted during this run and so the stock does not change during this
    run, as we will see below). It is not possible to choose a key date freely.
    The second DataSource (2LIS_03_BF) is used to extract the material movements into
    the BW system. This DataSource provides the data as material documents (MCMSEG
    structure).
    The third of the above DataSources (2LIS_03_UM) contains data from valuated
    revaluations in Financial Accounting (document BSEG). This data is required to update
    valuated stock changes for the calculated stock balance in the BW. This information is
    not required in many situations as it is often only the quantities that are of importance.
    This DataSource only describes financial accounting processes, not logistical ones. In
    other words, only the stock value is changed here, no changes are made to the
    quantities. Everything that is subsequently mentioned here about the upload sequence
    and compression regarding DataSource 2LIS_03_BF also applies to this DataSource.
    This means a detailed description is not required for the revaluation DataSource.
    http://help.sap.com/saphelp_bw32/helpdata/en/05/c69480c357354a8846cc61f7b6e085/content.htm
    http://help.sap.com/saphelp_bw33/helpdata/en/ed/16c29a27db6e4d81a015be8673eb80/content.htm
    These are the standard data sources used for Inventory extraction.
    Hope this helps.
    Thanks,
    JituK

  • How to extract PS data from sap r/3 to bw

    Hi,
    How to extract PS data from sap r/3 to bw
    PS data like plans,budget,accurals&commitmnets
    can any one help me regarding this..
    Thanks in Advance,
    Shankar.

    HI sankar,
    you can refer the belkow link to find the details on the relevant extractors and infoproviders
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/17/416d030524064cb2b8d58ffb306f3a/frameset.htm
    Regards,
    Sathya

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • How to Extract the data from R/3 Genric extractor to BW ?

    How to Extract the data from R/3 Genric extractor to BW ?

    hi,
    step by step procedure for generic extraction delta
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Refer:
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    Extractions in BI
    https://www.sdn.sap.com/irj/sdn/wiki
    New to Materials Management / Warehouse Management?
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1b439590-0201-0010-ea8e-cba686f21f06
    Ramesh

  • How to I convert data from oracle database into excel sheet

    how to I convert data from oracle database into excel sheet.
    I need to import columns and there datas from oracle database to microsoft excel sheet.
    Please let me know the different ways for doing this.
    Thanks.

    asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
    You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
    Justin

  • How can we post data from CRM to SAP using ABAP proxies???

    Hi ,
      Can anyone hep me to create interface for the following scenario How can we post data from CRM to SAP using ABAP proxies???, can I find any document ???????
    Thanks in advance
    Andy

    Andy,
    Please look at these weblogs.
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    /people/ravikumar.allampallam/blog/2005/03/03/creating-purchase-order-idoc-through-xi
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    These should give a good idea about implementing Proxies.
    Regards,
    Ravi

  • How can i  get data from anather database system  ????????

    Hi every body..
    I 've a problem .....
    I've an old program work on "DOS" and it's content database which content all Data that i need for that program
    The data file extension with ".FD" , ".VW" , ".LSS" & "SLP"
    I want to kow:-
    1) what is that database system
    2)What program could open or can get data from that database tables.
    3)can i do that with oracle...
    please describe every thing in details...
    ... Please replay quickly... urgently
    ...waiting your answer....

    You're probably better off consulting the documentation for the DOS program you're trying to deal with than hoping someone here will be able to guess what program you're using, identify the structure of the files, and tell you how to extract the data into something Oracle can import.
    Justin

  • How to Extract the data from Microsoft BI to SAP BI 7

    Dear All,
    We have a requirement to Extract the data from Microsoft BI to Sap BI 7. How can we achieve this??
    Shall we use the DB connection for this??
    If anyone knows about this please give me some suggestion.
    Thanks in advance
    Sathiya

    Hi All,
    How to include the DBMS name when I give the connection. We are using the Data base as MS-BI.
    Please guide me
    Thanks in advance.
    Regards
    Sathiya

  • How to extract the data from R/3?

    Gurus,
    I need to extract the data from R/3 to BI . Below i am giving Table name followed by field name and field description.
    I am using BI 7.0 and ECC 6.0
    I am having following doubts.
    1. Based on below information which extract method I need to use (Generic data  Extraction?)?
    2. I try to create a one view but I could not find Join between the tables. I found only few joins. how to join other tables?
    3. Without joining these table how can I collect the data ?
    4. Do i need to create multiple tables?
    SAP Table      SAP Field        Field Description
    VBAK->             VBELN->        Sales Document
    VBAP->             WERKS->        Plant
    VBAK->              AUART->            Doc Type
    VBAP->             PSTYV->        Item Category
    VBAP->             MATNR->        Material
    VBAP->             ARKTX->        Description
    MATNR->              GROES->     
    VBAP->             ZIEME->        Target Quantity UOM
    VBAP->             WAVWR->        Cost
    VBAK->             ERNAM->        Name of a person who created the object
    VBAKA->             KUNNR->        Customer Number 1
    VBAP->             BSTNK->                 Customer purchase Order no
    VBEP->             BANFN->        Purchase Requisition Number
    QMFE->             FEGRP->        Cause Code(Code Group Problem)
    QMFE->             FECOD->        Damage Code(Problem or Damage Code)
    QMEL->             QMNUM->        Notification No
    EQUI->             EQUNR->        Equipment Number
    QMEL->             QMART->        Notification Type
    QMELI->             ERDAT->        Date on Which Record Was Created
    ============================================================================================
    Gurus I will assign full points .
    Thanks

    Hi,
    I would use the standard extractor 2lis_11_vaitm and enhance it for the following fields:
    VBEP-> BANFN-> Purchase Requisition Number
    QMFE-> FEGRP-> Cause Code(Code Group Problem)
    QMFE-> FECOD-> Damage Code(Problem or Damage Code)
    QMEL-> QMNUM-> Notification No
    EQUI-> EQUNR-> Equipment Number
    QMEL-> QMART-> Notification Type
    QMELI-> ERDAT-> Date on Which Record Was Created
    regards
    Siggi

  • How to retrieve the data from SAP database.

    Hi Pals,
    How to retrieve data from SAP R/3 System to my third party software. I will make my query little bit more clear. There is a list of assets entered and stored in the SAP system. For example 3 mobile phones.
    1) Mobile 1- Nokia
    2) Mobile 2 - Samsung
    3) Mobile 3 u2013 Sony
    Now think I do not know what all assets is there. I have to retrieve the data and get it on my third party software. Just display the list of assets. Lets say SAP XI is also there. Now how will I map it and get the details.
    Please give me step by step method.
    N.B: Just to read the data from SAP database.
    Please make the flow clear step by step.
    Thanking you
    AK

    Hi,
    You can use RFC or ABAP Proxy to make synchronous call with SAP.
    Under RFC or ABAP Proxy Program you can get the data from SAP tables. Direct access to SAP Database is not preferrable even if its possible.
    The better way to go for RFC or PROXY.
    You will send the request from Third party system and the it will be as input parameters from RFC/ Proxy it will response based on it.
    This got it all..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5474f19e-0701-0010-4eaa-97c4f78dbf9b
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    /people/stefan.grube/blog/2006/09/21/using-the-soap-inbound-channel-of-the-integration-engine
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
    HTTP to RFC - A Starter Kit
    /people/community.user/blog/2006/12/12/http-to-rfc--a-starter-kit
    Refer
    Thanks
    Swarup
    Edited by: Swarup Sawant on Jun 4, 2008 9:32 AM

  • How to fetch data from single database table using 2 internal tables.

    Hi friends,
    i am a new user of ABAP and also SDN.
    i need a help. 
    i want to fetch data from one database table based on primary keys of 2 internal tables.  how to put in where clause.
    Thanks in advance.

    hii
    refer to following code ..i hope it will help you
    SELECT matnr                         " Material Number
        FROM mara
        INTO TABLE i_mara
       WHERE matnr IN s_matnr.
      IF i_mara[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               prctr                       " Profit Center
          FROM marc
          INTO TABLE i_marc
           FOR ALL ENTRIES IN i_mara
         WHERE matnr = i_mara-matnr
           AND werks IN s_werks.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
      i_output = i_marc.
      IF i_marc[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               lgort                       " Storage Location
          FROM mard
          INTO TABLE i_mard
           FOR ALL ENTRIES IN i_marc
         WHERE matnr EQ i_marc-matnr
           AND werks EQ i_marc-werks
           AND lgort IN s_lgort.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
    regards
    twinkal

  • How to extract Loan Data from HR module

    Hi Experts,
    I want to extract Loan data from HR module.
    Can anyone tell me what are the Data sources I can use,
    The Loan InfoType is 0045, passed on this I have created one generic DS but it is not working correctly, some values are it is missing.
    How can I extract Loan Data from HR module.
    Regards,
    SHAIK.
    need help to solve this issue...
    Edited by: shaik on Jan 23, 2008 10:18 AM

    Hi Experts,
    I want to extract Loan data from HR module.
    Can anyone tell me what are the Data sources I can use,
    The Loan InfoType is 0045, passed on this I have created one generic DS but it is not working correctly, some values are it is missing.
    How can I extract Loan Data from HR module.
    Regards,
    SHAIK.
    need help to solve this issue...
    Edited by: shaik on Jan 23, 2008 10:18 AM

Maybe you are looking for

  • Access Subform - Can the Subforms Source Object be defined by an SQL SP result set?

    Hi Guys, I can't clearly answer this question with a yes or no. I have an Access Sub Form that I am populating with a record set from a Store Procedure. Fairly early on I discovered that for this to work correctly the Source Object for the Sub Form C

  • ATI catalyst 11.3-1 + Xserver 1.9.4

    First off, i dont think i am a noob, but still pretty unexpired so sorry if stuff don't make sense, or if i post in the fail forumsection. I have just reinstalled Arch because my root directory was about to blow over. So i did. Unfortonatly the newes

  • Creation of "subcon PO from a P.R. created automatically with CJ20n

    Dear All, We tried to create a new P.O, of u201CZSu201D type, including the former P.R using a drag-and-drop, and choosing the u201CLu201D characteristics to have a u201Csubcontracting POu201D  but system is giving error message as "Doc type/Item Cat

  • How to run java programs from a master java program?

    Hello, I have several java programs which run from the command prompt. I am seeking help with code for starting java programs from within a java program. For example, a program called master.java works something like this: import java.*; create conne

  • Java 3d collision detection

    i loaded some villas models(.obj ) and i want to implement simple collision detection to prevent the user from walking through the villa models