Tuesday 24 June 2014

SOA 11g - Useful SOA Infra SQL queries for Oracle SOA Production Support - Part III ( Get SOA Payload from Back end tables ( SOA Infra) )

This post will be helpful when there is a need to reprocess high number of instance due to any server outage or data source outage.

Query to retrieve the payload from back end tables:

select Document from (select Document From Xml_Document Where 1 = 1 and Document_Id in (select document_id from document_ci_ref where cikey in (Select B.Cikey From Composite_Instance A, Cube_Instance B Where A.Ecid = B.Ecid And Nvl(A.Conversation_Id,'A')  = Nvl(B.Conversation_Id,'A') And Id = #Composite Instance ID)) order by doc_partition_date) a where rownum <=1

Write a Java program that automates the reprocessing job :- 


  • Connect to SOA infra database
  • Retrive the payload using above query
  • Convert the blob to string
  • Add SOA envelope to the retrived payload
  • Generate the end point url using the values from cube instance table for this particular composite
  • use HTTP post to invoke the composite
Above steps is just a way to automate the reprocessing, you can use this query and automate in any other possible way as well. 

Code snippet to convert the blob to string...


                                    Blob blob = payloadDetail.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);
                                    TransformerFactory tf = TransformerFactory.newInstance();
                                    Transformer transformer;
                                    transformer = tf.newTransformer();
                                    
                                    //Convert Xml to String                       
                                    StringWriter writer = new StringWriter();
                                    transformer.transform(new DOMSource(doc), new StreamResult(writer));
                                    String output = writer.getBuffer().toString();


Use this and write your process accordingly...

3 comments:

  1. Why have you used nested queries instead of queries with joins as below?

    select xd.Document
    From Xml_Document xd, document_ci_ref dcr, Composite_Instance A, Cube_Instance B
    Where xd.Document_Id = dcr.document_id
    and dcr.cikey = B.Cikey
    and A.Ecid = B.Ecid And Nvl(A.Conversation_Id,'A') = Nvl(B.Conversation_Id,'A')
    order by doc_partition_date

    ReplyDelete
    Replies
    1. It took me while to locate the jar file for BinXMLStream class. It is available at xmlparserv2.jar from middleware/oracle_common/modules/oracle.xdk_11.1.0

      Delete

  2. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle SOA . Actually I was looking for the same information on internet for Oracle SOA and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more aboutOracle SOA . By attending Oracle SOA Training .

    ReplyDelete