Scenario: The API basically calls an endpoint to get the token and then sets the token in the header and calls another endpoint along with other query parameters.
Problem: I'm getting the null resolving to address issue.
[2022-11-09 18:08:19,327] INFO {LogMediator} - {api:MsaasproEsb} To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:e763462f-c7dc-4f3d-a8ba-b23c5f66a241, correlation_id: 7dba4bab-4218-48ca-9871-e4c2d249a91b, Direction: request, Payload: {"Data": {"status": 200, "id": 190, "user_id": "secpapi", "email": "Faisal.furqan@secp.gov.pk", "token": "9704e4de2acde3af0686c22d409f831db3d1fd76"}}
[2022-11-09 18:08:19,328] INFO {TRACE_LOGGER} - Sending message through endpoint : null resolving to address = https://msaaspro.com/api/v1/scan/pep-scan/?fullname={uri.var.name}&searchtype=fuzzy&fathername={uri.var.fatherName}&dobyear={uri.var.dobYear}&cnic={uri.var.cnic}&mobile={uri.var.mobile}&country={uri.var.country}&name_similarity=90
[2022-11-09 18:08:19,328] INFO {TRACE_LOGGER} - SOAPAction:
[2022-11-09 18:08:19,328] INFO {TRACE_LOGGER} - WSA-Action:
[2022-11-09 18:09:17,775] INFO {SourceHandler} - Writer null when calling informWriterError
[2022-11-09 18:09:17,775] WARN {SourceHandler} - STATE_DESCRIPTION = Socket Timeout occurred after accepting the request headers and the request body, INTERNAL_STATE = REQUEST_DONE, DIRECTION = REQUEST, CAUSE_OF_ERROR = Connection between the client and the EI timeouts, HTTP_URL = /msaaspro/send, HTTP_METHOD = POST, SOCKET_TIMEOUT = 180000, CLIENT_ADDRESS = /127.0.0.1:55470, CONNECTION http-incoming-4 Correlation ID : 965986e6-2d6b-4108-aefe-3a7a648eb61a
[2022-11-09 18:10:44,079] INFO {SourceHandler} - Writer null when calling informWriterError
[2022-11-09 18:10:44,079] WARN {SourceHandler} - STATE_DESCRIPTION = Socket Timeout occurred after accepting the request headers and the request body, INTERNAL_STATE = REQUEST_DONE, DIRECTION = REQUEST, CAUSE_OF_ERROR = Connection between the client and the EI timeouts, HTTP_URL = /msaaspro/send, HTTP_METHOD = POST, SOCKET_TIMEOUT = 180000, CLIENT_ADDRESS = /127.0.0.1:58755, CONNECTION http-incoming-5 Correlation ID : 1fc72034-a9d1-46ad-9198-d18810065c10
[2022-11-09 18:11:19,011] INFO {SourceHandler} - Writer null when calling informWriterError
[2022-11-09 18:11:19,011] WARN {SourceHandler} - STATE_DESCRIPTION = Socket Timeout occurred after accepting the request headers and the request body, INTERNAL_STATE = REQUEST_DONE, DIRECTION = REQUEST, CAUSE_OF_ERROR = Connection between the client and the EI timeouts, HTTP_URL = /msaaspro/send, HTTP_METHOD = POST, SOCKET_TIMEOUT = 180000, CLIENT_ADDRESS = /127.0.0.1:58781, CONNECTION http-incoming-6 Correlation ID : 7dba4bab-4218-48ca-9871-e4c2d249a91b
Source code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/msaaspro" name="MsaasproEsb" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/send">
<inSequence>
<property description="username" name="username" scope="default" type="STRING" value="json-eval($.username)"/>
<property description="password" name="password" scope="default" type="STRING" value="json-eval($.password)"/>
<call>
<endpoint>
<http method="post" statistics="enable" uri-template="https://msaaspro.com/api/v1/auth/auth-token/">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<property description="token" name="token" scope="default" type="STRING" value="json-eval($.Data.token)"/>
<property description="Authorization" name="Authorization" scope="transport" type="STRING" value="fn:concat('Token ', get-property('token'))"/>
<property description="name" name="uri.var.name" scope="default" type="STRING" value="json-eval($.name)"/>
<property description="fatherName" name="uri.var.fatherName" scope="default" type="STRING" value="json-eval($.fatherName)"/>
<property description="dobYear" name="uri.var.dobYear" scope="default" type="STRING" value="json-eval($.dobYear)"/>
<property description="uniqueKey" name="uri.var.cnic" scope="default" type="STRING" value="json-eval($.cnic)"/>
<property description="country" name="uri.var.country" scope="default" type="STRING" value="json-eval($.country)"/>
<property description="mobile" name="uri.var.mobile" scope="default" type="STRING" value="json-eval($.mobile)"/>
<log level="full"/>
<call>
<endpoint>
<http method="get" statistics="enable" trace="enable" uri-template="https://msaaspro.com/api/v1/scan/pep-scan/?fullname={uri.var.name}&searchtype=fuzzy&fathername={uri.var.fatherName}&dobyear={uri.var.dobYear}&cnic={uri.var.cnic}&mobile={uri.var.mobile}&country={uri.var.country}&name_similarity=90">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
</inSequence>
<outSequence>
<respond/>
</outSequence>
<faultSequence/>
</resource>
</api>
Question: My exact question is why I'm getting null resolving issue while I've set properties for all the parameters that I've passed to the endpoint. I'm able to call the first endpoint and I successfully get the token but somehow I'm unable to call the second endpoint.
expression
parameter instead of value
. For example,<property description="token" name="token" scope="default" type="STRING" value="json-eval($.Data.token)"/>
should be updated as follows,
<property description="token" name="token" scope="default" type="STRING" expression="json-eval($.Data.token)"/>
Can you update all the property mediators as above and try them out?
<respond/>
mediator after the call mediator in your insequence. To send the response back to the client you need to have Respond Mediator.Regarding the log message Sending message through endpoint : null resolving to address
, since we have used an anonymous endpoint, the trace logger couldn't resolve a name for the endpoint. That's why it's printing a null
in the trace log.