Also you need to use the template with + sign since its value can contain @

uri-template="/{*+*id}"

Regards
Senduran




On Mon, Nov 27, 2017 at 3:24 PM, Abimaran Kugathasan <[email protected]>
wrote:

> Hi Dilusha,
>
> Since you have defined is as path parameter in the template, you must use '
> uri.var.id' instead of 'query.param.id' in the filter mediator like below.
>
> <filter source="get-property('uri.var.id')" regex="/^([A-Za-z0-9_\-\.])+\@
> ([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/">
>
> On Sat, Nov 25, 2017 at 11:37 AM, Dilusha Alphonso <[email protected]>
> wrote:
>
>> Hi All,
>>
>> Requirement: I need to check a condition " Patient ID is the email
>> address of given patient". When I give any string to the ID, it must be an
>> email address. I have to validate ID whether it is in email format. For
>> this, I used the filter mediator in ESB, But I noticed my request didn't go
>> through that filter mediator.
>>
>> I attached my API configuration in ESB. Please, anyone, help me to
>> validate the email address with ID.
>>
>> <api xmlns="http://ws.apache.org/ns/synapse"; name="Durdan"
>> context="/test">
>>    <resource methods="GET" uri-template="/{id}">
>>       <inSequence>
>>          <property name="SymboValue" expression="get-property('uri.var.id
>> ')"/>
>>          <filter source="get-property('query.param.id')"
>> regex="/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/">
>>             <then>
>>
>>                <payloadFactory media-type="xml">
>>                   <format>
>>                      <soapenv:Envelope xmlns:soapenv="http://schemas.
>> xmlsoap.org/soap/envelope/">
>>                         <soapenv:Header>
>>                            <some>17</some>
>>                         </soapenv:Header>
>>                         <soapenv:Body>
>>                            <ser:readMediData xmlns:ser="
>> http://service.sample.durdans.com";>
>>                               <ser:patientId>$1</ser:patientId>
>>                            </ser:readMediData>
>>                         </soapenv:Body>
>>                      </soapenv:Envelope>
>>                   </format>
>>                   <args>
>>                      <arg evaluator="xml" expression="get-property('uri.
>> var.id')"/>
>>                   </args>
>>                </payloadFactory>
>>                <header name="Action" value="urn:readMediDataRecords"/>
>>                <property name="SOAPAction" value="urn:readMediData"
>> scope="transport"/>
>>                <send>
>>                   <endpoint>
>>                      <address uri="Endpoint URL" format="soap11"/>
>>                   </endpoint>
>>                </send>
>>                <respond/>
>>                <property name="messageType" value="application/soap+xml"
>> scope="axis2" type="STRING"/>
>>             </then>
>>             <else>
>>                <log level="custom">
>>                   <property name="Inside the outsequence"
>> value="deefeeeeeeeeeeeeeeeeeeee"/>
>>                </log>
>>             </else>
>>          </filter>
>>       </inSequence>
>>       <outSequence>
>>          <send/>
>>       </outSequence>
>>    </resource>
>> </api>
>>
>> Thanks
>> Dilusha
>>
>>
>>
>>
>>
>> before loop back to out sequence whether the USER_NAME and PATIENT_ID are
>> equal.
>>
>> --
>>
>>
>> *Best Regards,Dilusha Alphonso*
>>
>> *Software Engineer - Support Team*
>>
>>
>> *WSO2*
>> *Mobile : *
>>
>> *+94766837098 <+94%2076%20683%207098>[image: http://wso2.com/signature]
>> <http://wso2.com/signature>*
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thanks
> Abimaran Kugathasan
> Senior Software Engineer - API Technologies
>
> Email : [email protected]
> Mobile : +94 773922820 <+94%2077%20392%202820>
>
> <http://stackoverflow.com/users/515034>
> <http://lk.linkedin.com/in/abimaran>
> <http://www.lkabimaran.blogspot.com/>  <https://github.com/abimarank>
> <https://twitter.com/abimaran>
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Senduran *
Senior Software Engineer,
WSO2, Inc.;  http://wso2.com/ <http://wso2.com/>
Mobile: +94 77 952 6548
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to