Hi APIM Team,

When i was trying to invoke a custom endpoint which dynamically changes
with a header value using a send mediator in my custom sequence, i
experienced a behavior where the request will go first to the endpoint of
my custom sequence after that it will send a request to the endpoint
specified when creating the API (Production endpoint) . I am trying to
understand the reason for two requests being sent in this scenario? I would
be grateful if you could explain to me why this is happening.

When API is invoked which uses the custom in sequence following was seen on
the wire logs. I have also attached the complete wire logs received to the
mail.

 DEBUG - wire << "GET
/t/backstage/webapps/customerservice-1.1.0/services/customers/customerservice/customerservice/customers/123
HTTP/1.1[\r][\n]"

DEBUG - wire << "GET
/t/backstage/webapps/customerservice-default-SNAPSHOT/services/customers/customerservice/customerservice/customers/123
HTTP/1.1[\r][\n]"

I have attached my custom sequences as well. Your help will be much
appreciated on this matter.

Thanks and Regards
Shenavi
[2015-12-09 16:52:29,228] DEBUG - wire >> "GET 
/newApp/1.0/customerservice/customers/123 HTTP/1.1[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "User-Agent: curl/7.35.0[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "Host: 10.100.7.47:8243[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "Accept: application/json[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "Version: 
customerservice-1.1.0[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "Authorization: Bearer 
f2dab8c6f39a1a1239cee8f299ce4[\r][\n]"
[2015-12-09 16:52:29,228] DEBUG - wire >> "[\r][\n]"
[2015-12-09 16:52:29,230]  INFO - LogMediator uri.var.version = 
customerservice-1.1.0
[2015-12-09 16:52:29,914] DEBUG - wire << "GET 
/t/backstage/webapps/customerservice-1.1.0/services/customers/customerservice/customerservice/customers/123
 HTTP/1.1[\r][\n]"
[2015-12-09 16:52:29,914] DEBUG - wire << "Version: 
customerservice-1.1.0[\r][\n]"
[2015-12-09 16:52:29,914] DEBUG - wire << "Accept: application/json[\r][\n]"
[2015-12-09 16:52:29,914] DEBUG - wire << "Host: 
appserver.dev.cloud.wso2.com:80[\r][\n]"
[2015-12-09 16:52:29,915] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2015-12-09 16:52:29,915] DEBUG - wire << "User-Agent: 
Synapse-PT-HttpComponents-NIO[\r][\n]"
[2015-12-09 16:52:29,915] DEBUG - wire << "[\r][\n]"
[2015-12-09 16:52:30,149] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2015-12-09 16:52:30,149] DEBUG - wire >> "Content-Type: 
application/json[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire >> "Date: Wed, 09 Dec 2015 11:22:05 
GMT[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire >> "Server: 
WSO2-PassThrough-HTTP[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "GET 
/t/backstage/webapps/customerservice-default-SNAPSHOT/services/customers/customerservice/customerservice/customers/123
 HTTP/1.1[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "Version: 
customerservice-1.1.0[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "Accept: application/json[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "Host: 
appserver.dev.cloud.wso2.com:80[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire << "User-Agent: 
Synapse-PT-HttpComponents-NIO[\r][\n]"
[2015-12-09 16:52:30,150] DEBUG - wire >> "[\r][\n]"
[2015-12-09 16:52:30,151] DEBUG - wire >> "25[\r][\n]"
[2015-12-09 16:52:30,151] DEBUG - wire >> 
"{"Customer":{"id":123,"name":"John"}}[\r][\n]"
[2015-12-09 16:52:30,151] DEBUG - wire >> "0[\r][\n]"
[2015-12-09 16:52:30,151] DEBUG - wire >> "[\r][\n]"
[2015-12-09 16:52:30,151] DEBUG - wire << "[\r][\n]"
[2015-12-09 16:52:30,152]  INFO - LogMediator To: 
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , 
MessageID: urn:uuid:20e7b918-e0f3-4925-88bb-26e80e2d8014, Direction: response, 
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><jsonObject><Customer><id>123</id><name>John</name></Customer></jsonObject></soapenv:Body></soapenv:Envelope>
[2015-12-09 16:52:30,153] DEBUG - wire << "HTTP/1.1 200 OK[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Access-Control-Allow-Headers: 
authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Access-Control-Allow-Origin: 
*[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Access-Control-Allow-Methods: 
GET[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Content-Type: 
application/json[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Date: Wed, 09 Dec 2015 11:22:30 
GMT[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Server: 
WSO2-PassThrough-HTTP[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "25[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << 
"{"Customer":{"id":123,"name":"John"}}[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "0[\r][\n]"
[2015-12-09 16:52:30,153] DEBUG - wire << "[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "Content-Type: 
application/json[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "Date: Wed, 09 Dec 2015 11:22:05 
GMT[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "Server: 
WSO2-PassThrough-HTTP[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "25[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> 
"{"Customer":{"id":123,"name":"John"}}[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "0[\r][\n]"
[2015-12-09 16:52:30,388] DEBUG - wire >> "[\r][\n]"
[2015-12-09 16:52:30,390]  INFO - LogMediator To: 
http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , 
MessageID: urn:uuid:2fc3ad1b-bcb3-492a-a999-5730dfb32fd7, Direction: response, 
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><jsonObject><Customer><id>123</id><name>John</name></Customer></jsonObject></soapenv:Body></soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse"; name="versionManagerSequence">
    <property name="uri.var.version" expression="get-property('transport','Version')" scope="default" type="STRING"/>
    <log level="custom">
        <property name="uri.var.version" expression="get-property('transport','Version')"/>
    </log>
    <filter source="boolean(get-property('uri.var.version'))" regex="true">
        <then>
            <send>
                <endpoint>
                    <http method="get" uri-template="http://appserver.dev.cloud.wso2.com/t/backstage/webapps/{uri.var.version}/services/customers/customerservice"/>
                </endpoint>
            </send>
        </then>
        <else>
            <send>
                <endpoint>
                    <http method="get" uri-template="http://appserver.dev.cloud.wso2.com/t/backstage/webapps/customerservice-default-SNAPSHOT/services/customers/customerservice"/>
                </endpoint>
            </send>
        </else>
    </filter>
</sequence>
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse"; name="sampleOutSequence">
    <log level="full"/>
</sequence>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to