Hi, I am trying to create a REST API on EI 6.1.1 that receives a JSON, and one of the JSON fields contains the name of the file that I would like to create and its contents in Base64 encode, the API code is below:
<?xml version="1.0" encoding="UTF-8"?> <api xmlns="http://ws.apache.org/ns/synapse" name="ImageAPI" context="/image"> <resource methods="POST" uri-template="/add"> <inSequence> <property name="OUT_ONLY" value="true"/> <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> <header name="To" scope="default" action="remove"/> <log level="full"/> <property name="fileName" expression="json-eval($.fileName)" scope="default" type="STRING"/> <property name="fileContent" expression="json-eval($.fileContent)" scope="default" type="STRING"/> <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="$ctx:fileContent"/> </args> </payloadFactory> <script language="js">var binaryNode = mc.getEnvelope().getBody().getFirstElement().getFirstOMChild(); binaryNode.setBinary(true);</script> <property name="transport.vfs.ReplyFileName" scope="transport" type="STRING" expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.png')"/> <log level="custom"> <property name="fileName" expression="get-property('fileName')"/> <property name="REST_URL_POSTFIX" expression="get-property('REST_URL_POSTFIX')"/> <property name="TRANSPORT_HEADERS" expression="get-property('axis2','TRANSPORT_HEADERS')"/> </log> <property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/> <property name="REST_URL_POSTFIX" scope="axis2" type="STRING" value=""/> <property name="OUT_ONLY" scope="default" type="STRING" value="true"/> <send> <endpoint> <address uri="vfs:file:///E:/test?transport.vfs.Append=true"/> </endpoint> </send> </inSequence> <outSequence/> <faultSequence/> </resource> </api> This code alwasys create the file with the name add, even if I set the ReplyFileName property. If I use this same sequence in a ProxyService it works fine. And creates the file with the correct name. Is there any additional configuration that should be done for this to work in Rest apis? Thanks, -- Francisco Ribeiro *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
