Use case: 1. I need to call back end API with file as a attachment 2. Its involve service chaining ( I need to call auth service first and get session from that and pass session along with file) 3. when i call first service from proxy attachment get removed from messageContext when i looking it for process. [ because i am sending payload for first service call and request data getting deleted] 4. then i used "callTemplate" from my template. but when i do so i am getting response for first call and i can see request body on tcpmon. but for second call i cant see anything on tcpmon and also backend not recognize the request
template code: <template name="setNoteAttachment" xmlns="http://ws.apache.org/ns/synapse"> <parameter name="noteId" description="The ID of the note record to associate the attachment to" /> <parameter name="noteFileName" description="The file name of the file attachment" /> <parameter name="requestData" description="" /> <sequence> <property name="uri.var.noteId" expression="$func:noteId" /> <property name="uri.var.noteFileName" expression="$func:noteFileName" /> <property name="uri.var.sugarCRMurl" value=" http://localhost:8888/soap.php" /> <property name="uri.var.requestData" value="$func:requestData" /> <call-template target="org.wso2.carbon.connector.sugarcrm.init"> <with-param name="appUri" value="http://localhost:8888/soap.php" /> <with-param name="userName" value="admin" /> <with-param name="password" value="3FC4B74F5A26C7EFEB0E20982823CCDF" /> <with-param name="version" value="1" /> <with-param name="applicationName" value="appfd" /> <with-param name="forceLogin" value="true" /> </call-template> <payloadFactory> <format> <soapenv:Envelope xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm"> <soapenv:Header /> <soapenv:Body> <sug:set_note_attachment soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"> <session xsi:type="xsd:string">1671qvfrrqfc62j6kss1kdn30</session> <note xsi:type="sug:note_attachment"> <filename xsi:type="xsd:string">$1</filename> <id xsi:type="xsd:string">$2</id> </note> </sug:set_note_attachment> </soapenv:Body> </soapenv:Envelope> </format> <args> <arg expression="get-property('uri.var.noteFileName')" /> <arg expression="get-property('uri.var.noteId')" /> </args> </payloadFactory> <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" /> <header name="To" expression="get-property('uri.var.sugarCRMurl')" /> <call> <endpoint> <default format="soap11" /> </endpoint> </call> <property name="FORCE_ERROR_ON_SOAP_FAULT" value="false" /> </sequence> </template> ++++++++++++++++++++++++++++++++WORKING SCENARIO (without call template) +++++++++++++++++++++++++++++++++++++++++++++ note: this result not acceptable as session is hard coded this is the generated SOAP (got from tcp trace) <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sug="http://www.sugarcrm.com/sugarcrm"> <soapenv:Body> <sug:set_note_attachment soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"> <session xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">1671qvfrrqfc62j6kss1kdn30</session> <note xmlns="http://ws.apache.org/ns/synapse" xsi:type="sug:note_attachment"> <filename xsi:type="xsd:string"></filename> <id xsi:type="xsd:string"></id> </note> </sug:set_note_attachment> </soapenv:Body> </soapenv:Envelope> ================================NOT WORKING (with call template)====================================== this is the generated SOAP (got from tcp trace) still sessionID hard coded. pls ignore it <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sug="http://www.sugarcrm.com/sugarcrm"> <soapenv:Body> <sug:set_note_attachment soapenv:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"> <session xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">1671qvfrrqfc62j6kss1kdn30</session> <note xmlns="http://ws.apache.org/ns/synapse" xsi:type="sug:note_attachment"> <filename xsi:type="xsd:string"></filename> <id xsi:type="xsd:string"></id> </note> </sug:set_note_attachment> </soapenv:Body> </soapenv:Envelope> Problem: *how i can achieve my requirement?* *how to skeep attachment without deleting when call for service 1 * *OR* *how i can fix this code to work with call template*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
