I am working in Generate REST API from SOAP Backend in wso2 APIM but its not working for me - api

My resource looks like this after creating my APIM using wsdl url
<header description="SOAPAction" name="SOAPAction" scope="transport" value="urn:mediate"/>
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
<property expression="json-eval($.)" name="req.var."/>
<payloadFactory description="transform" media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://ws.apache.org/axis2">
<soapenv:Header/>
<soapenv:Body>
<web:mediate xmlns:web="http://ws.apache.org/axis2"/>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('req.var.')"/>
</args>
</payloadFactory>
<property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
I cannot understand this code...
When I try it gives
{
"Error": {
"Message": "invalid input"
}
}
In log I am getting
[2022-04-21 11:40:07,448] INFO - CarbonAuthenticationUtil 'admin#carbon.super [-1234]' logged in at [2022-04-21 11:40:07,448+0530]
[2022-04-21 11:40:07,760] 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 = /SampelProxyAPI/1.0/mediate, HTTP_METHOD = POST, SOCKET_TIMEOUT = 180000, CLIENT_ADDRESS = /0:0:0:0:0:0:0:1:49255, CONNECTION http-incoming-105
[2022-04-21 11:40:08,015] INFO - LogMediator STATUS = Message dispatched to the main sequence. Invalid URL., RESOURCE = /SampelProxyAPI/1.0/mediate, HEALTH CHECK URL = /SampelProxyAPI/1.0/mediate
[2022-04-21 11:48:54,087] WARN - SourceHandler I/O error: Received fatal alert: certificate_unknown

Related

WSO2 EI 6.6.0 with RabbitMQ 3.8.5 - Unable to get exact posted payload in rabbitmq console

