3 Replies Latest reply on Sep 9, 2009 4:51 AM by 605614

    AquaLogic Service Bus - Email Proxy Service

    605614
      Hi,
      I've created an E-mail Proxy Service with the below configuration

      ===========================
      General Configuration
      ===========================
      Service Type : Messaging Service
      ===========================
      Message Type Configuration
      ===========================
      Request Message Type : Text
      Response Message Type : None
      ===========================
      Transport Configuration
      ===========================
      Protocol : email
      Endpoint URI : mailfrom:hostname:port
      Get All Headers : Yes
      ===========================
      Email Transport Configuration
      ===========================
      Email Protocol : imap
      Service Account : MyEmailServiceAccount
      Polling Interval : 10
      Read Limit : 10
      Pass By Reference : false
      Post Read Action : archive
      Attachments : ignore
      Download Directory : /usr/data/work
      Archive Directory : /usr/data/arch
      Error Directory : /usr/data/error
      Request Encoding : iso-8859-1
      Using the configuration above WITHOUT any message flows . . .
      I am able to listen and download new emails that are found in the inbox of the set Service Account (e.g. henry@company.com).
      The emails are found as a text format in the /usr/data/work and /usr/data/arch folders.

      The contents of these text files contains only the E-mail Body.

      My question is how can I extract the E-mail's Subject, To, Cc, From, Date?

      I've tried creating a message flow and use the following to log information into the application log file:
      $inbound/ctx:transport/ctx:request/tp:headers/email:Subject

      But nothing gets logged.

      Hope someone can help me out.

      Many Thanks,
      Henry

      Edited by: Henry Wu on Aug 31, 2009 8:37 PM
        • 1. Re: AquaLogic Service Bus - Email Proxy Service
          675595
          Can you please try printing $inbound and see if the fields are properly populated.
          If so then it might be some issue with XPath.
          $inbound/ctx:transport/ctx:request/tp:headers/email:Subject/text()
          $inbound/ctx:transport/ctx:request/tp:headers/email:Subject/*

          Manoj
          • 2. Re: AquaLogic Service Bus - Email Proxy Service
            605614
            Hi,
            Thanks! Your suggestion gave me clues on what to do.

            I "*Assign*"

            concat('<?xml version="1.0"?>
            <OracleSBMessage>
            <MessageType>ApplicationEmailNotification</MessageType>
            <MessageChannel>Email</MessageChannel>
            <MessageSecurity>NONSSL</MessageSecurity>
            <Email>
            <Date>', $inbound/ctx:transport/ctx:request/tp:headers/email:Date/text(), '</Date>
            <Subject>', $inbound/ctx:transport/ctx:request/tp:headers/email:Subject/text(), '</Subject>
            <Importance>Normal</Importance>
            <From>', $inbound/ctx:transport/ctx:request/tp:headers/email:From/text(), '</From>
            <To>', $inbound/ctx:transport/ctx:request/tp:headers/email:To/text(), '</To>
            <Cc>', $inbound/ctx:transport/ctx:request/tp:headers/email:Cc/text(), '</Cc>
            <Body>', $body/text(), '</Body>
            </Email>
            </OracleSBMessage>')

            "*to variable*" inboundXMLEmail

            and then "*Log*" _$inboundXMLEmail_

            the log file succesfully shows the current XML String as customized above.


            I then created a "*Route*" which "*Route To*" a Business Service which implements a JMS endpoint address to send the message to Weblogic JMS Queue.

            Upon checking the Weblogic JMS Queue, JMS Messages indeed went in. However, upon viewing the JMS Messages, the XML String created was not the body of the JMS Message, but instead the actual Microsoft Outlook HTML Format of the E-mail.

            So I went back to the "*Route*", and inside the "*Request Actions*", I then "*Assign*"
            <xmlns:Body>
            {$inboundXMLEmail/OracleSBMessage/text()}
            </xmlns:Body>

            "*to variable*" body

            using a user defined namespace of xmlns http://schemas.xmlsoap.org/soap/envelope/

            However, upon running it, I received the following error:

            ####<Sep 7, 2009 11:10:06 AM SGT> <Error> <WliSbTransports> <EMCPC272> <ALSBAdminServer> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-00101B49A2EC1FDC02BF> <> <1252293006324> <BEA-381014> <Error occured for endpoint ProxyService TestProject/ProxyServices/EmailProxyService
            com.bea.wli.sb.transports.TransportException: ALSB Assign action failed updating variable "body": com.bea.wli.common.xquery.XQueryException: Error parsing XML: {err}XP0006: "<?xml version="1.0"?>
            <OracleSBMessage>
            <MessageType>EmailNotification</MessageType>
            <MessageChannel>Email</MessageChannel>
            <MessageSecurity>NONSSL</MessageSecurity>
            <Email>
            <Date>Mon Sep 07 11:10:03 SGT 2009</Date>
            <Subject>TestSubject</Subject>
            <Importance>Normal</Importance>
            <From>Henry Wu <henry@company.com></From>
            <To>Henry Wu <henry@company.com></To>
            <Cc></Cc>
            <Body>TestBody</Body>
            </Email>
            </OracleSBMessage> ({http://www.w3.org/2001/XMLSchema}string)": bad value for type node
                 at com.bea.wli.sb.transports.TransportException.newInstance(TransportException.java:146)
                 at com.bea.wli.sb.transports.TransportManagerImpl.receiveMessage(TransportManagerImpl.java:276)
                 at com.bea.wli.sb.transports.email.EmailPublishedTask.process(EmailPublishedTask.java:118)
                 at com.bea.wli.sb.transports.poller.listener.PolledMessageListenerMDB.onMessage(PolledMessageListenerMDB.java:42)
                 at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:429)
                 at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:335)
                 at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:291)
                 at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4060)
                 at weblogic.jms.client.JMSSession.execute(JMSSession.java:3953)
                 at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:4467)
                 at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

            Hope you can help in why replacing the contents of the variable $body would not work in this conditions.

            Many Thanks,
            Henry
            • 3. Re: AquaLogic Service Bus - Email Proxy Service
              605614
              Hi,
              Thanks. I solved this by not changing $body, but instead have the formed XML String inserted into the a user-defined property in the transport header, then essentially the JMS Message's user-defined properties will have this XML String.

              Regards,
              Henry