I'm using wso2dss3.1.0 and wso2esb 4.7.0.
I wish to filter the condition for that I have user filter mediator.
My proxy is like :
<filter xpath="get-property('mailid1')=''">
<then>
<log level="custom">
<property name="service called" value="then of inner filter"/>
<property name="mailid exist" value="creating new entry in muser with phonenumber as username"/>
</log>
<payloadFactory>
<format>
<p:Capp_insert_emercontactid xmlns:p="http://ws.wso2.org/dataservice">
<p:username>$1</p:username>
<p:firstname>$2</p:firstname>
<p:lastname>$3</p:lastname>
<p:phonenumber>$4</p:phonenumber>
<p:mailid>$5</p:mailid>
</p:Capp_insert_emercontactid>
</format>
<args>
<arg expression="get-property('phoneno1')" evaluator="xml"/>
<arg expression="get-property('firstname')" evaluator="xml"/>
<arg expression="get-property('lastname')" evaluator="xml"/>
<arg expression="get-property('phoneno1')" evaluator="xml"/>
<arg expression="get-property('mailid1')" evaluator="xml"/>
</args>
</payloadFactory>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<log level="full"/>
<send receive="UpdateEmergencyContact_seq3">
<endpoint>
<address uri="http://localhost:9764/services/Capp_MuserDataservice/" format="soap11"/>
</endpoint>
</send>
</then>
<else>
<log level="custom">
<property name="service called" value="else of inner filter"/>
<property name="Phonenumber exist" value="creating new entry in muser with mailid as username"/>
</log>
<payloadFactory>
<format>
<p:Capp_insert_emercontactid xmlns:p="http://ws.wso2.org/dataservice">
<p:username>$1</p:username>
<p:firstname>$2</p:firstname>
<p:lastname>$3</p:lastname>
<p:phonenumber>$4</p:phonenumber>
<p:mailid>$5</p:mailid>
</p:Capp_insert_emercontactid>
</format>
<args>
<arg expression="get-property('mailid1')" evaluator="xml"/>
<arg expression="get-property('firstname')" evaluator="xml"/>
<arg expression="get-property('lastname')" evaluator="xml"/>
<arg expression="get-property('phoneno1')" evaluator="xml"/>
<arg expression="get-property('mailid1')" evaluator="xml"/>
</args>
</payloadFactory>
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
<log level="full"/>
<send receive="UpdateEmergencyContact_seq3">
<endpoint>
<address uri="http://localhost:9764/services/Capp_MuserDataservice/" format="soap11"/>
</endpoint>
</send>
</else>
</filter>
I wish to do:
If mailid and phonenumber present in request then insert mailid as
username.
If only mailid present insert it as username.
if mailid absent insert phonenumber as username.
and configuration I have written is eorkinh fine for else part.
When mailid present proxy allow to insert it as username.
But problem occurred while mailid absent.In this case it sends blank username.. Even not accept hardcoded value.
Log for above at server side is like:
[2014-06-25 10:29:29,676] INFO - LogMediator phoneno1 = 111, mailid1 =
[2014-06-25 10:29:29,677] INFO - LogMediator service called = else of inner filter, Phonenumber exist = creating new entry in muser with mailid as username
[2014-06-25 10:29:29,681] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:f7e63fab-168c-4364-b49b-6c68d6e84eff, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><p:Capp_insert_emercontactid xmlns:p="http://ws.wso2.org/dataservice"><p:username> </p:username><p:firstname>y1</p:firstname><p:lastname>y2</p:lastname><p:phonenumber/><p:mailid> </p:mailid></p:Capp_insert_emercontactid></soapenv:Body></soapenv:Envelope>
[2014-06-25 10:29:29,723] INFO - LogMediator service called = UpdateEmergencyContact_seq3, userid exist = updating appusers emergency contact with newly insert userid, userid of new entry = 391529635516515404
Where is exact problem?
Am I missing something or doing some wrong while writing filter?
Please let me know soon.
it is simple error ..In your else condition . you are passing mail id as username..So, if mailid is not there, username also empty. Check your payload fcatory argument expression
in your filter xpath use boolean(get-property('mailid1')) and compare it with true and false.
Related
I'm retrieving some data's from DSS by using select query and then some transformation by payload factory after that I'm passing it to an endpoint, but when I do that the empty fields are being passed as null and not as empty strings ""
"department":"{department":null}",
"Selling_dealer__c":"{Selling_dealer__c":null}"
I wish it really showed like this:
"department":"",
"Selling_dealer__c":""
Note: Also tried the synapse properties file method but not working as excepted refer link 1 refer link 2
<sequence name="LaravelConnectorSequence" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="json">
<format>
{
"screen_type": "opportunity",
"vehicle_type__c": "",
"description": "",
"audio_file_name__c": "$1",
"lead_type__c": "Phone",
"request_type__c": "",
"mobile__c": "$2",
"leadsource": "Novum",
"company__c": "N/A",
"location__c": "$3",
"department__c": "$4",
"selling_dealer__c":"$5"
}
</format>
<args>
<arg evaluator="xml"
expression="get-property('audioFileName')"
literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml" expression="get-property('mobile')"
literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml" expression="get-property('location')"
literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml" expression="get-property('department')"
literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
<arg evaluator="xml"
expression="get-property('selling_dealer__c')"
literal="false" xmlns:ns="http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
<log level="custom">
<property expression="json-eval($)"
name="=======Laravel Request====" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
<property expression="get-property('Novum-configs')" name="config"
scope="axis2" type="OM" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="$axis2:config//*[local-name()='laravelToken']"
name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="$axis2:config//*[local-name()='laravelURL']"
name="uri.var.laravelapi" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<call>
<endpoint>
<http method="POST" uri-template="{uri.var.laravelapi}"/>
</endpoint>
</call>
<log level="custom">
<property expression="json-eval($)"
name="=======Laravel Response====" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
Since you want to convert your null values into "" strings, one workaround would be to convert the JSON to XML and then extract the elements from that and add them to your final JSON payload. In WSO2 there are different options you can set when converting JSON payloads. You can read about different options and how to work with JSON messages from here.
Since you want null to be "". You need to set the following property. If you are on MI this needs to go into deployment.toml, if on EI this goes into synapse.properties
'synapse.commons.enableXmlNullForEmptyElement'=false
Note: In MI (Surround the property name with single quotes)
When you are extracting data from the DSS response make sure to use Xpath expressions instead of JSON path expressions. Following is a simplified version of your configurations. Note I have hardcoded the DSS response.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api" name="RESTApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" url-mapping="/sample">
<inSequence>
<payloadFactory media-type="json">
<format>{"Selling_dealer__c": null}</format>
<args/>
</payloadFactory>
<property expression="//Selling_dealer__c" name="logInJson" scope="default" type="STRING"/>
<payloadFactory media-type="json">
<format>
{
"screen_type": "opportunity",
"selling_dealer__c": "$1"
}
</format>
<args>
<arg evaluator="xml" expression="$ctx:logInJson"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Above will produce the following response.
{
"screen_type": "opportunity",
"selling_dealer__c": "{"Selling_dealer__c":""}"
}
I used the script mediator to overcome this issue.
<script language="js"><![CDATA[var log=mc.getServiceLog();
var dep = mc.getProperty('department').toString();
var sell = mc.getProperty('selling_dealer__c').toString();
//log.info("===DepartmentValue===: "+dep);
var deps = mc.getProperty('department').startsWith("<Department");
//log.info("++++++++++++++++++++TRUE VALUE++++++++++++++++++"+deps);
if(dep.startsWith("<Department"))
{
dep ="";
mc.setProperty('department',dep);
}
//log.info("===DepartmentValueAfter===: "+dep)
//log.info("===SellingDealerValue===: "+sell);
var sells = mc.getProperty('selling_dealer__c').startsWith("<selling_dealer__c");
//log.info("++++++++++++++++++++TRUE VALUE++++++++++++++++++"+sells);
if(sell.startsWith("<selling_dealer__c"))
{
sell ="";
mc.setProperty('selling_dealer__c',sell);
}
//log.info("===selling_dealer__cValueAfter===: "+sell)
]]></script>
I'm trying to handle the response in the out sequence by using filter mediator with condition as (Vin number Updated Successfully) if it's satisfy Then block needs to be excluded but instead of Then block the else block is executed so Please tell me what did I mistaken in the below mentioned code. Thanks!
<outSequence>
<log level="custom">
<property expression="json-eval($.)" name="===Response from COMS==="/>
</log>
<log level="custom">
<property expression="json-eval($)" name="ComsResponse"/>
</log>
<property expression="json-eval($.ComsResponse)" name="Response" scope="default" type="STRING"/>
<filter regex="Vin number Updated Successfully" source="$ctx:Response">
<then>
<payloadFactory description="Form Response Payload" media-type="json">
<format>{"StatusCode":"$1","Message":"$2"}</format>
<args>
<arg value="200"/>
<arg value="Updated Sucessfully"/>
</args>
</payloadFactory>
</then>
<else>
<payloadFactory description="Form Response Payload" media-type="json">
<format>{"StatusCode":"$1","Message":"$2"}</format>
<args>
<arg value="400"/>
<arg value="Unable to Created or Vin Number already exist"/>
</args>
</payloadFactory>
</else>
</filter>
<respond/>
<property description="HTTPStatusCode" name="HTTP_SC" scope="axis2" type="STRING" value="200"/>
<property description="HttpMessageType" name="messageType" scope="axis2" type="STRING" value="application/json"/>
</outSequence>
The property ComsResponse is probably empty.
<property expression="json-eval($.ComsResponse)" name="Response" scope="default" type="STRING"/>
The json-eval statement is looking for a ComsResponse element/key within the message. This does not exist as the result of just $. is only a string.
So currently the filter is testing the regex against an empty string. Try setting the Response property as follows:
<property expression="json-eval($.)" name="Response" scope="default" type="STRING"/>
For more details on the json-eval function check the WSO2 documentation.
We are using WSO2 IS 5.0.0 / API Manager 1.9.1. We created a Rest API to handle the call for the internal WSO2 soap call setChallengeQuestionsOfUser in the UserIdentityManagementAdminService, however when we call this method with a specific userName the method will always update the Admin account.
Here is a code we are using to invoke the soap service
<resource methods="POST" url-mapping="/updatechallengequestionofuser" faultSequence="fault"> <!-- Only Updating admin -->
<inSequence>
<class name="org.wso2.carbon.apimgt.gateway.mediators.TokenPasser"/>
<property name="USERNAME" expression="//userName" scope="default" type="STRING"/>
<property name="USERANSWER1" expression="//userAnswer1" scope="default" type="STRING"/>
<property name="QUESTIONSETID1" expression="//questionSetId1" scope="default" type="STRING"/>
<property name="QUESTIONTEXT1" expression="//questionText1" scope="default" type="STRING"/>
<property name="USERANSWER2" expression="//userAnswer2" scope="default" type="STRING"/>
<property name="QUESTIONSETID2" expression="//questionSetId2" scope="default" type="STRING"/>
<property name="QUESTIONTEXT2" expression="//questionText2" scope="default" type="STRING"/>
<property name="USERANSWER3" expression="//userAnswer3" scope="default" type="STRING"/>
<property name="QUESTIONSETID3" expression="//questionSetId3" scope="default" type="STRING"/>
<property name="QUESTIONTEXT3" expression="//questionText3" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<ser:setChallengeQuestionsOfUser xmlns:ser="http://services.mgt.identity.carbon.wso2.org" xmlns:xsd="http://dto.mgt.identity.carbon.wso2.org/xsd">
<ser:userName>$1</ser:userName>
<ser:challengesDTOs>
<xsd:answer>$2</xsd:answer>
<xsd:id>$3</xsd:id>
<xsd:question>$4</xsd:question>
</ser:challengesDTOs>
<ser:challengesDTOs>
<xsd:answer>$5</xsd:answer>
<xsd:id>$6</xsd:id>
<xsd:question>$7</xsd:question>
</ser:challengesDTOs>
<ser:challengesDTOs>
<xsd:answer>$8</xsd:answer>
<xsd:id>$9</xsd:id>
<xsd:question>$10</xsd:question>
</ser:challengesDTOs>
</ser:setChallengeQuestionsOfUser>
</format>
<args>
<arg evaluator="xml" expression="get-property('USERNAME')"/>
<arg evaluator="xml" expression="get-property('USERANSWER1')"/>
<arg evaluator="xml" expression="get-property('QUESTIONSETID1')"/>
<arg evaluator="xml" expression="get-property('QUESTIONTEXT1')"/>
<arg evaluator="xml" expression="get-property('USERANSWER2')"/>
<arg evaluator="xml" expression="get-property('QUESTIONSETID2')"/>
<arg evaluator="xml" expression="get-property('QUESTIONTEXT2')"/>
<arg evaluator="xml" expression="get-property('USERANSWER3')"/>
<arg evaluator="xml" expression="get-property('QUESTIONSETID3')"/>
<arg evaluator="xml" expression="get-property('QUESTIONTEXT3')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:setChallengeQuestionsOfUser"/>
<property name="Authorization" expression="fn:concat('Basic ', '<base64String>')" scope="transport"/>
<property name="Accept" expression="text/xml" scope="transport"/>
<property name="ContentType" value="text/xml" scope="axis2"></property>
<property name="messageType" value="text/xml" scope="axis2"></property>
<send>
<endpoint name="UserManagement_APIproductionEndpoint_4">
<address uri="https://wso2dev.comp.org/services/UserIdentityManagementAdminService" format="soap11">
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/>
<property name="ContentType" value="application/json" scope="axis2"></property>
<property name="messageType" value="application/json" scope="axis2"></property>
<send/>
</outSequence>
</resource>
There are no error messages in the wso2carbon.log file but we see that only the account named "admin" is getting updated. We can clear the challengeQuestion fields and run the Rest call again with a valid userName and see it fill out the questions for the admin account again.
This looks to be an issue with the underlying soap call setChallengeQuestionsOfUser. Has anyone identified a way to update the challenge questions for specific users?
If we are going to change the challenge questions of user1, then user1 should be authenticated to call this method.
However in IS 5.1.0 alpha2, users who are having permission "/permission/admin/configure/security" can change other users' challenge questions too.
Isura
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 getting array list from my front end that i need to insert into a table using Wso2esb and dss i have almost done that functionality using iterator.I need to give response to front end whenever insertion over of that array list. i wish to count the any obejects which is iterating number of times
my code is like this
<iterate continueParent="true"
id="QuestionListMobile"
expression="//QuestionsList">
<target>
<sequence>
<property name="ttemplateformid"
expression="get-property('ttemplateformid')"
scope="default"
type="STRING"/>
<payloadFactory>
<format>
<p:Insert_ttemplatedetails_Mobile_Op xmlns:p="http://ws.wso2.org/dataservice">
<xs:templateformid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:templateformid>
<xs:formtemplatesectiondetailid xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:formtemplatesectiondetailid>
<xs:questionid xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:questionid>
<xs:weightage xmlns:xs="http://ws.wso2.org/dataservice">0</xs:weightage>
<xs:rank xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:rank>
<xs:score xmlns:xs="http://ws.wso2.org/dataservice">$5</xs:score>
<xs:remarks xmlns:xs="http://ws.wso2.org/dataservice">$6</xs:remarks>
<xs:feedback xmlns:xs="http://ws.wso2.org/dataservice">$7</xs:feedback>
</p:Insert_ttemplatedetails_Mobile_Op>
</format>
<args>
<arg expression="get-property('ttemplateformid')"/>
<arg expression="//sectionQuestionMapId/text()"/>
<arg expression="//QuestionId/text()"/>
<arg expression="//Rank/text()"/>
<arg expression="//answer/text()"/>
<arg expression="//remark/text()"/>
<arg expression="//Feedback/text()"/>
</args>
</payloadFactory>
<log level="full"/>
<send receive="QuestionsInsertion_Seq3">
<endpoint>
<address uri="http://localhost:9764/services/ttemplatesectiondetail_DataService/"
format="soap11"/>
</endpoint>
</send>
<log level="full"/>
</sequence>
</target>
</iterate>
i am doing well how can i know above how many arrays i got
<sequence xmlns="http://ws.apache.org/ns/synapse"
name="QuestionsInsertion_Seq3"
onError="fault">
<property name="FORCE_ERROR_ON_SOAP_FAULT"
value="true"
scope="axis2"
type="STRING"/>
<property xmlns:f="http://ws.wso2.org/dataservice"
xmlns:ns="http://org.apache.synapse/xsd"
name="ttemplatedetailid"
expression="//f:ttemplatedetailid/text()"
scope="default"
type="STRING"/>
<log>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="Total"
expression="count(//QuestionId/text())"
scope="default"
type="STRING"/>
<property xmlns:f="http://ws.wso2.org/dataservice"
xmlns:ns="http://org.apache.synapse/xsd"
name="ttemplatedetailid"
expression="//f:ttemplatedetailid/text()"/>
</log>
I am loging QuesionId count but i am not getting i am getting as total is 1.0 only
i need to count in proxy only or in sequence
thanx in advance
You can not count the iteration..What you are trying now is, you are getting DS response in your receive sequence, and from the response you are trying to read a value. So, check your response, and see what you are getting from endpoint