Есть ли решение для загрузки вложения из Gmail в WSO2 ESB / WSO2 EI? - PullRequest
0 голосов
/ 13 февраля 2019

Я работаю над wso2 esb с последних 6 месяцев.Я хочу скачать вложение из gmail в wso2 esb / ei и сохранить их в локальной папке . Google и получить решение только для отправки вложения с помощью соединителя gmail, а не для загрузки вложения.Примечание. Уже виден, но не может найти решение, перейдя по следующей ссылке: WSO2 esb получить прикрепленные файлы из электронной почты Код: ProxyService

<proxy name="GmailConfigAttachment-TaskProxy" startOnLoad="true"
transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
    <inSequence>
        <log level="custom">
            <property name="Log Text"
                value="Inside GmailConfigAttachment-TaskProxy Service"></property>
        </log>
        <property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING"
            value="true" />
        <property description="serviceName" name="serviceName"
            scope="operation" type="STRING"
            value="TaskScheduler_ASG_Read_Email_Body_Dummy_Service" />
        <property description="messageId" expression="get-property('MessageID')"
            name="messageId" scope="operation" type="STRING" />
        <sequence key="Load_Gmail_Configuration" />
        <gmail.init>
            <userId>{$ctx:userId}</userId>
            <accessToken>{$ctx:accessToken}</accessToken>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <clientId>{$ctx:clientId}</clientId>
            <clientSecret>{$ctx:clientSecret}</clientSecret>
            <refreshToken>{$ctx:refreshToken}</refreshToken>
            <accessTokenRegistryPath>{$ctx:registryPath}</accessTokenRegistryPath>
        </gmail.init>
        <gmail.listAllMails>
            <labelIds>INBOX</labelIds>
            <q>is:unread</q>
        </gmail.listAllMails>
        <log level="full" />
        <iterate description="MailIterator" expression="//jsonObject/messages" sequential="true" id="listUnread">
            <target>
                <sequence>
                    <log description="Iterate Logger" level="custom" separator=",**, ">
                        <property expression="fn:concat('GmailConfigAttachment-TaskProxy_Service ESB-MessageId:',get-property('operation','messageId'))" name="LogText" />
                        <property expression="//id/text()" name="Gmail-MessageId" />
                   </log>
                   <property description="emailMsgId" expression="//id/text()" name="emailMsgId" scope="default" type="STRING" />
                   <property description="emailSubject" expression="//headers/name[text()='Subject']/../value/text()" name="emailSubject" scope="default" type="STRING"/>
                    <property description="emailDate" expression="//headers/name[text()='Date']/../value/text()" name="emailDate" scope="operation" type="STRING"/>
                <property description="toAddress" expression="//headers/name[text()='To']/../value/text()" name="toAddress" scope="operation" type="STRING"/> 
                   <header expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)" name="Authorization" scope="transport" />
                    <gmail.readMail>
                        <id>{$ctx:emailMsgId}</id>
                    </gmail.readMail>
                    <payloadFactory media-type="xml">
                                <format>
                                    <htmlProcessEmailBody xmlns="">
                                        <emailMessageId>$1</emailMessageId>
                                        <emailSubject>$2</emailSubject>
                                        <emailBody>$3</emailBody>
                                    </htmlProcessEmailBody>
                                </format>
                                <args>
                                    <arg evaluator="xml" expression="get-property('emailMsgId')"/>
                                    <arg evaluator="xml" expression="get-property('emailSubject')"/>
                                    <arg evaluator="xml" expression="//payload"/>
                                </args>
                            </payloadFactory>
                            <log level="custom">
                                <property description="emailMsgId" expression="get-property('emailMsgId')" name="emailMsgId" scope="default" type="STRING" />
                                <property description="emailSubject" expression="//headers/name[text()='Subject']/../value/text()" name="emailSubject" scope="default" type="STRING"/>
                                <property description="emailDate" expression="//headers/name[text()='Date']/../value/text()" name="emailDate" scope="default" type="STRING"/>
                                <property description="toAddress" expression="//headers/name[text()='To']/../value/text()" name="toAddress" scope="default" type="STRING"/> 
                            </log>
                               <!-- here i need further process to download attachment from gmail  -->
                </sequence>
            </target>
        </iterate>
    </inSequence>
    <outSequence />
    <faultSequence />
</target>

Вывод ESB Так может ли кто-нибудь помочь мне найти решение?

В ожидании вашего ответа.Спасибо.

...