This discussion is archived
4 Replies Latest reply: Apr 21, 2012 10:43 AM by 931865 RSS

How to load XML Document into BPEL for XSL Transformation

931865 Newbie
Currently Being Moderated
Hello

I would like to transform an xml document stored in a file on the MDS (oramds:/...).

UPDATE: Important to add: the filename is being passed to the service and must be accessed as variable

How can I pass the contents of the file (who's path is accessed in a BPEL variable) to the input parameter of the the xdk:processXSLT() function?
just passing the path variabel doesn't work, nor does wrapping the path variable in ora:doc(). Any other ideas?

Edited by: 928862 on 19.04.2012 08:05

Edited by: 928862 on 19.04.2012 08:23
  • 1. Re: How to load XML Document into BPEL for XSL Transformation
    robert224810 Explorer
    Currently Being Moderated
    I would be intrested in the answer to this question as well. Although it seems like an unusal requirment I guess there could be some situations where it would be useful.

    On our servers (we have a cluster) our metadata is deployed in $AIA_HOME/AIAMetadata so one solution would be to use a file adapter and read it from there. This isn't really satisfactory since it would not read the live metadata. Since sometimes the live metadata gets edited (e.g. changing a .RULES file in Composer) it would be better to read it direct from the metadata store.

    There dosen't seem to be any adapter which would read metadata.

    I guess your xml file will also have a xsd schema associated with it.
    You could declare a BPEL variable with the type specified in the schema and then have some embedded java read the file into this schema.
  • 2. Re: How to load XML Document into BPEL for XSL Transformation
    931865 Newbie
    Currently Being Moderated
    Thanks for your reply!

    How can I reference the MDS from embedded Java code?
  • 3. Re: How to load XML Document into BPEL for XSL Transformation
    931865 Newbie
    Currently Being Moderated
    Files in MDS can also be accessed over HTTP -> http://blog.ipnweb.com/2012/02/referencing-mds-artifacts-via-http.html

    I guess if someone could tell me how to read a file over HTTP with a dynamic filename (e.g. stored in a variable), that would help me too. For now I tried with the HTTP Binding component, but cannot figure out how to pass a dynamic file name. The endpoint definition seems to be in the composite.xml file.

    I just read at http://docs.oracle.com/cd/E21764_01/integration.1111/e10224/sca_bindingcomps.htm#autoId3

    "You cannot change the httpBinding property for the HTTP binding component during runtime in Oracle Enterprise Manager Fusion Middleware Control."

    I guess the HTTP Binding Adapter won't help either, at least not in the current version of the SOA Suite.

    Any other ideas?

    Edited by: 928862 on 20.04.2012 08:26
  • 4. Re: How to load XML Document into BPEL for XSL Transformation
    931865 Newbie
    Currently Being Moderated
    Just a quick reply with my solution for now:


    ora:readFile()
    Use Embedded Java code to decode the base64 String,
    Use oraext:parseXML() to parse the decoded String

    for the embedded java part, using bpel 2.0:

    try{  
    addAuditTrailEntry("Starting decoding*******************");
    String base64 = (String)getVariableData("xmlFileAsBase64");
    addAuditTrailEntry("Base64 encoded string: " + base64);
    String decodedData = oracle.soa.common.util.Base64Decoder.decode(base64);
    addAuditTrailEntry("Decoded string: " + decodedData);
    setVariableData("xmlFileAsXMLString", decodedData);
    addAuditTrailEntry("Encoded string assigned to variable $xmlFileAsXMLString.");
    }catch(Exception exp){  
    System.out.println("Failed to decode base64 message due to : " + exp);
    }

    no imports needed for this!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points