Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java API document for SOA developer

user5108636Aug 23 2012 — edited Aug 23 2012
Hi All,
I have a SOA composite application. I need to notify any process failures via email to the support group. I am able to send a mediator instance failure via email. The challenge is to provide a meaningful content, so that it helps the support group. My current content is as below

MAIL CONTENT

Dear Administrator,

An ORTD Process instance has faulted.
======================================
Fault policy id: ORTDFaultPolicy
Fault type: mediator
Partnerlink: ODS_COMMENTS
Port type: null
Fault: FaultImpl:{
bindingType = null
componentInstanceId = mediator:2F0F4840ECD711E19F748DF93DD101B7
componentName = HandleRealTimeRequests
compositeDN = default/RealTimeService!3.0 compositeInstanceId = 60001 creationDate = 2012-08-23 14:01:19.231 ECID = 3212bd6148b741d8:1d074ac2:139519b67d0:-8000-0000000000000369
engineType = mediator
id = 2F3F0AD0ECD711E19F748DF93DD101B7
*message = {faultMessage=oracle.xml.parser.v2.XMLElement@211dc32e, mediatorErrorCode=oracle.xml.parser.v2.XMLElement@211dc915, faultCode=oracle.xml.parser.v2.XMLElement@211deac7}*
name = {http://schemas.oracle.com/mediator/faults}mediatorFault
recoverable = false
referenceName = null
serviceName = null
type = 0}

As highlighted in bold above, how do I parse the Java object received by calling

MediatorRecoveryContext ctx = (MediatorRecoveryContext)iFaultRecoveryContext;
msg.append("Fault: " + ctx.getFault().getMessage()); // This returns a Java object which might hold the key error content. How do I parse it to display to the support group.

Thanks

Comments

vladodias
This may help...
http://shrikworld.blogspot.com.au/2011_08_01_archive.html
user5108636
Does not help. I am posting my code which generate the email content.

StringBuffer msg = new StringBuffer("Dear Administrator, \n\n");
msg.append("An ORTD Process instance has faulted. \n");
msg.append("======================================\n");
msg.append("Fault policy id: " + iFaultRecoveryContext.getPolicyId() +
"\n");
msg.append("Fault type: " + iFaultRecoveryContext.getType()+"\n");
msg.append("Partnerlink: " + iFaultRecoveryContext.getReferenceName()+"\n");
msg.append("Port type: " + iFaultRecoveryContext.getPortType() + "\n");


Map props = iFaultRecoveryContext.getProperties();
Properties properties = new Properties();
String mailTo = getProperty("emailToAddress", props);
String from = getProperty("emailFromAddress", props);
properties.put("mail.smtp.host", getProperty("emailServer", props));
properties.put("mail.smtp.port", getProperty("emailPort", props));
properties.put("mail.smtp.auth", "true");

String title = null;

if (iFaultRecoveryContext instanceof MediatorRecoveryContext) {
MediatorRecoveryContext ctx =
(MediatorRecoveryContext)iFaultRecoveryContext;
msg.append("Fault: " + ctx.getFault().getMessage() + "\n");
msg.append("==============================="+"\n");
msg.append("Instance Title: " + ctx.getType() + "\n");
msg.append("Mediator Message: " + ctx.getMediatorMessage()+ "\n");

}

Please suggest
vladodias
All Oracle SOA Suite APIs (B2B, BPEL, Rules, OSB, infrastructure, UMS, etc.) javadocs are available in the Oracle SOA Suite API References section in the document library.

The link is...
http://www.oracle.com/technetwork/middleware/soasuite/documentation/index-099743.html

Hope this helps...

Cheers,
Vlad
user5108636
It does not have mediator specific fault handling java api.

Thanks
Anuj Dwivedi-Oracle
Can you try this -

if (iFaultRecoveryContext instanceof MediatorRecoveryContext) {
MediatorRecoveryContext ctx =
(MediatorRecoveryContext)iFaultRecoveryContext;
Map mp = (Map)(ctx.getFault().getMessage());
String faultMessage= convertXMLElemToString(mp.get("faultMessage"));
String mediatorErrorCode = convertXMLElemToString(mp.get("mediatorErrorCode"));
String faultCode = convertXMLElemToString(mp.get("faultCode"));
}

Have not tested it but it should work.

Regards,
Anuj
user5108636
Hi Anuj,

Which object is this method convertXMLElemToString part of.

Thanks
1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 20 2012
Added on Aug 23 2012
6 comments
3,208 views