私のプロキシサービスはGmail IMAPサーバーからメールを受信しています。メールアドレスはcsv
です。 WSO2 ESBは正常にメールを受信しましたが、添付ファイルの内容はbase64エンコードされた文字列として出力されます。以下は私のaxis2.xml
connfigsです。なぜWSO2 ESBがBase64で電子メールの添付ファイルをエンコードしているのですか
<!-- ================================================= -->
<!-- Message Formatters -->
<!-- ================================================= -->
<!-- Following content type to message formatter mapping can be used to implement support -->
<!-- for different message format serializations in Axis2. These message formats are -->
<!-- expected to be resolved based on the content type. -->
<messageFormatters>
<messageFormatter contentType="application/x-www-form-urlencoded"
class="org.apache.synapse.commons.formatters.XFormURLEncodedFormatter"/>
<messageFormatter contentType="multipart/form-data"
class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
<messageFormatter contentType="text/xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType="application/soap+xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType="text/plain"
class="org.apache.axis2.format.PlainTextFormatter"/>
<messageformatter contenttype="text/csv" class="org.apache.axis2.format.PlainTextFormatter"/>
<!--JSON Message Formatters-->
<messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<!--messageFormatter contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="multipart/form-data"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<messageFormatter contentType="application/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<!--messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/soap+xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<messageFormatter contentType="text/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<!--messageFormatter contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType=""
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageFormatter"/-->
</messageFormatters>
<!-- ================================================= -->
<!-- Message Builders -->
<!-- ================================================= -->
<!-- Following content type to builder mapping can be used to implement support for -->
<!-- different message formats in Axis2. These message formats are expected to be -->
<!-- resolved based on the content type. -->
<messageBuilders>
<messageBuilder contentType="application/xml"
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
<messageBuilder contentType="application/x-www-form-urlencoded"
class="org.apache.synapse.commons.builders.XFormURLEncodedBuilder"/>
<messageBuilder contentType="multipart/form-data"
class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
<messageBuilder contentType="text/plain"
class="org.apache.axis2.format.PlainTextBuilder"/>
<!--JSON Message Builders-->
<messagebuilder contenttype="text/csv" class="org.apache.axis2.format.PlainTextBuilder"/>
<messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageBuilder contentType="application/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--messageBuilder contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/form-data"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<messageBuilder contentType="multipart/related"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--<messageBuilder contentType="multipart/related" class="org.apache.axis2.builder.MIMEBuilder"/>-->
<!--messageBuilder contentType="application/soap+xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<messageBuilder contentType="text/plain"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--messageBuilder contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType=""
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageBuilder"/-->
</messageBuilders>
ログイン:
INFO - LogMediator To: /services/MailService MessageID: urn:uuid:492da964-ee6c-4ae7-b444-269ba8a52641 Direction: request%%%%%%%%%%%%Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">LS05NGViMmMxNDMyYmFmNmU3N2EwNTRiNGJiMzc5DQpDb250ZW50LVR5cGU6IG11bHRpcGFydC9hbHRlcm5hdGl2ZTsgYm91bmRhcnk9OTRlYjJjMTQzMmJhZjZlNzc2MDU0YjRiYjM3Nw0KDQotLTk0ZWIyYzE0MzJiYWY2ZTc3NjA1NGI0YmIzNzcNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOA0KDQoNCg0KLS05NGViMmMxNDMyYmFmNmU3NzYwNTRiNGJiMzc3DQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1VVEYtOA0KDQo8ZGl2IGRpcj0ibHRyIj48L2Rpdj4NCg0KLS05NGViMmMxNDMyYmFmNmU3NzYwNTRiNGJiMzc3LS0NCi0tOTRlYjJjMTQzMmJhZjZlNzdhMDU0YjRiYjM3OQ0KQ29udGVudC1UeXBlOiB0ZXh0L2NzdjsgY2hhcnNldD1VUy1BU0NJSTsgbmFtZT0iY3N2LmNzdiINCkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJjc3YuY3N2Ig0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0DQpYLUF0dGFjaG1lbnQtSWQ6IGZfajBra3Q0OWYwDQoNCmQyRnhZWE1zWVdkbERRcDNZWEZoY3l3eU13PT0NCi0tOTRlYjJjMTQzMmJhZjZlNzdhMDU0YjRiYjM3OS0tDQo=</ns:binary></soapenv:Body></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
[2017-03-22 11:16:46,049] DEBUG - RelayUtils Content Type is multipart/mixed; boundary=94eb2c1432baf6e77a054b4bb379
プロキシコード:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MailTransportProtocolIMAP"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="mailto">
<target>
<inSequence>
<log level="full" separator="---=== Invalid Subject ===---"/>
</inSequence>
<outSequence/>
</target>
<parameter name="mail.imap.starttls.enable">false</parameter>
<parameter name="mail.imap.socketFactory.port">993</parameter>
<parameter name="transport.mail.Address">[email protected]</parameter>
<parameter name="mail.imap.fetchsize">100000</parameter>
<parameter name="mail.imap.user">mapperxslt1</parameter>
<parameter name="mail.imap.password">Password</parameter>
<parameter name="transport.mail.ActionAfterProcess">MOVE</parameter>
<parameter name="mail.imap.host">imap.gmail.com</parameter>
<parameter name="transport.mail.ContentType">multipart/mixed</parameter>
<parameter name="transport.mail.MoveAfterProcess">Processed</parameter>
<parameter name="mail.imap.port">993</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.mail.Protocol">imap</parameter>
<parameter name="transport.mail.Folder">inbox</parameter>
<parameter name="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
<parameter name="mail.imap.ssl.enable">false</parameter>
<parameter name="mail.imap.socketFactory.fallback">false</parameter>
<description/>
</proxy>
それがディレクトリであるとして添付ファイルを保存するWSO2 ESBのいずれかの方法はありますか?どんな助けでも大賛成です。
私は、multipart/mixedのメッセージビルダを定義していないという問題があると思います。そのため、デフォルトのメッセージビルダが使用されます。バイナリかどうかはわかりません。対応するメッセージビルダーをaxis2.xmlに追加してみてください。次のリンクは、より良い理解を得るのに役立つかもしれません。 https://docs.wso2.com/display/ESB480/Working+with+Message+Builders+and+Formatters –
私もそれを試しました。しかし、それはまだbase64でエンコーディングしています。 –