This discussion is archived
2 Replies Latest reply: Jan 7, 2010 1:43 AM by 692428 RSS

"xml:lang" is replaced with "lang" in XML Record Converter Class

692428 Newbie
Currently Being Moderated
Hi All,

The issue i am having is in the Record converter class which converts XML Record to JCA record, the string "xml:lang" is replaced by only "lang" due to which the transaction i am running fails as the application to which this xml is posted rejects it.

Details:

I have a Custom Resource Adapter(on JCA 1.5 Spec) deployed on Oracle Weblogic Server 10.3. I invoke this adapter from the BPEL process (SOA Suite 11g). I have implemented the XMLRecordConverter interface which converts the XMLRecord to JCARecord. During this conversation the "xml:lang" string is replaced by "lang" due to which the application to which this xml is posted is throwing error.

The code snippet of the XMLRecordConverter implementation is below

import javax.resource.ResourceException;
import javax.resource.cci.Record;
import javax.xml.transform.dom.DOMSource;
import oracle.tip.adapter.api.record.RecordElement;
import oracle.tip.adapter.api.record.XMLRecord;
import oracle.tip.adapter.api.record.XMLRecordConverter;
import oracle.tip.adapter.fw.record.RecordElementImpl;
import oracle.tip.adapter.fw.record.XMLRecordImpl;
import oracle.tip.adapter.fw.util.JCADOMWriter;
import oracle.xml.parser.v2.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public Record convertFromXMLRecord (XMLRecord xmlRecord) throws ResourceException
{
String xmlString;
RecordElement payloadRecordElement = xmlRecord.getPayloadRecordElement();
if (payloadRecordElement != null) {
xmlString = serialize(payloadRecordElement);

}
else {
throw new ResourceException("No data in record from EIS!");
}
RecordImpl rec = new RecordImpl();
rec.setStr_Payload(xmlString);
return rec;
}
private String serialize (RecordElement recordElement)
{
if (recordElement != null) {
org.w3c.dom.Element wsifEnvelopeRootElement =
recordElement.getDataAsDOMElement();
if (wsifEnvelopeRootElement != null) {
JCADOMWriter domSerializer = new JCADOMWriter();
String xmlString = domSerializer.print(wsifEnvelopeRootElement);
     return xmlString;
}
}
return "<empty>";
}

the resulting xml has all the occurrence of "xml:lang" replaced with "lang"

If i add namespace ( like xmlns:xml="http://www.w3.org/XML/1998/namespace") at the root element of XML coming from BPEL process then the replacement is not happening.
Has any of the Oracle api's used in the above code uses namespace aware parser or the BPEL engine is replacing "xml:lang" to "lang" when it passes the xml to XMLRecord Converter class?

The above code works perfectly fine in Oracle Fusion 10g (Oracle AS 10 and SOA Suite 10g)

Any information will be really helpful specially in the oracle api's

Thanks,
Amith

Legend

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