0

我正在尝试使用 Mailchimp 发送活动。在调用此端点时,我收到类似“传输错误:404 错误:未找到”的错误。谁能帮我解决这个问题?

注意:当我通过点击直接 mailchimp url 尝试使用 Postman 时,它工作正常。

电线日志:

 [2020-10-13 11:11:02,611] []  INFO - ApplicationManager Successfully Deployed Carbon Application : QRSagMailchimpIntegrator-CAR_1.0.0 {super-tenant}
[2020-10-13 11:11:14,590] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "POST /campaignSend/predict/sendCampaignId=d164a3989d?AuthKey=3216f54e-b6d9-11e6-80f5-76304dec7eb7 HTTP/1.1[\r][\n]"
[2020-10-13 11:11:14,591] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "User-Agent: PostmanRuntime/7.26.5[\r][\n]"
[2020-10-13 11:11:14,592] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Accept: */*[\r][\n]"
[2020-10-13 11:11:14,594] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Cache-Control: no-cache[\r][\n]"
[2020-10-13 11:11:14,595] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Postman-Token: 5a44668a-6947-4958-ad24-76fef6ddb62e[\r][\n]"
[2020-10-13 11:11:14,597] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Host: localhost:8280[\r][\n]"
[2020-10-13 11:11:14,598] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2020-10-13 11:11:14,599] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Connection: keep-alive[\r][\n]"
[2020-10-13 11:11:14,600] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "Content-Length: 0[\r][\n]"
[2020-10-13 11:11:14,601] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 >> "[\r][\n]"
[2020-10-13 11:11:14,684] []  INFO - LogMediator To: /campaignSend/predict/sendCampaignId=d164a3989d?AuthKey=3216f54e-b6d9-11e6-80f5-76304dec7eb7, MessageID: urn:uuid:aa380541-04f4-4bae-8d8a-d727a7f
a45ba, Direction: request, Welcome Logger = === Send Campaigns ===, Campaign ID = d164a3989d
[2020-10-13 11:11:15,742] []  INFO - HTTPSender Unable to sendViaPost to url[https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send/predict/sendCampaignId=d164a3989d?AuthKey=3216f54e-b
6d9-11e6-80f5-76304dec7eb7]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
        at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:326)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:196)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
        at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.synapse.message.senders.blocking.BlockingMsgSender.sendReceive(BlockingMsgSender.java:302)
        at org.apache.synapse.message.senders.blocking.BlockingMsgSender.send(BlockingMsgSender.java:211)
        at org.apache.synapse.mediators.builtin.CallMediator.handleBlockingCall(CallMediator.java:150)
        at org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:113)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.rest.Resource.process(Resource.java:343)
        at org.apache.synapse.rest.API.process(API.java:399)
        at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:69)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
        at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:78)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:326)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:372)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
[2020-10-13 11:11:15,778] []  INFO - LogMediator To: https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send/, MessageID: urn:uuid:aa380541-04f4-4bae-8d8a-d727a7fa45ba, Direction: reque
st, FAUALTYYYYYYYYYYYYYYYYYY************* = Transport error: 404 Error: Not Found
[2020-10-13 11:11:15,781] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "HTTP/1.1 202 Accepted[\r][\n]"
[2020-10-13 11:11:15,782] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "Date: Tue, 13 Oct 2020 05:41:15 GMT[\r][\n]"
[2020-10-13 11:11:15,783] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "Transfer-Encoding: chunked[\r][\n]"
[2020-10-13 11:11:15,784] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "Connection: keep-alive[\r][\n]"
[2020-10-13 11:11:15,785] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "[\r][\n]"
[2020-10-13 11:11:15,785] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "0[\r][\n]"
[2020-10-13 11:11:15,786] [] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "[\r][\n]"

邮递员:(直接 Mailchimp URL)

Mailchimp 网址

API 代码:

<api context="/campaignSend" name="campaign_send_v1" xmlns="http://ws.apache.org/ns/synapse">
<resource method="POST" uri-template="/predict/sendCampaignId={campaignId}?AuthKey={secKey}">
    <inSequence>
        <log>
            <property name="Welcome Logger" value="=== Send Campaigns ==="/>
            <property expression="get-property('uri.var.campaignId')" name="Campaign ID"/>
        </log>
        <property description="secKey" expression="get-property('uri.var.secKey')" name="secKey" scope="default" type="STRING"/>
        <property description="ESB-Authentication" expression="get-property('QRSag-VBFeedsAuthKey')" name="authKey" scope="default" type="OM"/>
        <property description="FeedsStoredAuthKey" expression="$ctx:authKey//*[local-name()='SecurityToken']" name="authenticatekey" scope="default" type="STRING"/>
        <!-- ==================== Check authentication ==================== -->
        <filter description="CheckUserAPIValidation" xpath="get-property('secKey') = get-property('authenticatekey')">
            <then/>
            <else>
                <payloadFactory media-type="json">
                    <format>{"errorCode":"$1","errorTrace":"$2"}</format>
                    <args>
                        <arg value="QRSaG - 401"/>
                        <arg value="Invalid Authentication.Contact QRSagSupport"/>
                    </args>
                </payloadFactory>
                <log level="custom">
                    <property expression="json-eval($.)" name="===API Authentication Failed==="/>
                </log>
                <respond/>
            </else>
        </filter>
        
        <property name="Authorization" scope="transport" type="STRING" value="Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
        <call blocking="true">
            <endpoint key="sendCampaign"/>
              <timeout>
                <duration>17000000</duration>
                <responseAction>fault</responseAction>
            </timeout>
        </call>
        <log>
            <property expression="json-eval($.)" name="LoggerText_JsonResponse"/>
        </log>
        <respond/>
    </inSequence>
    <outSequence/>
    <faultSequence>
    <log>
            <property expression="get-property('ERROR_MESSAGE')" name="FAUALTYYYYYYYYYYYYYYYYYY*************"/>
        </log>
    </faultSequence>
</resource>

端点值:

    <?xml version="1.0" encoding="UTF-8"?>
<endpoint name="sendCampaign" xmlns="http://ws.apache.org/ns/synapse">
    <http method="post" uri-template="https://us17.api.mailchimp.com/3.0/campaigns/{uri.var.campaignId}/actions/send/"/>
</endpoint>
4

1 回答 1

1

分析提供的信息,我们可以观察到对于邮递员请求,您正在调用 URL

https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send

但是从 ESB 服务器,您正在调用以下 URL

https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send/predict/sendCampaignId=d164a3989d?AuthKey=3216f54e-b
6d9-11e6-80f5-76304dec7eb7

这是因为为后端调用附加了上下文路径。您可以通过在调用中介之前添加以下属性来删除它。

<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>
于 2020-10-14T04:29:30.567 回答