I am having a slight issue with 2 sequence's I have created in a WSO2 Esb proxy service.
Here is my configuration:
My Proxy (Pepkor_Product_Search_Proxy) needs to search a web service and data service for product information and bring back the response(aggregated if need be).
My Proxy service calls 2 services ; a data service hosted on the DSS and a Web service hosted on the AS. The proxy request is sent to 2 "request sequences" that format the request to match the expected messages of the respective service calls on the AS and DSS. Once the responses are received , I send them to the 2 "response sequences" in order to format them according(in line with the WSDL) to the proxy service response. However once reaching the send mediators in these sequences , execution stops and they are not received by the Out Sequence of the proxy.
The send mediators are using the default behavior( which should be to send to out sequence of proxy) such as :
All 4 sequences( 2 Rq + 2Rs ) are dynamic and saved in system_/conf: registry
I recieve the message back in soap from only the one service ( it seems the rs sequences are responding and not the out seq of proxy!)
I want to know how I can get these "mediated" responses back into my proxies out sequence...
I have tried the sequence mediator instead of clone but to no avail.
Please see below : the Rq mssg , the proxy and "response" sequences synapse configurations as well as the proxy carbon log.
Thanks in advance and is there any other info you need let me know.
SOAP Rq:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Header/>
<soapenv:Body>
<prod:productSearchReq>
<!--Optional:-->
<productName>NIKE_SHIRTS</productName>
<!--Optional:-->
<productSize>7</productSize>
<!--Optional:-->
<productColour>RED</productColour>
</prod:productSearchReq>
</soapenv:Body>
</soapenv:Envelope>
Proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Pepkor_Product_Search_Proxy"
transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="custom">
<property name="Sending request to :"
value="ackServiceSearchSeqRq and shcServiceSearchSeqRq sequences..." />
</log>
<clone sequential="true">
<target sequence="conf:/ackServiceSearchSeqRq" />
<target sequence="conf:/shcServiceSearchSeqRq" />
</clone>
</inSequence>
<outSequence>
<log level="custom">
<property name="Out Sequence reached"
value="++++++++++++++=========Aggregating now========+++++++++++++++++==" />
</log>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1" />
</completeCondition>
<onComplete expression="//productDetails">
<log level="custom" separator=",">
<property name="::::"
value="======================= Sending Back the Aggregated Responses. ===============" />
</log>
</onComplete>
</aggregate>
<respond />
</outSequence>
<faultSequence />
</target>
<publishWSDL key="gov:service_integration/wsdls/PepKorProductSearch.wsdl" />
</proxy>
Ack Service Rs Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="ackServiceSearchSeqRs">
<log level="custom">
<property name="Below Response recieved from Ack-WS" value="==================" />
</log>
<log level="full" />
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="product_Colour"
expression="//ns1:productSearchResponse/ns1:return/ax23:product_Colour/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:Colour : "
expression="$ctx:product_Colour" />
</log>
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="product_ID"
expression="//ns1:productSearchResponse/ns1:return/ax23:product_ID/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:ID : "
expression="$ctx:product_ID" />
</log>
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="product_Name"
expression="//ns1:productSearchResponse/ns1:return/ax23:product_Name/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:Name : "
expression="$ctx:product_Name" />
</log>
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="product_Size"
expression="//ns1:productSearchResponse/ns1:return/ax23:product_Size/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:Size : "
expression="$ctx:product_Size" />
</log>
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="source"
expression="//ns1:productSearchResponse/ns1:return/ax23:source/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:Source : "
expression="$ctx:source" />
</log>
<property xmlns:ns1="http://ack.pepkor.org" xmlns:ns="http://org.apache.synapse/xsd"
xmlns:ax23="http://ack.pepkor.org/xsd" name="type"
expression="//ns1:productSearchResponse/ns1:return/ax23:type/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="ackRs:Type : "
expression="$ctx:type" />
</log>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns:pep="http://za.co.pepkor/product_service/">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:product_ID" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:product_Name" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:product_Size" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:product_Colour" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:type" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:source" />
</args>
</payloadFactory>
<send />
</sequence>
Shc Service Rs Sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="shcServiceSearchSeqRs">
<log level="custom">
<property name="Below response recieved from Shc-DS" value="==================" />
</log>
<log level="full" />
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Product_ID" expression="//ns1:productDetails/ns1:Product_ID/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Product_ID : "
expression="$ctx:Product_ID" />
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Product_Name" expression="//ns1:productDetails/ns1:Product_Name/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Product_Name : "
expression="$ctx:Product_Name" />
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Product_Size" expression="//ns1:productDetails/ns1:Product_Size/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Product_Size : "
expression="$ctx:Product_Size" />
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Product_Colour" expression="//ns1:productDetails/ns1:Product_Colour/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Product_Colour : "
expression="$ctx:Product_Colour" />
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Product_Type" expression="//ns1:productDetails/ns1:Product_Type/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Product_Type : "
expression="$ctx:Product_Type" />
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd"
name="Source" expression="//ns1:productDetails/ns1:Source/text()"
scope="default" type="STRING" />
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="shcRs: Source : "
expression="$ctx:Source" />
</log>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns="">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Product_ID" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Product_Name" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Product_Size" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Product_Colour" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Product_Type" />
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml"
expression="$ctx:Source" />
</args>
</payloadFactory>
<send />
</sequence>
SOAP Rs
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<productDetails>
<productID>214562</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>SHC</sourceID>
</productDetails>
</soapenv:Body>
</soapenv:Envelope>
WSO2 Carbon Log
https : // docs. google. com/document/d/12At0zir99H9cOo9hzNrgG33r52PHF0W32XLyBT6dzUQ/edit? usp=sharing
Edit
My AggHandlerSequence :
<sequence xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="></property>
</log>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" xmlns:prod="http://za.co.pepkor/product_service/" expression="//prod:productSearchResp/productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Sending Back the Aggregated Responses. ==============="></property>
</log>
<respond></respond>
</onComplete>
</aggregate>
</sequence>
And one of my Rs Seq
<sequence xmlns="http://ws.apache.org/ns/synapse">
:
:
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>
<productDetails xmlns="">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
:
:
<sequence key="conf:/pocSearchRsHandlerSeq"></sequence>
:
:
But am getting this Rs in soap
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<productDetails>
<productID>2145627</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>ACK</sourceID>
</productDetails>
<productDetails>
<productID>214562</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>SHC</sourceID>
</productDetails>
</soapenv:Body>
</soapenv:Envelope>
I however want a response similar to the Payload factory in the Rs seq , have tried playing with the corrolateOn expression. Can I store these aggregated fields as properties and use them in a payload factory or how do I map the Agg responses to ?
Final edit
Got it perfect here's a Rs seq payload:(this will be recieved by agg handler)
<productDetails xmlns="">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
And my full agg handler :
<sequence xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="></property>
</log>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Formatting the Aggregated Responses. ==============="></property>
</log>
<log level="full"></log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp> $1 </prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="//productDetails" evaluator="xml"></arg>
</args>
</payloadFactory>
<respond></respond>
</onComplete>
</aggregate>
</sequence>
If you want to use aggregate mediator, the 2 responses must be go to the same sequence in which you use this mediator
In your proxy inSequence, you use clone and call "ackServiceSearchSeqRq" and "shcServiceSearchSeqRq" as you already do
In each of theses request seq, you format your request according to the service you want to call and then use send mediator from one of these ways :
1st Option : <send> <endpoint key="xxx"> </send> : the 2 responses from your 2 services will go to your proxy's outSequence
2nd Option : <send receive="MyAggregateSequence"> <endpoint key="xxx"> </send> : the 2 responses from your 2 services will go to "MyAggregateSequence"
In your proxy's outSequence or in "MyAggregateSequence", depending on the option you have chosen, you use filter or switch mediator to determine if it is a response from ackService or from shcService and decide which transformation to apply (pay attention to the productDetails node you create with payloadFactory, if there is no namespace then specify xmlns="" each time : this is not the case in your samples) before calling aggregate mediator. Inside aggregate/onComplete, you can use send mediator with no endpoint to send back your aggregated message to the proxy's caller.
In your case, there is 2 <send/>, one in each of your 2 Rs sequence : the 1st one is sent to the proxy's caller and the 2nd one does nothing (the ESB must says than you try to respond 2 times).
When using the clone mediator and you want to collect the response of the two messages, you must set and id on the clone mediator and using the same id in the aggregator mediator.
< clone id="XXX">
< aggregate id="XXX">
This way the aggregator knows to which calls it needs to wait for.
Related
I have a proxy in WSO2 Enterprise Integrator 6.3.0 with endpoint configured in conf registry. Sometimes I receive errors in this proxy with message in LOG:
[2018-09-12 09:33:22,542] [-1234] [] [SynapseWorker-11] ERROR {org.apache.synapse.config.xml.endpoints.LoadbalanceEndpointFactory} - Invalid endpoint configuration.
[2018-09-12 09:33:22,542] [-1234] [] [SynapseWorker-11] WARN {org.apache.synapse.config.SynapseConfiguration} - Error while loading the resource conf:services/corp/servicev1/endpoint/ERPEndpoint.xml from the remote registry. Previously cached value will be used. Check the registry accessibility.
[2018-09-12 09:33:22,545] [-1234] [] [SynapseWorker-11] INFO {org.apache.axis2.transport.http.HTTPSender} - Unable to sendViaPost to url[http://...address ommited...]
java.net.SocketException: Connection reset
It seems to me it doesn't catch the endpoint of registry or cache.
PS: In my registry the address endpoint is with dns name and when this error occurs the address endpoint appears with IP address.
How to fix this?
Below the sequence and endpoint:
<sequence name="PessoaService_inserirPessoaFisicaNacionalV1_MessageProcessorSequence" onError="PessoaService_GenericFaultHandlerSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property name="PROXY_NAME" scope="default" type="STRING" value="PessoaService_inserirPessoaFisicaNacionalV1_LocalProxy"/>
<property name="SERVICE_VERSION" scope="default" type="STRING" value="1.0"/>
<property expression="$header/wsa:MessageID" name="MessageIdConsumidor" scope="default" type="STRING" xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
<property expression="$header/ns:ApplicationName" name="applicationName" scope="default" type="STRING" xmlns:ns="https://ws.apache.org/axis2"/>
<log level="custom">
<property name="PessoaService_inserirPessoaFisicaNacionalV1_MessageProcessorSequence" value="Started"/>
</log>
<enrich>
<source clone="true" type="envelope"/>
<target property="BODY_ORIGINAL" type="property"/>
</enrich>
<dblookup>
<connection>
<pool>
<dsName>ESB</dsName>
</pool>
</connection>
<statement>
<sql>
<![CDATA[select codigo_configuracao, cnpj_empresa from esb.codigo_configuracao where aplicacao = ? and tipo_pessoa = 'fisica']]>
</sql>
<parameter expression="get-property('applicationName')" type="CHAR"/>
<result column="codigo_configuracao" name="codigo_configuracao"/>
<result column="cnpj_empresa" name="cnpj_empresa"/>
</statement>
</dblookup>
<log level="custom">
<property expression="$ctx:codigo_configuracao" name="PessoaService_inserirPessoaFisicaNacionalV1 [codigo_configuracao]"/>
<property expression="$ctx:cnpj_empresa" name="PessoaService_inserirPessoaFisicaNacionalV1 [cnpj_empresa]"/>
<property expression="get-property('applicationName')" name="PessoaService_inserirPessoaFisicaNacionalV1 [applicationName]"/>
</log>
<call-template target="PessoaService_LoginTemplate">
<with-param name="username" value="username"/>
<with-param name="password" value="pass"/>
<with-param name="companyHandle" value="-1"/>
<with-param name="branchHandle" value="-1"/>
</call-template>
<xslt key="conf:services/corp/pessoaservicev1/transformation/InserirPessoaFisicaNacionalRequest_IntegrarRequestTransformation.xslt">
<property expression="$ctx:AuthenticationTokenId" name="AuthenticationTokenId"/>
<property expression="$ctx:cnpj_empresa" name="cnpjEmpresa"/>
<property expression="$ctx:codigo_configuracao" name="codigoConfiguracao"/>
</xslt>
<log level="custom">
<property expression="$body" name="PessoaService_inserirPessoaFisicaNacionalV1_MessageProcessorSequence [request ERP]"/>
</log>
<enrich>
<source clone="true" type="body"/>
<target property="RequestERP" type="property"/>
</enrich>
<header action="remove" name="Action" scope="default"/>
<header name="Action" scope="default" value="http://.com.br/corporativo/PessoaService/Pessoa/Integrar"/>
<property expression="get-property('registry', 'conf:services/corp/pessoaservicev1/parameters/endpointCallback.properties')" name="endpointCallback" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>$1</wsa:Action>
<wsa:ReplyTo>
<wsa:Address>$2</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID>$3</wsa:MessageID>
</soap:Header>
<soap:Body>$4</soap:Body>
</soap:Envelope>
</format>
<args>
<arg value="http://.com.br/corporativo/PessoaService/Pessoa/Integrar"/>
<arg evaluator="xml" expression="$ctx:endpointCallback"/>
<arg evaluator="xml" expression="get-property('MessageID')"/>
<arg evaluator="xml" expression="$body/pes:Integrar" xmlns:pes="http://.com.br/corporativo/PessoaService"/>
</args>
</payloadFactory>
<call blocking="true">
<endpoint key="conf:services/corp/pessoaservicev1/endpoint/ERPEndpoint.xml"/>
</call>
<log level="custom">
<property expression="$body" name="PessoaService_inserirPessoaFisicaNacionalV1_MessageProcessorSequence [ERP Response]"/>
</log>
<filter xmlns:ns="http://.com.br/corporativo/PessoaService" xpath="$body//ns:CodigoRetorno = 'ProcessamentoOK'">
<then>
<call-template target="PessoaService_LogoutTemplate">
<with-param name="AuthenticationTokenId" value="{$ctx:AuthenticationTokenId}"/>
</call-template>
</then>
<else>
<call-template target="PessoaService_LogoutTemplate">
<with-param name="AuthenticationTokenId" value="{$ctx:AuthenticationTokenId}"/>
</call-template>
<property expression="get-property('ReplyTo')" name="uri.var.full" scope="default" type="STRING"/>
<log level="custom">
<property expression="get-property('ReplyTo')" name="PessoaService_inserirPessoaFisicaNacionalV1_MessageProcessorSequence [Processamento NOK - callback endpoint]"/>
</log>
<call>
<endpoint key="conf:services/corp/pessoaservicev1/endpoint/CallbackDynamicEndpoint.xml"/>
</call>
</else>
</filter>
<payloadFactory media-type="xml">
<format>
<p:insert_smart_proxy_operation xmlns:p="http://ws.wso2.org/dataservice">
<p:message_id>$1</p:message_id>
<p:correlation_id>$2</p:correlation_id>
<p:to_address/>
<p:reply_address>$3</p:reply_address>
<p:message>$4</p:message>
<p:status>OK</p:status>
<p:data_processamento>$5</p:data_processamento>
<p:relates_to>$2</p:relates_to>
</p:insert_smart_proxy_operation>
</format>
<args>
<arg evaluator="xml" expression="get-property('MessageID')"/>
<arg evaluator="xml" expression="get-property('MessageIdConsumidor')"/>
<arg evaluator="xml" expression="get-property('endpointCallback')"/>
<arg evaluator="xml" expression="$ctx:RequestERP/*"/>
<arg evaluator="xml" expression="get-property('SYSTEM_DATE')"/>
</args>
</payloadFactory>
<log level="custom">
<property expression="$body" name="PessoaService_inserirPessoaFisicaNacionalV1 [SmartProxy Request]"/>
</log>
<header name="Action" scope="default" value="urn:insert_smart_proxy_operation"/>
<send>
<endpoint key="conf:services/corp/pessoaservicev1/endpoint/SmartProxyDSSEndpoint.xml"/>
</send>
</sequence>
Content of endpoint ERPEndpoint.xml in sequence above:
<endpoint name="BennerERPEndpoint" xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://host/App_Services/PESSOAS/Service.svc/ws">
<enableAddressing/>
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
</address>
</endpoint>
In our test environment we build a one-way proxy service that uses callout to get data from several other services. Now when one of those services fails wso2 proxy sends 202 accepted anyway. Is it possible to "catch exceptions" and return a different status?
I know that in this case it would be better to use a request-response proxy, but even if we would create a proxy that only stores the payload in a messagestore there could be issues regarding database where the payload would be stored (database is down, etc) and we don't want status 202 to be returned if the message was not stored in db.
edit:
Here is my proxy after changes suggested in first answer to my question:
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="notifyOfClaimChangeOut" serviceGroup="" startOnLoad="true"
trace="disable" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property description="OUT_ONLY" name="OUT_ONLY" scope="default"
type="BOOLEAN" value="true"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" scope="default"
type="STRING" value="true"/>
<property description="OriginalPayload" expression="$body"
name="OriginalPayload" scope="default" type="STRING"/>
<iterate description=""
expression="$body//InsClaimData/PartnerList/PartnerEntry" id="" sequential="true">
<target>
<sequence>
<payloadFactory description="" media-type="xml">
<format>
<plat:FindCustomerSync xmlns:plat="http://platform.###.pl/">
<plat:request>
<plat:FirstName>$1</plat:FirstName>
<plat:LastName>$2</plat:LastName>
<plat:Pesel>$3</plat:Pesel>
</plat:request>
</plat:FindCustomerSync>
</format>
<args>
<arg evaluator="xml" expression="$body/PartnerEntry/BusinessPartner/personData/firstName"/>
<arg evaluator="xml" expression="$body/PartnerEntry/BusinessPartner/personData/lastName"/>
<arg evaluator="xml" expression="$body/PartnerEntry/BusinessPartner/personData/PESEL"/>
</args>
</payloadFactory>
<log level="custom">
<property expression="$body" name="property_name"/>
</log>
<callout action="http://platform.###.pl/FindCustomerSync"
description="QueryCustomersOut"
endpointKey="gov:###/endpoints/###/QueryCustomersOut.xml" initAxis2ClientOptions="false">
<source type="envelope"/>
<target key="QueryCustomersOutResponse"/>
</callout>
<log description="" level="custom" separator=",">
<property expression="$ctx:QueryCustomersOutResponse"
name="QueryCustomersOut"
xmlns:cla="http://###.###.io/service/internal/ClaimService" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
</log>
</sequence>
</target>
</iterate>
<!--
<callout description="ClaimService"
endpointKey="gov:###/endpoints/###/ClaimService.xml" initAxis2ClientOptions="false">
<source type="envelope"/>
<target key="ClaimServiceResponse"/>
</callout>
<log description="ClaimService Response" level="custom">
<property expression="$ctx:ClaimServiceResponse" name="ClaimServiceResponse"/>
</log>
-->
<drop/>
</inSequence>
<outSequence/>
<faultSequence>
<property name="HTTP_SC" scope="axis2" type="STRING" value="500"/>
<log>
<property name="Error" value="Fault :("/>
</log>
</faultSequence>
</target>
<publishWSDL key="gov:###/schemas/###/ClaimService.wsdl"/>
</proxy>
You can use the HTTP_SC property to send status 500. You'll also need the makefault mediator to construct the fault message.
<property name="HTTP_SC" value="500" scope="axis2"/>
<makefault version="soap11">
You can refer this jira to get an idea.
In addition, in the inSequence, you may need to set FORCE_ERROR_ON_SOAP_FAULT property to move to the fault sequence when a soap fault occurs. Some explanation available here.
<inSequence>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>
</inSequence>
I'm having a confusing issue with my aggregate mediator inside an out Sequence of a proxy.
Configuration :
A sequence implementing the iterate mediator Iterated the following message :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<productSearchRs xmlns="SHC">
<productDetails>
<Product_ID>1487326</Product_ID>
<Product_Name>SECRET</Product_Name>
<Product_Size>M</Product_Size>
<Product_Colour>BLACK</Product_Colour>
<Product_Type>SOCKS</Product_Type>
<Source>SHC</Source>
</productDetails>
<productDetails>
<Product_ID>1985211</Product_ID>
<Product_Name>SECRET</Product_Name>
<Product_Size>M</Product_Size>
<Product_Colour>BLACK</Product_Colour>
<Product_Type>SOCKS</Product_Type>
<Source>SHC</Source>
</productDetails>
</productSearchRs>
</soapenv:Body>
</soapenv:Envelope>
Into these (after a payloadFactory):
<pfPadding>
<productDetails>
<productID>1487326</productID>
<productName>SECRET</productName>
<productSize>M</productSize>
<productColour>BLACK</productColour>
<productType>SOCKS</productType>
<sourceID>SHC</sourceID>
</productDetails>
</pfPadding>
and
<pfPadding>
<productDetails>
<productID>1985211</productID>
<productName>SECRET</productName>
<productSize>M</productSize>
<productColour>BLACK</productColour>
<productType>SOCKS</productType>
<sourceID>SHC</sourceID>
</productDetails>
</pfPadding>
Full sequence:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="shcServiceSearchSeqRs">
<log level="custom">
<property name="Below response recieved from Shc-DS" value="=================="></property>
</log>
<log level="full"></log>
<log level="custom">
<property name="Splitting product_Detail/s up" value="=================="></property>
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd" name="Product_ID" expression="//ns1:productDetails/ns1:Product_ID/text()" scope="default" type="STRING"></property>
<filter xmlns:ns="http://org.apache.synapse/xsd" xpath="boolean(get-property('Product_ID'))">
<then>
<iterate xmlns:ns1="SHC" expression="//ns1:productDetails">
<target>
<sequence>
<property name="Product_ID" expression="//ns1:productDetails/ns1:Product_ID/text()" scope="default" type="STRING"></property>
<property name="Product_Name" expression="//ns1:productDetails/ns1:Product_Name/text()" scope="default" type="STRING"></property>
<property name="Product_Size" expression="//ns1:productDetails/ns1:Product_Size/text()" scope="default" type="STRING"></property>
<property name="Product_Colour" expression="//ns1:productDetails/ns1:Product_Colour/text()" scope="default" type="STRING"></property>
<property name="Product_Type" expression="//ns1:productDetails/ns1:Product_Type/text()" scope="default" type="STRING"></property>
<property name="Source" expression="//ns1:productDetails/ns1:Source/text()" scope="default" type="STRING"></property>
<log level="full"></log>
<log level="custom">
<property name="shcRs : P_ID : " expression="$ctx:Product_ID"></property>
<property name="shcRs : P_Name : " expression="$ctx:Product_Name"></property>
<property name="shcRs : P_Size : " expression="$ctx:Product_Size"></property>
<property name="shcRs : P_Colour : " expression="$ctx:Product_Colour"></property>
<property name="shcRs : P_Type : " expression="$ctx:Product_Type"></property>
<property name="shcRs : P_Source : " expression="$ctx:Source"></property>
</log>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns="">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
</format>
<args>
<arg expression="$ctx:Product_ID" evaluator="xml"></arg>
<arg expression="$ctx:Product_Name" evaluator="xml"></arg>
<arg expression="$ctx:Product_Size" evaluator="xml"></arg>
<arg expression="$ctx:Product_Colour" evaluator="xml"></arg>
<arg expression="$ctx:Product_Type" evaluator="xml"></arg>
<arg expression="$ctx:Source" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="custom">
<property name="Iterated Message : : :" value="++++++++++++++===================================================+++++++++++++++++=="></property>
</log>
<log level="full"></log>
<sequence key="conf:/pocSearchRsHandlerSeq"></sequence>
</sequence>
</target>
</iterate>
</then>
<else>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns="">
<noItemFound>No item in ShoeCity</noItemFound>
</productDetails>
</format>
</payloadFactory>
<sequence key="conf:/pocSearchRsHandlerSeq"></sequence>
</else>
</filter>
</sequence>
Here's my Response handler :
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="pocSearchRsHandlerSeq">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="/>
</log>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Formatting the Aggregated Responses. ==============="/>
</log>
<log level="full"/>
</onComplete>
</aggregate>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp> $1 </prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml" expression="//productDetails"/>
</args>
</payloadFactory>
<log level="custom">
<property name="Full Rs Message : : : " value="++++++++++++++===================================================+++++++++++++++++=="/>
</log>
<respond/>
</sequence>
This sequence also receives another message from a different sequence which it does aggregate (sometimes)
Here are some responses (all from same request)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>
<productDetails>
<productID>2145627</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>ACK</sourceID>
</productDetails>
<productDetails>
<productID>1452168</productID>
<productName>PUMPS</productName>
<productSize>7</productSize>
<productColour>ORANGE</productColour>
<productType>SHOE</productType>
<sourceID>SHC</sourceID>
</productDetails>
</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp></prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>
<productDetails>
<productID>1452168</productID>
<productName>PUMPS</productName>
<productSize>7</productSize>
<productColour>ORANGE</productColour>
<productType>SHOE</productType>
<sourceID>SHC</sourceID>
</productDetails>
<productDetails>
<productID>2145627</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>ACK</sourceID>
</productDetails>
<productDetails>
<productID>1124596</productID>
<productName>REEBOK_SNEAKERS</productName>
<productSize>7</productSize>
<productColour>BROWN</productColour>
<productType>SHOES</productType>
<sourceID>SHC</sourceID>
</productDetails>
</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
I mainly get the empty response back , I noticed in the logs that these have the following line in the log where the others(non-empty) don't:
TID: [0] [ESB] [2015-01-16 16:00:15,770] DEBUG {org.apache.synapse.registry.AbstractRegistry} - Cached object has expired for key : conf:/ackServiceSearchSeqRs {org.apache.synapse.registry.AbstractRegistry}
TID: [0] [ESB] [2015-01-16 16:00:15,770] DEBUG {org.apache.synapse.registry.AbstractRegistry} - Expired version number is same as current version in registry {org.apache.synapse.registry.AbstractRegistry}
EDIT :
What is the difference between using a "send" mediator with a sequence key and a "sequence" mediator?
Also , can I use a single "aggregate" node to aggregate responses from an "iterate" in one sequnece AND responses from a different sequence , reliably? It seems my aggregate node is prematurely "completing" before collecting all of my responses , and therefore executing my send/respond(any difference here?) mediator. Because I noticed this in the documentation :
Note that when the Iterate mediator is used to split the requests and produces only an n number of fragmented messages, the Aggregate mediator will terminate as soon as it receives n responses, even if you have specified a higher minimum limit.
Enabling reliable messaging gives me all sorts of other problems.
I solved it like such :
Turns out I needed a specific aggregator to agg my iterated messages (linked through the id attribute on the iterate/aggregate nodes respectively), then another to aggregate the other response as well as the above (already aggregated responses)
My Response handler:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="></property>
</log>
<aggregate id="iT">
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Formatting the Aggregated Responses. ==============="></property>
</log>
<log level="full"></log>
</onComplete>
</aggregate>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp> $1 </prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="//productDetails" evaluator="xml"></arg>
</args>
</payloadFactory>
<respond></respond>
</onComplete>
</aggregate>
</sequence>
In your sequence "pocSearchRsHandlerSeq", you should send back your aggregated response inside the aggregate's onComplete node :
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="pocSearchRsHandlerSeq">
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>$1</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml" expression="//productDetails"/>
</args>
</payloadFactory>
<send/>
</onComplete>
</aggregate>
</sequence>
We are trying out a scenario where we want to iterate over a list of nodes and make a POST call to some service with each individual request payload. We are seeing the iterate mediator actually sends two elements in that call and
that causes issues on the API end.
I have a mock service deployed locally that returns response say :
<result>
<row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>C</row>
<seat_num>103</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row>
<row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>C</row>
<seat_num>104</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row
</result>
Here is how my proxy service looks like:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CreateListingFromGetLocation"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="text" value="Triggering getLocation API call.."/>
</log>
<send receive="createListingsFromGetLocationResponseSequence">
<endpoint>
<http method="get" uri-template="http://localhost:8989/GetLocation/"/>
</endpoint>
</send>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
<description/>
</proxy>
Here is my receiving sequence that is using the iterate mediator:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="createListingsFromGetLocationResponseSequence">
<iterate xmlns:tem="http://tempuri.org" xmlns:ns="http://org.apache.synapse/xsd" expression="//result/row">
<target>
<sequence>
<log level="full">
<property name="LocationRow" value="Row element from GetLocationResponse"></property>
</log>
<payloadFactory media-type="xml">
<format>
<listing xmlns="">
<eventId>$1</eventId>
<eventDescription>$2</eventDescription>
<pricePerTicket>
<amount>$3</amount>
<currency>USD</currency>
</pricePerTicket>
<quantity>$4</quantity>
<section>$5</section>
<rows>$6</rows>
<seats>$7</seats>
<splitOption>NONE</splitOption>
</listing>
</format>
<args>
<arg expression="//event_key" evaluator="xml"></arg>
<arg expression="//show_title" evaluator="xml"></arg>
<arg expression="//Cost" evaluator="xml"></arg>
<arg expression="//seat_increment" evaluator="xml"></arg>
<arg expression="//area" evaluator="xml"></arg>
<arg expression="//row/row" evaluator="xml"></arg>
<arg expression="//seat_num" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="full">
<property name="ListingRequest" value="Listing request xml"></property>
</log>
<property name="Content-Type" value="application/xml" scope="transport" type="STRING"></property>
<property name="messageType" value="application/xml" scope="transport" type="STRING"></property>
<property name="TARGET_HOST" value="srwd30" scope="transport" type="STRING"></property>
<property name="HTTP_METHOD" value="POST" scope="transport" type="STRING"></property>
<send>
<endpoint>
<http format="pox" method="post" uri-template="http://www.srwd30.com/listings/v1/"></http>
</endpoint>
</send>
</sequence>
</target>
</iterate>
</sequence>
Firstly, I see that it is iterating over each xml node properly, here are some logs indicating that:
[2014-04-22 13:29:42,020] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:3bc14a33-3a7a-478e-bdbf-720f1ec855a5, Direction: response, LocationRow = Row element from GetLocationResponse, Envelope: <?xml version="1.0" encoding="utf-8
"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><row>
<product_id>8351</product_id>
<event_key>17708</event_key>
<event_code>AEONBM</event_code>
<show_title>Some Show</show_title>
<venue_name>Eugene ONeill Theatre</venue_name>
<area>ORCHC</area>
<row>D</row>
<seat_num>103</seat_num>
<seat_increment>1</seat_increment>
<marketing_code>PREMIUM</marketing_code>
<Cost>352.0000</Cost>
</row></soapenv:Body></soapenv:Envelope>
[2014-04-22 13:29:42,021] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:0e04ac15-a0bf-41a3-a7d7-80a1401d3efc, Direction: response, ListingRequest = Listing request xml, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:En
velope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><listing><eventId>17708</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currency></pricePerTicket><quantity>1</quantity><section>ORCHC</section><rows
>C</rows><seats>103</seats><splitOption>NONE</splitOption></listing></soapenv:Body></soapenv:Envelope>
But on my API I see that we are receiving duplicate or two root nodes:
Content-Type: application/xml
Headers: {cache-control=[no-cache], connection=[Keep-Alive],
content-type=[application/xml], host=[www.srwd30.com], http_method=[POST], messagetype=[application/xml], target_host=[srwd30], transfer-encoding=
[chunked], user-agent=[Synapse-PT-HttpComponents-NIO]}
Payload: <listing><eventId>17708</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currenc
y></pricePerTicket><quantity>1</quantity><section>ORCHC</section><rows>C</rows><seats>103</seats><splitOption>NONE</splitOption></listing><listing><eventId>1770
8</eventId><eventDescription>Some Show</eventDescription><pricePerTicket><amount>352.0000</amount><currency>USD</currency></pricePerTicket><quantity>1<
/quantity><section>ORCHC</section><rows>D</rows><seats>104</seats><splitOption>NONE</splitOption></listing>
--------------------------------------
2014-04-22 19:01:51,468 [e14f#fbf/http://www.srwd30.com/listings/v1/] priority=WARN app_name=shared-stubhubjobs thread=http-0.0.0.0-
8080-8 location=AbstractJAXBProvider line=112 javax.xml.bind.UnmarshalException
- with linked exception:
[com.ctc.wstx.exc.WstxParsingException: Illegal to have multiple roots (start tag in epilog?).
at [row,col {unknown-source}]: [1,291]]
From the looks of it, iterator is sending two elements when I make that send call. Am i missing something or doing something wrong? How can make each call independent from other?
I got the issue resolved by adding a Action header using urn:test value for that header. I realized that this was causing that duplicate requests to be sent and sometimes only one request being sent even if the iterator has about 10 records.
<proxy name="PushInventory"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="full">
<property name="STATUS"
value="+++++++++++++++++ Inside PushInventory Proxy Service ++++++++++++++++++"/>
</log>
<iterate xmlns:tem="http://tempuri.org"
xmlns:ns="http://org.apache.synapse/xsd"
id="pushInventoryIterator"
expression="//result/row"
sequential="true">
<target>
<sequence>
<payloadFactory media-type="xml">
<format>
<listing xmlns="">
<eventId>$1</eventId>
<eventDescription>$2</eventDescription>
<pricePerTicket>
<amount>$3</amount>
<currency>USD</currency>
</pricePerTicket>
<quantity>$4</quantity>
<section>$5</section>
<rows>$6</rows>
<seats>$7</seats>
<splitOption>NONE</splitOption>
</listing>
</format>
<args>
<arg evaluator="xml" expression="//event_key"/>
<arg evaluator="xml" expression="//show_title"/>
<arg evaluator="xml" expression="//Cost"/>
<arg evaluator="xml" expression="//seat_increment"/>
<arg evaluator="xml" expression="//area"/>
<arg evaluator="xml" expression="//row_desc"/>
<arg evaluator="xml" expression="//seat_num"/>
</args>
</payloadFactory>
<log level="full">
<property name="STATUS"
value="++++++++++++ Invoking Listing EndPoint ++++++++++++++"/>
</log>
<property name="Authorization"
value="Basic dafdsfadsfdsafdsfdsafdsafsdfadsf"
scope="transport"
type="STRING"/>
<property name="Content-Type"
value="application/xml"
scope="transport"
type="STRING"/>
<property name="messageType"
value="application/xml"
scope="axis2"
type="STRING"/>
<property name="HTTP_METHOD" value="POST" scope="transport" type="STRING"/>
<header name="Action" scope="default" value="urn:test"/>
<send>
<endpoint key="ListingEndPoint"/>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<log level="full">
<property name="STATUS"
value="+++++++++++++++++ Inside OutSequence of PushInventory ++++++++++++++++++"/>
</log>
<aggregate>
<completeCondition>
<messageCount min="10" max="10"/>
</completeCondition>
<onComplete xmlns:ns2="com.blah.blah" expression="//listing">
<log level="full" separator=",">
<property name="STATUS"
value="+++++++++++++++++ Aggregating responses back ++++++++++++++++++"/>
</log>
<enrich>
<source type="envelope" clone="true"/>
<target type="body"/>
</enrich>
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
</proxy>
You put your log before the iterator mediator and see what you're receiving from the endpoint. It may contain duplicate entries. Then within iterate you have another log mediator. Check for records are right.
I am really worrying about this future.If your developing some product like middleware you should aware of all the future like transaction,sec,.etc
security is good in wso2 where as transactions are really poor
i am using wso2esb4.8.0 and wso2dss3.0.1 .I wish to insert the data into my 2 tables simple logic if my 2nd table went wrong my first table also roll backed.For this i used wso2dss Box-carring future and its perfectly fine while i am doing from wso2dss try-it .BUt same future i wish to incorporate with wso2esb .i call 4 operation like beginboxcarring,insertintot1,insertintot2,endboxcarring but its not working in this then i got sloution with get JSESSIONID which will create when call a beginboxcarring but there is no use i tried with this properties to get JSESSIONID
and my proxy is
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TransactionProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="M1" value="*************HITTING Transaction PROXY*************"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="companycode" expression="//companycode/text()"/>
<property name="companyname" expression="//companyname/text()"/>
<property name="clientcode" expression="//clientcode/text()"/>
<property name="clientname" expression="//clientname/text()"/>
<property name="session type"
value="JSESSIONID"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dat="http://ws.wso2.org/dataservice">
<soapenv:Header/>
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full">
<property name="M2" value="*************HITTING Transaction PROXY*************"/>
</log>
<header name="Action" value="urn:begin_boxcar"/>
<property name="setCookieHeader"
expression="$trp:Set-Cookie"
scope="default"
type="STRING"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/begin_boxcar"
action="urn:begin_boxcar">
<source type="envelope"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<property name="setCookieHeader"
expression="$trp:Set-Cookie"
scope="default"
type="STRING"/>
<log level="full">
<property name="JSESSIONID" expression="get-property('setCookieHeader')"/>
</log>
<payloadFactory media-type="xml">
<format>
<p:insertinto_mclient_OP xmlns:p="http://ws.wso2.org/dataservice">
<xs:clientcode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:clientcode>
<xs:clientname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:clientname>
<xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
<xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
</p:insertinto_mclient_OP>
</format>
<args>
<arg evaluator="xml" expression="get-property('clientcode')"/>
<arg evaluator="xml" expression="get-property('clientname')"/>
</args>
</payloadFactory>
<header name="Action" value="urn:insertinto_mclient_OP"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/"
action="urn:insertinto_mclient_OP">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<payloadFactory media-type="xml">
<format>
<p:insertinto_mcompany_OP xmlns:p="http://ws.wso2.org/dataservice">
<xs:companycode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:companycode>
<xs:comapnyname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:comapnyname>
<xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
<xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
<xs:clientid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:clientid>
</p:insertinto_mcompany_OP>
</format>
<args>
<arg evaluator="xml" expression="get-property('companycode')"/>
<arg evaluator="xml" expression="get-property('companyname')"/>
</args>
</payloadFactory>
<log level="full">
<property name="M5" value="**************hitting2nd dss*****"/>
</log>
<header name="Action" value="urn:insertinto_mcompany_OP"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/"
action="urn:insertinto_mcompany_OP">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dat="http://ws.wso2.org/dataservice">
<soapenv:Header/>
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full">
<property name="M3" value="*************HITTING Transaction PROXY*************"/>
</log>
<header name="Action" value="urn:end_boxcar"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/end_boxcar"
action="urn:end_boxcar">
<source type="envelope"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<log level="full">
<property name="M4" value="*************HITTING Transaction PROXY*************"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
but log is showing JSESSIONID=null
and even i tried this properties also no change in log
<property name="setCookieHeader"
expression="get-property('transport','Set-Cookie')"
scope="default"
type="STRING"/>
<property name="setCookieHeader5"
expression="get-property('transport','JSESSIONID')"
scope="default"
type="STRING"/>
how would i get if i call from CURL the dss operation begin_boxcarring end point giving like this in header
Set-Cookie: JSESSIONID=6776AC50E31EBFC456CDA1895ACDE0B8; Path=/; HttpOnly
but unable to get into synapse how would i get .is there any option for transaction really worried about this future in wso2