6 Replies Latest reply: Aug 23, 2012 6:30 PM by user5108636 RSS

    Java API document for SOA developer

    user5108636
      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
        • 1. Re: Java API document for SOA developer
          vladodias
          This may help...
          http://shrikworld.blogspot.com.au/2011_08_01_archive.html
          • 2. Re: Java API document for SOA developer
            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
            • 3. Re: Java API document for SOA developer
              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
              • 4. Re: Java API document for SOA developer
                user5108636
                It does not have mediator specific fault handling java api.

                Thanks
                • 5. Re: Java API document for SOA developer
                  Anuj Dwivedi
                  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
                  • 6. Re: Java API document for SOA developer
                    user5108636
                    Hi Anuj,

                    Which object is this method convertXMLElemToString part of.

                    Thanks