I am using WSO2 Payload factory to create one soap request in which some information is sent to third party. This payload removes my soap header value. Can anyone please help me out in this. I can see only body is being passed and header is getting removed.
I have to use below request to get some token
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oas="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:sec="http://schemas.cdi.ltsa.govt.nz/SecurityService.xsd" xmlns:sec1="http://schemas.cdi.ltsa.govt.nz/SecurityService" xmlns:oas1="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:acc="http://schemas.cdi.ltsa.govt.nz/Security/AccessControl/" xmlns:sec2="http://localhost/Schema/SecurityService">
<soapenv:Header>
<oas:Security>
<oas:UserNameToken>
<oas:UserName>XXXX</oas:UserName>
<oas:Password>XXXX</oas:Password>
</oas:UserNameToken>
</oas:Security>
</soapenv:Header>
<soapenv:Body>
<acc:AuthenticateClient>
<sec2:AuthenticateClientRequest>
<sec2:RequestBody></sec2:RequestBody>
</sec2:AuthenticateClientRequest>
</acc:AuthenticateClient>
</soapenv:Body>
</soapenv:Envelope>
<header name="SOAPAction" scope="transport" value="http://schemas.cdi.ltsa.govt.nz/Security/AccessControl/AuthenticateClient"/>
<script language="js"><![CDATA[var envelope = mc.getEnvelopeXML();
var oas = new Namespace('http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd');
mc.addHeader(false, <oas:Security xmlns:oas="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<oas:UserNameToken>
<oas:UserName>XXXX</oas:UserName>
<oas:Password>XXXX</oas:Password>
</oas:UserNameToken>
</oas:Security>
);]]></script>
<payloadFactory media-type="xml">
<format>
<Body>
<AuthenticateClient>
<AuthenticateClientRequest>
<RequestBody/>
</AuthenticateClientRequest>
</AuthenticateClient>
</Body>
</format>
<args>
<arg evaluator="xml" expression="$ctx:UserName" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml" expression="$ctx:Password" xmlns:ns="http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
<log level="full"/>
<call>
<endpoint>
<address trace="disable" uri="http://XXXX:28080/services/XXXX"/>
</endpoint>
</call>
<respond/>
Logs:
wire << "POST /services/B2BProxyVechicle HTTP/1.1[\r][\n]"
[2017-09-18 16:38:12,230] DEBUG - wire << "SOAPAction: http://XXXXX/AccessControl/AuthenticateClient[\r][\n]"
[2017-09-18 16:38:12,225] DEBUG - SequenceMediator End : Sequence key=<Value {name ='null', keyValue ='PPSR_VehicleInfo_IN_SEQ'}>
[2017-09-18 16:38:12,245] DEBUG - SequenceMediator End : Sequence <anonymous>
[2017-09-18 16:38:12,238] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-09-18 16:38:12,253] DEBUG - wire << "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[2017-09-18 16:38:12,257] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2017-09-18 16:38:12,261] DEBUG - wire << "Host: 1r][\n]"
[2017-09-18 16:38:12,265] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2017-09-18 16:38:12,268] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2017-09-18 16:38:12,273] DEBUG - wire << "[\r][\n]"
[2017-09-18 16:38:12,275] DEBUG - wire << "a3[\r][\n]"
[2017-09-18 16:38:12,278] DEBUG - wire << "<Body xmlns="http://ws.apache.org/ns/synapse"><AuthenticateClient><AuthenticateClientRequest><RequestBody/></AuthenticateClientRequest></AuthenticateClient></Body>[\r][\n]"
[2017-09-18 16:38:12,292] DEBUG - wire << "0[\r][\n]"
[2017-09-18 16:38:12,294] DEBUG - wire << "[\r][\n]"
[2017-09-18 16:38:12,305] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2017-09-18 16:38:12,309] DEBUG - wire >> "Host: 3[\r][\n]"
[2017-09-18 16:38:12,313] DEBUG - wire >> "SOAPAction: "http://XXXXXX/AccessControl/AuthenticateClient"[\r][\n]"
[2017-09-18 16:38:12,321] DEBUG - wire >> "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-09-18 16:38:12,325] DEBUG - wire >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[2017-09-18 16:38:12,330] DEBUG - wire >> "Date: Mon, 18 Sep 2017 04:38:12 GMT[\r][\n]"
[2017-09-18 16:38:12,334] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2017-09-18 16:38:12,337] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2017-09-18 16:38:12,341] DEBUG - wire >> "[\r][\n]"
[2017-09-18 16:38:12,343] DEBUG - wire >> "94[\r][\n]"
[2017-09-18 16:38:12,346] DEBUG - wire >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>[\r][\n]"
[2017-09-18 16:38:12,360] DEBUG - wire >> "0[\r][\n]"
[2017-09-18 16:38:12,362] DEBUG - wire >> "[\r][\n]"
[2017-09-18 16:38:12,364] DEBUG - SynapseCallbackReceiver Callback removed for request message id : urn. Pending callbacks count : 0
[2017-09-18 16:38:12,375] DEBUG - SynapseCallbackReceiver Synapse received an asynchronous response message
Try to add the following properties.
<property name="PRESERVE_WS_ADDRESSING" value="true"/>
<property name="preserveProcessedHeaders" value="true" scope="default"/>
You can also add custom headers, like described here.
https://docs.wso2.com/display/ESB490/Custom+SOAP+Headers
Related
I am trying FileMerge Operation in WSO2 EI 6.6.0 using FileConnector 2.0.24.
The problem here is that it is generating an output file with empty content.
API Code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/mergefiles" name="FileMergeAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<log level="custom">
<property name="********FileMergeAPI" value="Called***********"/>
</log>
<property expression="json-eval($.source)" name="sourceDir" scope="default" type="STRING"/>
<property expression="json-eval($.destination)" name="destDir" scope="default" type="STRING"/>
<property expression="json-eval($.pattern)" name="pattern"/>
<property expression="fn:concat('file:///', $ctx:sourceDir)" name="sourceDir1" scope="default" type="STRING"/>
<property expression="fn:concat('file:///', $ctx:destDir)" name="destDir1" scope="default" type="STRING"/>
<fileconnector.mergeFiles>
<source>{$ctx:sourceDir1}</source>
<destination>{$ctx:destDir1}</destination>
<filePattern>{$ctx:pattern}</filePattern>
</fileconnector.mergeFiles>
<log level="full"/>
</inSequence>
<outSequence/>
<faultSequence>
<log level="custom">
<property name="text" value="An unexpected error occured"/>
<property expression="get-property('ERROR_MESSAGE')" name="message"/>
<property expression="get-property('ERROR_DETAIL')" name="errordetail"/>
</log>
<send description="Send Error Information"/>
</faultSequence>
</resource>
</api>
Input:
{
"source":"C://Development_Avecto//filemerge//input",
"destination":"C://Development_Avecto//filemerge//output//sample.csv",
"pattern":"//*.csv*"
}
wireLog:
[2022-05-02 13:13:13,417] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "POST /mergefiles HTTP/1.1[\r][\n]"
[2022-05-02 13:13:13,419] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Content-Type: application/json[\r][\n]"
[2022-05-02 13:13:13,422] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "User-Agent: PostmanRuntime/7.29.0[\r][\n]"
[2022-05-02 13:13:13,423] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Accept: */*[\r][\n]"
[2022-05-02 13:13:13,425] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Cache-Control: no-cache[\r][\n]"
[2022-05-02 13:13:13,426] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Postman-Token: dd7b1a25-b87e-4d64-b474-36b13159042a[\r][\n]"
[2022-05-02 13:13:13,427] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Host: 192.168.43.128:8280[\r][\n]"
[2022-05-02 13:13:13,428] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2022-05-02 13:13:13,429] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Connection: keep-alive[\r][\n]"
[2022-05-02 13:13:13,433] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Content-Length: 164[\r][\n]"
[2022-05-02 13:13:13,436] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "[\r][\n]"
[2022-05-02 13:13:13,438] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "{[\r][\n]"
[2022-05-02 13:13:13,438] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> " "source":"C://Development_Avecto//filemerge//input",[\r][\n]"
[2022-05-02 13:13:13,439] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> " "destination":"C://Development_Avecto//filemerge//output//sample.csv",[\r][\n]"
[2022-05-02 13:13:13,440] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> " "pattern":"//*.csv*"[\r][\n]"
[2022-05-02 13:13:13,441] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "}"
[2022-05-02 13:13:13,444] INFO {org.apache.synapse.mediators.builtin.LogMediator} - ********FileMergeAPI = Called***********
[2022-05-02 13:13:13,464] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /mergefiles, MessageID: urn:uuid:90d67ec1-2a3f-4f13-8389-049a24abbdab, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><success>true</success></soapenv:Body></soapenv:Envelope>
[2022-05-02 13:13:13,478] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "HTTP/1.1 202 Accepted[\r][\n]"
[2022-05-02 13:13:13,479] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Date: Mon, 02 May 2022 07:43:13 GMT[\r][\n]"
[2022-05-02 13:13:13,480] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Transfer-Encoding: chunked[\r][\n]"
[2022-05-02 13:13:13,481] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Connection: keep-alive[\r][\n]"
[2022-05-02 13:13:13,481] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "[\r][\n]"
[2022-05-02 13:13:13,483] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "0[\r][\n]"
[2022-05-02 13:13:13,483] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "[\r][\n]"
if you noticed above wire log i got success response post mergefile operation like below
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><success>true</success></soapenv:Body></soapenv:Envelope>
I already looked this question which doesn't resolve my issue
File 1 content :
File 2 content:
PS: WSO2 EI 6.5.0 also tried the same. getting empty file
What is wrong with the above configuration?
I am trying to send Campaign by using Mailchimp. While calling this endpoint, i am getting ERROR like "Transport error: 404 Error: Not Found". Can anyone please help me out to resolve this?
Note: When i try in Postman by hitting direct mailchimp url it works fine.
Wire Log:
[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]"
Postman: (Direct Mailchimp URL)
Mailchimp URL
API Code:
<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>
Endpoint Value:
<?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>
Analyzing the provided information we can observe that for the postman request you are invoking the URL
https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send
But from the ESB server, you are invoking the following URL
https://us17.api.mailchimp.com/3.0/campaigns/d164a3989d/actions/send/predict/sendCampaignId=d164a3989d?AuthKey=3216f54e-b
6d9-11e6-80f5-76304dec7eb7
This is because the context path is appended for the backend call. You can remove this by adding the following property before the call mediator.
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>
Use Case:
A REST API will be defined to handle the files sent by clients called (Postman REST Client) as attachment.
The files sent as attachment will be sent to Zoho Task Creation Endpoint in order to create task with Document.
Note: When i tried with postman directly by calling Zoho task Creation API, It creates task with Document.
Can anyone please let me know how to achieve this in API of WSO2 EI 6.1.1
Postman:
When i put log level="full" inside api,getting below log.
When i decode it via Online Tool which gives base64 decoded content like below.
API Code:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/uploadAttachment" name="AtatchmentAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<property name="messageType" scope="axis2" type="STRING" value="multipart/form-data"/>
<!-- <log level="full"/> -->
<log level="custom">
<property name="========UploadAttachment" value=" API Called=========="/>
<property name="========AttachmentName===" expression="get-property('transport', 'filename')"/>
</log>
<property expression="get-property('registry','gov:/ZohoConfig/ZohoAppConfigFile.txt')" name="accessToken" scope="default" type="STRING"/>
<!-- <log level="full"/> -->
<payloadFactory media-type="xml">
<format>
<ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:binary>
</format>
<args>
<arg evaluator="xml" expression="//*[local-name()='binary']/text()"/>
</args>
</payloadFactory>
<script language="js">
<![CDATA[
var binaryNode =
mc.getEnvelope().getBody().getFirstElement().getFirstOMChild();
binaryNode.setBinary(true);
]]>
</script>
<property name="attachment_base64" expression="$body"/>
<log level="custom">
<property name="====attachment_base64====" expression="$body"></property>
</log>
<payloadFactory description="Form Response Payload" media-type="json">
<format>{"uploaddoc":$1}</format>
<args>
<arg evaluator="xml" expression="$ctx:attachment_base64"/>
</args>
</payloadFactory>
<log level="custom">
<property name="====uploaddoc_Payload====" expression="$body"></property>
</log>
<!-- <log level="full"/> -->
<property name="transport.vfs.ReplyFileName" value="ZohoTestFile.txt" scope="transport"/>
<property name="transport.vfs.Streaming" value="true" scope="transport"/>
<property name="ClientApiNonBlocking" action="remove" scope="axis2"/>
<property name="messageType" scope="axis2" value="application/binary"/>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<header expression="fn:concat('Bearer ', '1000.CCCCCCCCCC.XXXXXXXXXXXXXXXXXX')" name="Authorization" scope="transport"/>
<call>
<endpoint>
<address uri="https://projectsapi.zoho.com/restapi/portal/36249112/projects/685798000000976352/tasks/685798000011774999/attachments/"/>
</endpoint>
</call>
<log>
<property expression="json-eval($.)" name="==API Response======"/>
</log>
<!-- <payloadFactory description="Form Response Payload" media-type="json">
<format>{"recipients":"Regularrrrrrrrrrrrr"}</format>
<args/>
</payloadFactory>
<log>
<property expression="json-eval($.)" name="==Final- CampaignBuilder_JsonRequest_ForCreation======"/>
</log> -->
<respond/>
<!-- <property expression="String(//mediate/file/#filename)" name="filename" scope="default" type="STRING"/> -->
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
API Response:
{
"error": {
"code": 6831,
"message": "Input Parameter Missing"
}
}
Reason: need to pass attachment to the param called "uploaddoc" when calling Zoho API. here i don't know how to set attachment to that field
Wire Logs:
3:04:42,565] [] INFO - APIDeployer API named 'AtatchmentAPI' has been deployed from file : D:\ServerSetup 6.1.1\wso2ei-6.1.1\wso2\tmp\carbonapps\-1234\1602833682469Att
-CAR_1.0.0.car\AtatchmentAPI_1.0.0\AtatchmentAPI-1.0.0.xml
3:04:42,565] [] INFO - ApplicationManager Successfully Deployed Carbon Application : AttachmentUpload-CAR_1.0.0 {super-tenant}
3:05:04,362] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "POST /uploadAttachment HTTP/1.1[\r][\n]"
3:05:04,363] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "User-Agent: PostmanRuntime/7.26.5[\r][\n]"
3:05:04,363] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Accept: */*[\r][\n]"
3:05:04,363] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Postman-Token: 21c46ad2-19fc-46a6-aea8-8113ac70817e[\r][\n]"
3:05:04,363] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Host: localhost:8280[\r][\n]"
3:05:04,363] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
3:05:04,364] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Connection: keep-alive[\r][\n]"
3:05:04,364] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Content-Type: multipart/form-data; boundary=--------------------------623932778277436708655778[\r][\n]"
3:05:04,364] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Cookie: bf42f62d55=64dc75f94d2bd72d94493d263847c08c[\r][\n]"
3:05:04,364] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Content-Length: 376[\r][\n]"
3:05:04,365] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "[\r][\n]"
3:05:04,365] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "----------------------------623932778277436708655778[\r][\n]"
3:05:04,365] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Content-Disposition: form-data; name="uploaddoc"; filename="ZohoAttachment.txt"[\r][\n]"
3:05:04,365] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Content-Type: text/plain[\r][\n]"
3:05:04,366] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "[\r][\n]"
3:05:04,370] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Hi,[\r][\n]"
3:05:04,371] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "This is zoho Attachment task[\r][\n]"
3:05:04,371] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "----------------------------623932778277436708655778[\r][\n]"
3:05:04,371] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "Content-Disposition: form-data; name="name"[\r][\n]"
3:05:04,373] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "[\r][\n]"
3:05:04,373] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "TaskAttachment Demo[\r][\n]"
3:05:04,373] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 >> "----------------------------623932778277436708655778--[\r][\n]"
3:05:04,373] [] INFO - LogMediator ========UploadAttachment = API Called==========, ========AttachmentName=== = null
3:05:04,398] [] INFO - LogMediator ====attachment_base64==== = <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><ns:binary xmlns:ns="http://ws.apa
ns/ns/payload">LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3NzQzNjcwODY1NTc3OA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJ1cGxvYWRkb2MiOyBmaWxlbmFtZT0iW
1lbnQudHh0Ig0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCkhpLA0KVGhpcyBpcyB6b2hvIEF0dGFjaG1lbnQgdGFzaw0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3NzQzNjcwODY1NTc3OA
EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJuYW1lIg0KDQpUYXNrQXR0YWNobWVudCBEZW1vDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tNjIzOTMyNzc4Mjc3NDM2NzA4NjU1Nzc4LS0NCg==</ns:binary
dy>
3:05:04,402] [] INFO - LogMediator ====uploaddoc_Payload==== = <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><uploaddoc xmlns="http://ws.apache
se">LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3NzQzNjcwODY1NTc3OA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJ1cGxvYWRkb2MiOyBmaWxlbmFtZT0iWm9ob0F0dGFj
g0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCkhpLA0KVGhpcyBpcyB6b2hvIEF0dGFjaG1lbnQgdGFzaw0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3NzQzNjcwODY1NTc3OA0KQ29udGVud
lvbjogZm9ybS1kYXRhOyBuYW1lPSJuYW1lIg0KDQpUYXNrQXR0YWNobWVudCBEZW1vDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tNjIzOTMyNzc4Mjc3NDM2NzA4NjU1Nzc4LS0NCg==</uploaddoc></soapenv:
3:05:05,124] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "POST /restapi/portal/36249008/projects/685798000009576352/tasks/685798000011774013/attachments/ HTTP/1.1[
3:05:05,126] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Authorization: Bearer 1000.9df1f22e7d16ba95f0553af9855d40b5.f81f2af95682c8b398d0bb4939190d10[\r][\n]"
3:05:05,127] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Cookie: bf42f62d55=64dc75f94d2bd72d94493d263847c08c[\r][\n]"
3:05:05,127] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "transport.vfs.Streaming: true[\r][\n]"
3:05:05,127] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Accept: */*[\r][\n]"
3:05:05,128] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Postman-Token: 21c46ad2-19fc-46a6-aea8-8113ac70817e[\r][\n]"
3:05:05,128] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
3:05:05,128] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "transport.vfs.ReplyFileName: ZohoTestFile.txt[\r][\n]"
3:05:05,129] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Content-Type: application/binary[\r][\n]"
3:05:05,129] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Transfer-Encoding: chunked[\r][\n]"
3:05:05,129] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Host: projectsapi.zoho.com[\r][\n]"
3:05:05,130] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "Connection: Keep-Alive[\r][\n]"
3:05:05,130] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
3:05:05,130] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "[\r][\n]"
3:05:05,131] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "237[\r][\n]"
3:05:05,131] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "<uploaddoc xmlns="http://ws.apache.org/ns/synapse">LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3Nz
3OA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJ1cGxvYWRkb2MiOyBmaWxlbmFtZT0iWm9ob0F0dGFjaG1lbnQudHh0Ig0KQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluDQoNCkhpLA0KVGhpcyBpcyB
aG1lbnQgdGFzaw0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTYyMzkzMjc3ODI3NzQzNjcwODY1NTc3OA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJuYW1lIg0KDQpUYXNrQXR0YWNobWVu
S0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tNjIzOTMyNzc4Mjc3NDM2NzA4NjU1Nzc4LS0NCg==</uploaddoc>[\r][\n]"
3:05:05,134] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "0[\r][\n]"
3:05:05,135] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 << "[\r][\n]"
3:05:05,905] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "HTTP/1.1 400 [\r][\n]"
3:05:05,906] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Server: ZGS[\r][\n]"
3:05:05,906] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Date: Fri, 16 Oct 2020 07:35:06 GMT[\r][\n]"
3:05:05,906] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Content-Type: application/json;charset=utf-8[\r][\n]"
3:05:05,906] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Content-Length: 60[\r][\n]"
3:05:05,907] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Connection: keep-alive[\r][\n]"
3:05:05,907] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "X-Content-Type-Options: nosniff[\r][\n]"
3:05:05,907] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "X-XSS-Protection: 1[\r][\n]"
3:05:05,908] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Set-Cookie: zpct=24a027ad-3cd2-4edf-b641-b792d3ffede8;path=/;SameSite=None;Secure;priority=high[\r][\n]"
3:05:05,908] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Set-Cookie: _zcsr_tmp=24a027ad-3cd2-4edf-b641-b792d3ffede8;path=/;SameSite=Strict;Secure;priority=high[\r
3:05:05,908] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Pragma: no-cache[\r][\n]"
3:05:05,909] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Cache-Control: no-cache[\r][\n]"
3:05:05,909] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
3:05:05,909] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Set-Cookie: JSESSIONID=9FD064E43DACD49060E958A34C2E0325; Path=/; Secure[\r][\n]"
3:05:05,909] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "X-Frame-Options: SAMEORIGIN[\r][\n]"
3:05:05,910] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "X-UA-Compatible: IE=9, IE=10[\r][\n]"
3:05:05,910] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "Content-Disposition: attachment; filename=response.txt;[\r][\n]"
3:05:05,910] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "X-Download-Options: noopen[\r][\n]"
3:05:05,910] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "[\r][\n]"
3:05:05,910] [] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "{"error":{"code":6831,"message":"Input Parameter Missing"}}[\n]"
3:05:05,921] [] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:49cdf6b1-0ac6-4728-bc92-f8658b4a88
: request, ==API Response====== = {"error":{"code":6831,"message":"Input Parameter Missing"}}
3:05:05,925] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "HTTP/1.1 400 [\r][\n]"
3:05:05,925] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-Frame-Options: SAMEORIGIN[\r][\n]"
3:05:05,925] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-UA-Compatible: IE=9, IE=10[\r][\n]"
3:05:05,926] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Cache-Control: no-cache[\r][\n]"
3:05:05,927] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-Content-Type-Options: nosniff[\r][\n]"
3:05:05,927] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Content-Disposition: attachment; filename=response.txt;[\r][\n]"
3:05:05,927] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-Download-Options: noopen[\r][\n]"
3:05:05,927] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Set-Cookie: JSESSIONID=9FD064E43DACD49060E958A34C2E0325; Path=/; Secure[\r][\n]"
3:05:05,927] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Set-Cookie: _zcsr_tmp=24a027ad-3cd2-4edf-b641-b792d3ffede8;path=/;SameSite=Strict;Secure;priority=high[\
3:05:05,928] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Set-Cookie: zpct=24a027ad-3cd2-4edf-b641-b792d3ffede8;path=/;SameSite=None;Secure;priority=high[\r][\n]"
3:05:05,928] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
3:05:05,929] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Pragma: no-cache[\r][\n]"
3:05:05,929] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-XSS-Protection: 1[\r][\n]"
3:05:05,929] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Content-Type: application/json;charset=utf-8[\r][\n]"
3:05:05,930] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Date: Fri, 16 Oct 2020 07:35:05 GMT[\r][\n]"
3:05:05,930] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Transfer-Encoding: chunked[\r][\n]"
3:05:05,930] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Connection: Close[\r][\n]"
3:05:05,930] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
3:05:05,931] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "3c[\r][\n]"
3:05:05,931] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "{"error":{"code":6831,"message":"Input Parameter Missing"}}[\n]"
3:05:05,931] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
3:05:05,931] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "0[\r][\n]"
3:05:05,932] [] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
Can Anyone please give me a solution for this?
Looking at your code you are not doing anything with the incoming payload. so why are you trying to mediate the payload? just pass through it.
Mock zoho api (use any simple python, pip install web server) and dump request came from ESB and see what is missing in request. Some of the header most probably missing, Content-Disposition Content-Type
API states "name" parameter is mandatory.
I am currently trying to access any REST service for deleting a resource from my WSO2 EI sequence. The code looks something like below
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="DELETE_COMPANY_INFO" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="Sequence" value="DELETE COMPANY INFO started"/>
</log>
<log level="custom">
<property expression="json-eval($)" name="Request Payload"/>
</log>
<property name="NO_ENTITY_BODY" action="set" value="false" type="BOOLEAN" scope="axis2"/>
<call blocking="true">
<endpoint>
<http method="delete" uri-template="http://<IP>:<Port>/companyinfo/<id>">
</http>
</endpoint>
</call>
</sequence>
As can be seen I wish to send the message payload to this endpoint. However I am not able to send this as the payload is dropped by WSO2 EI v6.4
Logs are below
[2020-02-21 14:00:33,127] [micro-integrator] INFO - LogMediator Sequence = DELETE COMPANY INFO started
[2020-02-21 14:00:33,128] [micro-integrator] INFO - LogMediator Request Payload = {"CompanyName":"test123"}
[2020-02-21 14:00:33,131] [micro-integrator] DEBUG - header >> "DELETE /companyinfo/123 HTTP/1.1[\r][\n]"
[2020-02-21 14:00:33,131] [micro-integrator] DEBUG - header >> "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2020-02-21 14:00:33,132] [micro-integrator] DEBUG - header >> "User-Agent: Axis2[\r][\n]"
[2020-02-21 14:00:33,132] [micro-integrator] DEBUG - header >> "Host: <IP>:<Port>[\r][\n]"
[2020-02-21 14:00:33,132] [micro-integrator] DEBUG - header >> "[\r][\n]"
[2020-02-21 14:00:33,136] [micro-integrator] DEBUG - header << "HTTP/1.1 200 [\r][\n]"
[2020-02-21 14:00:33,136] [micro-integrator] DEBUG - header << "HTTP/1.1 200 [\r][\n]"
[2020-02-21 14:00:33,136] [micro-integrator] DEBUG - header << "Content-Type: application/json[\r][\n]"
[2020-02-21 14:00:33,136] [micro-integrator] DEBUG - header << "Content-Length: 25[\r][\n]"
[2020-02-21 14:00:33,137] [micro-integrator] DEBUG - header << "Date: Fri, 21 Feb 2020 08:30:32 GMT[\r][\n]"
[2020-02-21 14:00:33,137] [micro-integrator] DEBUG - header << "[\r][\n]"
[2020-02-21 14:00:33,137] [micro-integrator] DEBUG - content << "{"CompanyName":"test123"}"
I know that REST Webservice implementation should not use Payload for HTTP DELETE operation, however I think ESB should not make the decision to drop the Payload if the underlying transport allows it.
Additionally, I know that this issue was reported earlier (https://wso2.org/jira/browse/ESBJAVA-5060) and marked as resolved in v6.2 of WSO2 EI. However I am facing this in 6.4 version of EI.
Is there a solution to allow Payload with HTTP DELETE call using Call Mediator in WSO2 EI v6.4?
It seems the fix has gone to the Passthrough transport (non blocking) and not to the blocking transport. If you remove the blocking="true" mode, it should work.
I have a strange problem while using clone - aggregate mediator. I put log in the onComplete and saw the data, but that data never sending back to the client.
Here is the code I used.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/OneVinmec" name="OneVinmec" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/getPID?*">
...
<outSequence>
<property name="info" scope="default">
<ns:Information xmlns:ns="http://wso2.com"/>
</property>
<aggregate id="getPID">
<completeCondition timeout="10">
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete enclosingElementProperty="info" expression="//*[local-name() = 'DSBenhNhan']">
<log description="DSBenhNhan" level="custom">
<property expression="//*[local-name() = 'DSBenhNhan']" name="DSBenhNhan"/>
</log>
<send/>
</onComplete>
</aggregate>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
This is the log I got from console, as you can see, there is log INFO - LogMediator, but after that, the response is not sending back.
Edit: After remove the content-encoding header, the Log now show this
[2020-02-12 17:30:16,052] INFO - LogMediator DSBenhNhan = <DSBenhNhan xmlns="http://ws.wso2.org/dataservice/getPID"><BenhNhan><Source_System>OH</Source_System><PID>200380141</PID></BenhNhan></DSBenhNhan><DSBenhNhan xmlns="http://ws.wso2.org/dataservice/getPID"><BenhNhan><Source_System>eHOS</Source_System><PID>19006032</PID></BenhNhan><BenhNhan><Source_System>eHOS</Source_System><PID>19086413</PID></BenhNhan></DSBenhNhan>
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "HTTP/1.1 200 OK[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-Frame-Options: DENY[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "0[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTPS-Sender I/O dispatcher-4 >> "[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-Content-Type-Options: nosniff[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Vary: Accept-Encoding[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "X-XSS-Protection: 1; mode=block[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Content-Type: application/xml;charset=UTF-8[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Date: Wed, 12 Feb 2020 10:30:16 GMT[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "Transfer-Encoding: chunked[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "1aa[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "<ns:Information xmlns:ns="http://wso2.com"><DSBenhNhan xmlns="http://ws.wso2.org/dataservice/getPID"><BenhNhan><Source_System>OH</Source_System><PID>200380141</PID></BenhNhan></DSBenhNhan><DSBenhNhan xmlns="http://ws.wso2.org/dataservice/getPID"><BenhNhan><Source_System>eHOS</Source_System><PID>19006032</PID></BenhNhan><BenhNhan><Source_System>eHOS</Source_System><PID>19086413</PID></BenhNhan></DSBenhNhan></ns:Information>[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "0[\r][\n]"
[2020-02-12 17:30:16,052] DEBUG - wire HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
Appreciate your help!
According to [2020-02-12 15:59:27,259] DEBUG - wire HTTP-Listener I/O dispatcher-4 << "Content-Encoding: gzip[\r][\n], it seems the content-encoding is in gzip format. Please skip that header from the client when invoking the API.