Pushpalanka. -- Pushpalanka Jayawardhana, B.Sc.(Hons). Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ Mobile: +94779716248 Blog: pushpalankajaya.blogspot.com/ | LinkedIn: lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka
On Thu, Mar 20, 2014 at 10:23 AM, Pushpalanka Jayawardhana <[email protected]>wrote: > Hi, > > Pushpalanka. > -- > Pushpalanka Jayawardhana, B.Sc.(Hons). > Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ > Mobile: +94779716248 > Blog: pushpalankajaya.blogspot.com/ | LinkedIn: > lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka > > > > On Thu, Mar 20, 2014 at 1:00 AM, Sanjeewa Malalgoda <[email protected]>wrote: > >> >> >> >> On Thu, Mar 20, 2014 at 12:52 PM, Pushpalanka Jayawardhana < >> [email protected]> wrote: >> >>> Hi, >>> >>> I tried this with ESB sample 800 in ESB 4.6.0. >>> >>> Modified the API as follows, >>> >>> <api xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteAPI" >>> context="/stockquote"> >>> <resource methods="GET" uri-template=*"/view/{symbol}?*"*> >>> <inSequence> >>> <payloadFactory> >>> <format> >>> <m0:getQuote xmlns:m0="http://services.samples"> >>> <m0:request> >>> <m0:symbol>$1</m0:symbol> >>> </m0:request> >>> </m0:getQuote> >>> </format> >>> <args> >>> <arg expression="get-property('uri.var.symbol')"/> >>> </args> >>> </payloadFactory> >>> <send> >>> <endpoint> >>> <address uri=" >>> http://localhost:9000/services/SimpleStockQuoteService" >>> format="soap11"/> >>> </endpoint> >>> </send> >>> </inSequence> >>> <outSequence> >>> <send/> >>> </outSequence> >>> </resource> >>> <resource methods="POST"> >>> <inSequence> >>> <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> >>> <property name="OUT_ONLY" value="true"/> >>> <send> >>> <endpoint> >>> <address uri=" >>> http://localhost:9000/services/SimpleStockQuoteService" >>> format="soap11"/> >>> </endpoint> >>> </send> >>> </inSequence> >>> </resource> >>> </api> >>> >>> When tried with, curl -v http://127.0.0.1:8280/stockquote/view/WSO2 >>> ---> no reponse --> No errors at ESB side >>> >> This is the expected behavior. You need to understand this syntax first. >> Here by *?* *we define that we can have anything after ? symbol. But up >> to '?' symbol things should map exactly. Simply you need to aware that * >> means you can have anything after that point and you must allways define it >> at the end of resource definition. >> > > Thanks. My bad I didn't put the URLs that are not working correctly. > > curl -v http://127.0.0.1:8280/stockquote/view/WSO2? --> not working > curl -v http://127.0.0.1:8280/stockquote/view/WSO2?username=lanka --> > not working > > Then if I try changing the URI-template in ESB as 'uri-template=" > */view/{symbol}**"' > This time it only works if the URL matches like --> /stockquote/view/WSO2* > > > These does not work : > > http://127.0.0.1:8280/stockquote/view/WSO2?username=lanka > > http://127.0.0.1:8280/stockquote/view/WSO2 > > > > So I think, with the way I define the template, it is not identifying the > '*' as a wild card in resource definition. Please correct me if I am wrong. > Could find that though this is not working at 4.6.0 version, it works fine with 4.8.0 version. I will go with a workaround as it seems this is not supported in the used version of ESB. Thanks a lot for the thoughts.. > > > > >> When tried with, curl -v http://127.0.0.1:8280/stockquote/view/WSO2?* --> >> gives a response --> works fine >>> >>> So it seems ?* is not detected as wildcard on query parameters, but part >>> of URI-template. >>> >>> Thanks, >>> Pushpalanka. >>> -- >>> Pushpalanka Jayawardhana, B.Sc.(Hons). >>> Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ >>> Mobile: +94779716248 >>> Blog: pushpalankajaya.blogspot.com/ | LinkedIn: >>> lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka >>> >>> >>> >>> On Wed, Mar 19, 2014 at 10:50 PM, Sanjeewa Malalgoda >>> <[email protected]>wrote: >>> >>>> >>>> >>>> >>>> On Thu, Mar 20, 2014 at 3:58 AM, Pushpalanka Jayawardhana < >>>> [email protected]> wrote: >>>> >>>>> >>>>> Thanks, >>>>> Pushpalanka. >>>>> -- >>>>> Pushpalanka Jayawardhana, B.Sc.(Hons). >>>>> Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ >>>>> Mobile: +94779716248 >>>>> Blog: pushpalankajaya.blogspot.com/ | LinkedIn: >>>>> lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka >>>>> >>>>> >>>>> >>>>> On Wed, Mar 19, 2014 at 2:50 AM, Sanjeewa Malalgoda <[email protected] >>>>> > wrote: >>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Mar 19, 2014 at 2:56 PM, Pushpalanka Jayawardhana < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> Pushpalanka. >>>>>>> -- >>>>>>> Pushpalanka Jayawardhana, B.Sc.(Hons). >>>>>>> Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ >>>>>>> Mobile: +94779716248 >>>>>>> Blog: pushpalankajaya.blogspot.com/ | LinkedIn: >>>>>>> lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, Mar 19, 2014 at 1:44 AM, Sanjeewa Malalgoda < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> First for this type of definitions you need to use uri-template >>>>>>>> instead of url-mapping. With uri-templates only you will be able to >>>>>>>> define >>>>>>>> resource variables as you mentioned. See following examples. >>>>>>>> >>>>>>>> URITemplate /sanjeewa/{name,id}/* >>>>>>>> matches /sanjeewa/user,190/test >>>>>>>> matches /sanjeewa/user,190/test?year=2012 >>>>>>>> >>>>>>> >>>>>>> Thanks for the reply. >>>>>>> So as I understood we will be able to get name and id values as ' >>>>>>> get-property('uri.var.name')'. But is there way to read in 'test' >>>>>>> as a value as well. >>>>>>> >>>>>> AFAIK we cannot get it. Workaround would be get To property and do >>>>>> some string manipulation to extract it. >>>>>> >>>>>>> >>>>>>> eg: /sanjeewa/user,190/test?year=2012 >>>>>>> /sanjeewa/user,190/prod?year=2012 >>>>>>> /sanjeewa/user,190/pre-prod?year=2012 so we need to read >>>>>>> the path whether it's test/prod pr pre-prod as well. >>>>>>> >>>>>>> I have tried with URITemplate /sanjeewa/{name,id}/{environment}?* . >>>>>>> But this did not work and is expecting URL to be >>>>>>> /sanjeewa/user,190/test?*. >>>>>>> >>>>>> I didn't get your question. Can you point me uri template created and >>>>>> request sent. Did you see any error like resource not matching or >>>>>> something >>>>>> similar. >>>>>> >>>>> URI-Template : /sanjeewa/{name,id}/{environment}?* >>>>> matches : /sanjeewa/user,190/test?* >>>>> >>>>> but not matching to : /sanjeewa/user,190/test?arg1=value1 >>>>> I was just checking whether the wildcard is effective and it is not. >>>>> >>>>> Thanks for the workaround. >>>>> >>>> I just added following to uri template test cases and it worked for me. >>>> So it should work IMO. If not that is bug and we might need to fix this. >>>> >>>> template = new URITemplate("/sanjeewa/{name,id}/{test}?*"); >>>> var.put("test","tester"); >>>> var.put("name", "user"); >>>> var.put("id", "190"); >>>> >>>> assertTrue(template.matches("/sanjeewa/user,190/tester?test=12", var)); >>>> >>>> Thanks, >>>> sanjeewa. >>>> >>>>> >>>>> >>>>> >>>>>> Thanks, >>>>>> sanjeewa. >>>>>> >>>>>>> Please let me know if I am missing anything. >>>>>>> >>>>>>> >>>>>>> >>>>>>>> URITemplate /sanjeewa/~{test}?* >>>>>>>> matches /sanjeewa/~tester?test >>>>>>>> >>>>>>>> Thanks, >>>>>>>> sanjeewa. >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Mar 19, 2014 at 1:56 PM, Pushpalanka Jayawardhana < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> We need to read in some parameters from the URL path as well as >>>>>>>>> some optional query parameters. (in ESB 4.6.0) >>>>>>>>> >>>>>>>>> Have tried few combinations of URL-mapping and URI- templates. >>>>>>>>> Is it possible to use something similar to >>>>>>>>> >>>>>>>>> <resource methods="GET" url-mapping= >>>>>>>>> "/case/{grade}/{studentId}?*"> >>>>>>>>> >>>>>>>>> This did not work for me. >>>>>>>>> Is it possible to achieve this functionality without modifying the >>>>>>>>> URL to get everything as query parameters? >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Pushpalanka. >>>>>>>>> -- >>>>>>>>> Pushpalanka Jayawardhana, B.Sc.(Hons). >>>>>>>>> Software Engineer, WSO2 Lanka (pvt) Ltd; wso2.com/ >>>>>>>>> Mobile: +94779716248 >>>>>>>>> Blog: pushpalankajaya.blogspot.com/ | LinkedIn: >>>>>>>>> lk.linkedin.com/in/pushpalanka/ | Twitter: @pushpalanka >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Dev mailing list >>>>>>>>> [email protected] >>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> *Sanjeewa Malalgoda* >>>>>>>> Senior Software Engineer >>>>>>>> WSO2 Inc. >>>>>>>> Mobile : +94713068779 >>>>>>>> >>>>>>>> <http://sanjeewamalalgoda.blogspot.com/>blog >>>>>>>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> *Sanjeewa Malalgoda* >>>>>> Senior Software Engineer >>>>>> WSO2 Inc. >>>>>> Mobile : +94713068779 >>>>>> >>>>>> <http://sanjeewamalalgoda.blogspot.com/>blog >>>>>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> *Sanjeewa Malalgoda* >>>> Senior Software Engineer >>>> WSO2 Inc. >>>> Mobile : +94713068779 >>>> >>>> <http://sanjeewamalalgoda.blogspot.com/>blog >>>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/> >>>> >>>> >>>> >>> >> >> >> -- >> >> *Sanjeewa Malalgoda* >> Senior Software Engineer >> WSO2 Inc. >> Mobile : +94713068779 >> >> <http://sanjeewamalalgoda.blogspot.com/>blog >> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/> >> >> >> >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