I am just trying to post incoming payload to rabbitmq by using messageStore in WSO2 EI 6.6.0.
API-Code:
<api context="/testmqload" name="Test" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<log level="custom">
<property expression="json-eval($)" name="Test"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property name="messageType" value="application/json" scope="axis2"/>
<store messageStore="SafaricomRequestStore"/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
MessageStore:
<?xml version="1.0" encoding="UTF-8"?>
<messageStore class="org.apache.synapse.message.store.impl.rabbitmq.RabbitMQStore" name="SafaricomRequestStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="store.rabbitmq.host.name">puffin.rmq2.cloudamqp.com</parameter>
<parameter name="store.producer.guaranteed.delivery.enable">false</parameter>
<parameter name="store.rabbitmq.host.port">5672</parameter>
<parameter name="store.rabbitmq.route.key">SafaricomRequestQueue</parameter>
<parameter name="store.rabbitmq.username">username</parameter>
<parameter name="store.rabbitmq.virtual.host">host</parameter>
<parameter name="rabbitmq.connection.ssl.enabled">false</parameter>
<parameter name="store.rabbitmq.exchange.name">amq.direct</parameter>
<parameter name="store.rabbitmq.queue.name">SafaricomRequestQueueTest4</parameter>
<parameter name="store.rabbitmq.password">password</parameter>
</messageStore>
Incoming Request:
{
"result": {
"message": {
"M-PESA_Cash_Out": "10.00",
"M-PESA_Fee": "15.27",
"Transaction_Fee": "0.44",
"acct_no": "4000000009",
"date": "04-JAN-2022",
"power_id": "cab48a3b620e4b3f8d7c2d13a9efced7",
"receiving_mobile": "799999999",
"time": "17:47:29",
"total_amount": "25.71",
"transaction_id": "1002201040000053",
"wallet_bank": "M-PESA"
},
"new_txn_id": 1002201040000053,
"status": "S"
}
}
Message is posted in rabbitMQ like below
when i decoded above screenshot value by using base64 decoder online, getting below values.
If you notice above screenshot, i am geting some other values in addition to posted payload which is marked as yellow above.
By using Inbound endpoint, i tried to fetch message from queue which will print message structure like below in sequence.
{
"text":"base64 encoded value...."
}
may i know why it is having other extra values too in addition with posted payload? or what can i do to fetch only posted payload from queue?
As per tmoasz suggested in comment, modified Code- which are mentioned below.
Modified API :
<?xml version="1.0" encoding="UTF-8"?>
<api context="/rabbitmqtest" name="RabbitMQTestAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<log level="custom">
<property name="RabbitMQTestAPI" value="is called***"/>
<property name="IncomingRequest" expression="json-eval($)"/>
</log>
<property description="Initiate asynchronous mediation flow" name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property description="Generate 202 response from mediation flow" name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<send description="Publish request payload to AMQP endpoint">
<endpoint key="RabbitMQ-QueueEP"/>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Endpoint Code:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="RabbitMQ-QueueEP" xmlns="http://ws.apache.org/ns/synapse">
<address uri="rabbitmq:/RabbitMQTestQueue?rabbitmq.server.host.name=puffin.rmq2.cloudamqp.com&rabbitmq.server.port=5672&rabbitmq.server.user.name=username&rabbitmq.server.password=password&rabbitmq.queue.name=RabbitMQTestQueue&rabbitmq.exchange.name=amq.direct">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
Wire logs:
[2022-01-06 19:01:11,282] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "POST /rabbitmqtest HTTP/1.1[\r][\n]"
[2022-01-06 19:01:11,283] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Content-Type: application/json[\r][\n]"
[2022-01-06 19:01:11,285] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "User-Agent: PostmanRuntime/7.28.4[\r][\n]"
[2022-01-06 19:01:11,286] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Accept: */*[\r][\n]"
[2022-01-06 19:01:11,289] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Cache-Control: no-cache[\r][\n]"
[2022-01-06 19:01:11,290] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Postman-Token: 75a4502d-7df0-444e-8ba8-39bcd6265204[\r][\n]"
[2022-01-06 19:01:11,290] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Host: localhost:8280[\r][\n]"
[2022-01-06 19:01:11,291] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2022-01-06 19:01:11,292] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Connection: keep-alive[\r][\n]"
[2022-01-06 19:01:11,292] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "Content-Length: 25[\r][\n]"
[2022-01-06 19:01:11,293] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "[\r][\n]"
[2022-01-06 19:01:11,300] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "{[\r][\n]"
[2022-01-06 19:01:11,301] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> " "name":"justin"[\r][\n]"
[2022-01-06 19:01:11,302] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-4 >> "}"
[2022-01-06 19:01:11,306] INFO {org.apache.synapse.mediators.builtin.LogMediator} - RabbitMQTestAPI = is called***, IncomingRequest = {
"name":"justin"
}
[2022-01-06 19:01:11,309] INFO {org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory} - Initializing channel pool of 20
[2022-01-06 19:01:11,879] ERROR {org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory} - [puffin.rmq2.cloudamqp.com_5672_username_passwordI_null_null_null_null_null_null_null_null_null] Error creating connection to RabbitMQ Broker. Reattempting to connect. java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:382)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:58)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:103)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:877)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:839)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:661)
at org.apache.axis2.transport.rabbitmq.utils.RabbitMQUtils.createConnection(RabbitMQUtils.java:56)
at org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory.createConnection(RabbitMQConnectionFactory.java:159)
at org.apache.axis2.transport.rabbitmq.RMQChannelPool.<init>(RMQChannelPool.java:20)
at org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactory.initializeConnectionPool(RabbitMQConnectionFactory.java:392)
at org.apache.axis2.transport.rabbitmq.RabbitMQConnectionFactoryManager.getConnectionFactory(RabbitMQConnectionFactoryManager.java:105)
at org.apache.axis2.transport.rabbitmq.RabbitMQSender.getConnectionFactory(RabbitMQSender.java:135)
at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:81)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:634)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:85)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:571)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:408)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:74)
at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:56)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:331)
at org.apache.synapse.rest.API.process(API.java:441)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:135)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:113)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:71)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:327)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:98)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:368)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:427)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:182)
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)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'username', class-id=10, method-id=40)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)
... 42 more
If you want to send, just JSON message as payload to RabbitMQ, don't use message store. Message stores, are storing all synapse message context with payload for later processing - that is their purpose. So that is why you see in decoded RabbitMQ Payload not only the message, but also additional properties.
For sending JSON to RabbitMQ you can use just <send/> to a proper endpoint.
Look as this documentation sample.
I have also have made some sequance template for more easy use of sending messages to rabitmq, so next you can may look at this helpful post, and adapt to your own needs.
I have resolved above issue by making endpoint call with the use of send mediator as #tmoasz suggested instead of message store.
API Code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/rabbitmqtest" name="RabbitMQTestAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<log level="custom">
<property name="RabbitMQTestAPI" value="is called***"/>
<property name="IncomingRequest" expression="json-eval($)"/>
</log>
<property description="Initiate asynchronous mediation flow" name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property description="Generate 202 response from mediation flow" name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<send description="Publish request payload to AMQP endpoint">
<endpoint key="RabbitMQ-QueueEP"/>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
RabbitMQ-QueueEP :
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="RabbitMQ-QueueEP" xmlns="http://ws.apache.org/ns/synapse">
<address uri="rabbitmq:/AMQPConnectionFactory?rabbitmq.server.host.name=puffin.rmq2.cloudamqp.com&rabbitmq.server.port=5672&rabbitmq.server.user.name=username&rabbitmq.server.password=password&rabbitmq.queue.name=RabbitMQTestQueue&rabbitmq.queue.routing.key=RabbitMQTestQueue&rabbitmq.server.virtual.host=hostname&rabbitmq.exchange.name=amq.direct">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
API Hit:
RabbitMQ Console:

how can set header mediator value with runtime value in WSO2 APIM 2.6?

I get a token authorization parameter from a Login API. I need to use this token in my header parameters I gave with In Flow mediator in another API.so I try use CORS configuration and get the token parameter as type header and fill it when invoking the API.
I gave this token value in mediator with static value and It worked. But this value is dynamically changed by invoking Login API so I have to give run time value.
my mediator is :
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="tokenMediator" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="full"/>
<header name="caller-token" scope="transport" value="123"/>
<header name="Content-Type" scope="transport" value="application/json"/>
<header name="Access-Control-Allow-Origin" scope="transport" value="http://onlinewebapi"/>
<header expression="$header:token" name="Authorization" scope="transport"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
</sequence>
when I invoke API I get this : "TypeError: Failed to fetch"
and it don't pass WSO2 to reach my local codes.
I changed the name of parameter from token to authorization and result don't changed.

Getting "Connection closed before sending request out" in WSO2 ESB for newly created API

I'm getting "Connection closed before sending request out" in my WSO2 ESB API when a request is made to an endpoint. I am not using a proxy server.
Here is the source for the API that I have created:
<api xmlns="http://ws.apache.org/ns/synapse" name="WorkspaceONEUser" context="/workspaceone/user" port="8243">
<resource methods="POST" uri-template="*">
<inSequence>
<log>
<property name="Message Flow" value="POST WorkspaceONEUser Search - IN"/>
</log>
<send>
<endpoint key="workspaceOneUserSearchEndpoint"/>
</send>
</inSequence>
<outSequence>
<property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
<property name="Access-Control-Allow-Origin" value="HOST_NAME" scope="transport" type="STRING"/>
<property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
<log>
<property name="Message Flow" value="POST WorkspaceONEUser - OUT"/>
</log>
<log level="full"/>
<send/>
</outSequence>
<faultSequence>
<log>
<property name="message" value="in fault"/>
<property name="text" value="An unexpected error occured"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="header" expression="get-property('REQUEST_HOST_HEADER')"/>
</log>
</faultSequence>
</resource>
<resource methods="OPTIONS" url-mapping="/">
<inSequence>
<log>
<property name="Message Flow" value="IN OPTIONS"/>
</log>
<log level="full"/>
<property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
<property name="Access-Control-Allow-Origin" value="https://HOST_NAME" scope="transport" type="STRING"/>
<property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
<respond/>
</inSequence>
</resource>
</api>
In the logs, it appears that the connection is being closed before it is sent out:
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - Sending message through endpoint : workspaceOneUserSearchEndpoint resolving to address = https://TARGET_HOST {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - SOAPAction: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - WSA-Action: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Sending [add = false] [sec = false] [mtom = false] [swa = false] [format = null] [force soap11=false] [force soap12=false] [pox=false] [get=false] [encoding=null] [to=https://TARGET_HOST] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Message [Original Request Message ID : urn:uuid:09116122-22b4-4acf-be8e-31570623bd39] [New Cloned Request Message ID : urn:uuid:b242c096-4348-4977-8048-d70a5ac8c15b] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Setting Timeout for endpoint : Endpoint [workspaceOneUserSearchEndpoint], URI : https://TARGET_HOST to static timeout value : 120000 {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,284] DEBUG {org.apache.synapse.core.axis2.SynapseCallbackReceiver} - Callback added. Total callbacks waiting for : 2 {org.apache.synapse.core.axis2.SynapseCallbackReceiver}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} - start writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} - end writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.builtin.SendMediator} - End : Send mediator {org.apache.synapse.mediators.builtin.SendMediator}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - End : Sequence <anonymous> {org.apache.synapse.mediators.base.SequenceMediator}
TID: [-1] [] [2019-01-28 13:38:34,781] WARN {org.apache.synapse.transport.passthru.TargetHandler} - Connection closed before sending request out Remote Address : wsoidm01pa.jefferson.edu/147.140.23.161:443 {org.apache.synapse.transport.passthru.TargetHandler}
Does anyone know what might be causing this? I suspect that this indicates a connection between the ESB and a downstream server has closed before the ESB was able to completely write the request out.
However, I'm able to POST to the same endpoint from another API that's almost identical. Is there something that's obviously wrong with my API or endpoint that's causing this mysterious problem?
Try to add this property before your <send> mediator.
<property name="ClientApiNonBlocking"
value="true"
scope="axis2"
action="remove"/>
It will remove your Client Api Non Blocking in your <send> mediator (which is enable by default)

WSO2 ESB 4.9 Call mediator is not working fine in same situations

I have a proxy service with below definition:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<header name="Action" value="urn:loadPerson"/>
<payloadFactory media-type="xml">
<format>
<sear:loadPerson xmlns:sear="http://localhost/SearchService">
<sear:Id>1234</sear:Id>
</sear:loadPerson>
</format>
<args/>
</payloadFactory>
<log level="full"/>
<call>
<endpoint key="SearchService"/>
</call>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
So it's work fine when I call the proxy service(by tryIt) first time and I get right response of proxy service but for the next time it faces a problem and show me fault response:
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>axis2ns11:Server</faultcode>
<faultstring>Missing operation for soapAction [urn:loadPerson] and body element [null] with SOAP Version [SOAP 1.1]</faultstring>
</soapenv:Fault>
As you can see I log the message and it's the same for every proxy call:
INFO - LogMediator To: /services/TestProxy.TestProxyHttpSoap11Endpoint, WSAction: urn:loadPerson, SOAPAction: urn:loadPerson, MessageID: urn:uuid:cc9557cc-e2a0-4b8d-97a8-ae393a411157, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><sear:loadPerson xmlns:sear="http://localhost/SearchService"><sear:Id>1234</sear:Id></sear:loadPerson></soapenv:Body></soapenv:Envelope>
I found that the problem resolved by restarting the server(not redeploying the proxy service) or leave it for few minutes!
any idea?!

Retrieve ActiveMQ Header during mediation in WSO2 ESB

My ActiveMQ client is setting few custom header while posting message to ActiveMQ Queue, as shown below
MessageProducer producer = session.createProducer(destination);
TextMessage message = session.createTextMessage("<Message>Test</Message>");
message.setStringProperty("ID", "XYZ");
message.setStringProperty("CODE", "COUNTRY_CODE");
producer.send(message);
In WSO2 ESB sequence, I am trying to retrieve "ID" and "CODE" as
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="ID" expression="get-property('axis2', 'ID')" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="CODE" expression="get-property('axis2', 'CODE')" scope="default" type="STRING"/>
But this is returning null, I even tried to set the scope as transport. Please advise.
You have to use the following expression because the custom jms headers are stored in the transport layer.
<property name="CREATE_PROXY - Config Params"
expression="get-property('transport','TRANSPORT_ID')"/>