Hi Nadeeshaan, I faced the same issue with Advanced REST Client, its lowering case for message header keys when sending requests. Message headers must be case sensitive according to spec[1].
[1] - https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html Regards, Hemika Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +94777688882 On Mon, Aug 1, 2016 at 12:32 PM, Rajith Vitharana <[email protected]> wrote: > Hi Nadeeshan, > > As I remember, I also faced some difficulties with sending requests in > latest rest client, for example AFAIR it sends content-type header with GET > requests, these were working fine in earlier REST client implementations, > but seems they are broken in latest somehow. > > Thanks, > > On Mon, Aug 1, 2016 at 10:58 PM, Nadeeshaan Gunasinghe < > [email protected]> wrote: > >> Hi Azeez, Kasun, >> >> This works fine with the Post Man and the curl. With the Advanced REST >> Client only this issue occurred. Seems like that client sends the request >> by lowering the case of the headers. >> >> Thanks, >> >> *Nadeeshaan Gunasinghe* >> Software Engineer, WSO2 Inc. http://wso2.com >> +94770596754 | [email protected] | Skype: nadeeshaan.gunasinghe >> <#m_8585129498015183330_m_576071181468296572_> >> <http://www.facebook.com/nadeeshaan.gunasinghe> >> <http://lk.linkedin.com/in/nadeeshaan> <http://twitter.com/Nadeeshaan> >> <http://nadeeshaan.blogspot.com/> >> Get a signature like this: Click here! >> <http://ws-promos.appspot.com/r?rdata=eyJydXJsIjogImh0dHA6Ly93d3cud2lzZXN0YW1wLmNvbS9lbWFpbC1pbnN0YWxsP3dzX25jaWQ9NjcyMjk0MDA4JnV0bV9zb3VyY2U9ZXh0ZW5zaW9uJnV0bV9tZWRpdW09ZW1haWwmdXRtX2NhbXBhaWduPXByb21vXzU3MzI1Njg1NDg3Njk3OTIiLCAiZSI6ICI1NzMyNTY4NTQ4NzY5NzkyIn0=&u=638972769570006> >> >> On Mon, Aug 1, 2016 at 10:39 PM, Afkham Azeez <[email protected]> wrote: >> >>> We test with PostMan and it works. No magic here. Just send the proper >>> request from whatever the tool. >>> >>> On Mon, Aug 1, 2016 at 10:20 PM, Nadeeshaan Gunasinghe < >>> [email protected]> wrote: >>> >>>> Hi Azees, Thusitha, >>>> >>>> Thanks for the prompt reply. When used the curl in order to invoke the >>>> service, it worked fine. The issue could only observe with the Advanced >>>> REST Client used to invoke the service. >>>> >>>> Thanks, >>>> >>>> *Nadeeshaan Gunasinghe* >>>> Software Engineer, WSO2 Inc. http://wso2.com >>>> +94770596754 | [email protected] | Skype: nadeeshaan.gunasinghe >>>> <#m_8585129498015183330_m_576071181468296572_m_-5747302383305428828_m_-7398431186153042768_> >>>> <http://www.facebook.com/nadeeshaan.gunasinghe> >>>> <http://lk.linkedin.com/in/nadeeshaan> <http://twitter.com/Nadeeshaan> >>>> <http://nadeeshaan.blogspot.com/> >>>> Get a signature like this: Click here! >>>> <http://ws-promos.appspot.com/r?rdata=eyJydXJsIjogImh0dHA6Ly93d3cud2lzZXN0YW1wLmNvbS9lbWFpbC1pbnN0YWxsP3dzX25jaWQ9NjcyMjk0MDA4JnV0bV9zb3VyY2U9ZXh0ZW5zaW9uJnV0bV9tZWRpdW09ZW1haWwmdXRtX2NhbXBhaWduPXByb21vXzU3MzI1Njg1NDg3Njk3OTIiLCAiZSI6ICI1NzMyNTY4NTQ4NzY5NzkyIn0=&u=777841174620847> >>>> >>>> On Mon, Aug 1, 2016 at 10:08 PM, Afkham Azeez <[email protected]> wrote: >>>> >>>>> Follow the addStock method in this sample: >>>>> https://github.com/wso2/msf4j/blob/master/samples/stockquote/fatjar/src/main/java/org/wso2/msf4j/example/StockQuoteService.java#L108 >>>>> >>>>> Then; >>>>> curl -v -X POST -H "Content-Type:application/json" -d >>>>> '{"symbol":"GOOG","name":"Google Inc.", "high":190.23, "low":187.45}' >>>>> http://localhost:8080/stockquote >>>>> >>>>> On Mon, Aug 1, 2016 at 9:28 PM, Nadeeshaan Gunasinghe < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> When I try to execute the following sample [1] service's POST >>>>>> operation I could observe the bellow exception. >>>>>> >>>>>> *java.lang.IllegalArgumentException: argument type mismatch* >>>>>> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)* >>>>>> * at >>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)* >>>>>> * at >>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)* >>>>>> * at java.lang.reflect.Method.invoke(Method.java:497)* >>>>>> * at >>>>>> org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:108)* >>>>>> * at >>>>>> org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod(MSF4JMessageProcessor.java:129)* >>>>>> * at >>>>>> org.wso2.msf4j.internal.MSF4JMessageProcessor.receive(MSF4JMessageProcessor.java:73)* >>>>>> * at >>>>>> org.wso2.carbon.transport.http.netty.listener.WorkerPoolDispatchingSourceHandler$1.run(WorkerPoolDispatchingSourceHandler.java:127)* >>>>>> * at >>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)* >>>>>> * at >>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)* >>>>>> * at java.lang.Thread.run(Thread.java:745)* >>>>>> >>>>>> According to the sample service method I am going to capture the json >>>>>> payload as an object passed to the method as follows. >>>>>> >>>>>> @POST >>>>>> @Path("/test") >>>>>> public Response post(TestPayload testPayloadBody) { >>>>>> // TODO: Implementation for HTTP POST request >>>>>> System.out.println("POST invoked ====== " +testPayloadBody); >>>>>> return Response.ok().entity(testPayloadBody).build(); >>>>>> } >>>>>> >>>>>> >>>>>> After further debugging the code, could find that the arguments list >>>>>> passed at [2] contains a string. But according to the implementation it >>>>>> should be a *TestPayload *object. If we observe at [3] the headers >>>>>> Map's keys are all in lowercase. In order to get the header from the map, >>>>>> we use the constant from* javax.ws.rs.core.Headers, *there the >>>>>> CONTENT_TYPE constant is not in all lowercase and Due to this reason >>>>>> *contentTypeHeaderStr >>>>>> *becomes null and leads to convert the object to a String by the >>>>>> default text formatter, based on the wild card content-type [4]. >>>>>> >>>>>> [1] >>>>>> https://drive.google.com/a/wso2.com/folderview?id=0Bx7aKS6MDJqSVDhVSTdWZ1JBVGc&usp=sharing >>>>>> [2] >>>>>> https://github.com/wso2/msf4j/blob/master/core/src/main/java/org/wso2/msf4j/internal/router/HttpMethodInfo.java#L108 >>>>>> [3] >>>>>> https://github.com/wso2/carbon-messaging/blob/master/components/src/main/java/org/wso2/carbon/messaging/CarbonMessage.java#L162 >>>>>> [4] >>>>>> https://github.com/wso2/msf4j/blob/master/core/src/main/java/org/wso2/msf4j/internal/router/HttpResourceModelProcessor.java#L158 >>>>>> >>>>>> Thanks, >>>>>> >>>>>> *Nadeeshaan Gunasinghe* >>>>>> Software Engineer, WSO2 Inc. http://wso2.com >>>>>> +94770596754 | [email protected] | Skype: nadeeshaan.gunasinghe >>>>>> <#m_8585129498015183330_m_576071181468296572_m_-5747302383305428828_m_-7398431186153042768_m_1214838822956125518_m_-746156207640328338_> >>>>>> <http://www.facebook.com/nadeeshaan.gunasinghe> >>>>>> <http://lk.linkedin.com/in/nadeeshaan> >>>>>> <http://twitter.com/Nadeeshaan> <http://nadeeshaan.blogspot.com/> >>>>>> Get a signature like this: Click here! >>>>>> <http://ws-promos.appspot.com/r?rdata=eyJydXJsIjogImh0dHA6Ly93d3cud2lzZXN0YW1wLmNvbS9lbWFpbC1pbnN0YWxsP3dzX25jaWQ9NjcyMjk0MDA4JnV0bV9zb3VyY2U9ZXh0ZW5zaW9uJnV0bV9tZWRpdW09ZW1haWwmdXRtX2NhbXBhaWduPXByb21vXzU3MzI1Njg1NDg3Njk3OTIiLCAiZSI6ICI1NzMyNTY4NTQ4NzY5NzkyIn0=&u=543026424429568> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> *Afkham Azeez* >>>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>>> Member; Apache Software Foundation; http://www.apache.org/ >>>>> * <http://www.apache.org/>* >>>>> *email: **[email protected]* <[email protected]> >>>>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * >>>>> *http://blog.afkham.org* <http://blog.afkham.org> >>>>> *twitter: **http://twitter.com/afkham_azeez* >>>>> <http://twitter.com/afkham_azeez> >>>>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez >>>>> <http://lk.linkedin.com/in/afkhamazeez>* >>>>> >>>>> *Lean . Enterprise . Middleware* >>>>> >>>> >>>> >>> >>> >>> -- >>> *Afkham Azeez* >>> Director of Architecture; WSO2, Inc.; http://wso2.com >>> Member; Apache Software Foundation; http://www.apache.org/ >>> * <http://www.apache.org/>* >>> *email: **[email protected]* <[email protected]> >>> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * >>> *http://blog.afkham.org* <http://blog.afkham.org> >>> *twitter: **http://twitter.com/afkham_azeez* >>> <http://twitter.com/afkham_azeez> >>> *linked-in: **http://lk.linkedin.com/in/afkhamazeez >>> <http://lk.linkedin.com/in/afkhamazeez>* >>> >>> *Lean . Enterprise . Middleware* >>> >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Rajith Vitharana > > Senior Software Engineer, > WSO2 Inc. : wso2.com > Mobile : +94715883223 > Blog : http://lankavitharana.blogspot.com/ > <http://wso2.com/signature> > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
