On Mon, Jul 19, 2010 at 12:21 PM, <[email protected]> wrote:

>
>
>
> Hi,
>
> I have ported the jsonp binding from version 2.0 to version 1.4 and have
> declared the following service:
> *
>    <component name="ExpLocComponentP">
>         <implementation.java
> class="com.service.explocp.ExpLocServiceImpl"/>
>         <service name="ExpLocService">
>             <tuscany:binding.jsonp uri="/API/locatorp"/>
>         </service>
>     </component>*
>
>
> The class has the following method I want to reach:
>
> package com.service.explocp;
> import java.util.ArrayList;
>
> public class ExpLocServiceImpl implements ExpLocService {
> ...*
>    @Override
>    public void submitQuestion (QuestionDTO qDTO) throws Exception{
>      try {
>          qDTO.setSite("EL");
>          ExpLocCommon.submitQuestion(qDTO) ;
>      } catch (Throwable _ex) {
>          LOGGER.error(_ex);
>      }
>    }*
>
> Remembering that the ExpLocService has the annotation:
> *
> @Remotable
> public interface ExpLocService {
>  *
>
> Now, debugging the error presented when executing the URL:
> *
> **http://localhost:8080/eed/API/locatorp/submitQuestion?1=[{*<http://localhost:8080/eed-sca-services/API/locatorp/submitQuestion?1=[%7B>
> *"userEmailId":"*[email protected]* 
> <[email protected]>*","expertEmailId":"*<[email protected]>
> *[email protected]* <[email protected]>*","subject":"hello","question":"test
> test  test  test
> ","isST":"true","searchKeyword":"","expertiseId":"","site":"test"}]*
>
> It will go into the code for class *JSONPServlet*:
> ...
> * @Override*
>     public void service(ServletRequest servletRequest, ServletResponse
> servletResponse) throws ServletException, IOException {
>
>         String jsonRequest = getJSONRequest(servletRequest);
>         Object[] args = jsonToObjects(jsonRequest);
>         *Object response = invokeService(args);  <--- the chain of
> requests that will return into error starts here      *
>         String jsonResponse = getJSONResponse(servletRequest, response);
>         servletResponse.getOutputStream().println(jsonResponse);
>    ...
>
> later in the class :
> *
> package
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker
> *
>
> Message invoker(Message msg){
>             ....
>             Object ret;
>             if (payload != null && !payload.getClass().isArray()) {
>                 ret = imethod.invoke(instance, payload);
>             } else {
>                 ret = imethod.invoke(instance, (Object[])payload);
> <--------------------------
>             }
>
>      The *imethod *has a reference for the method
>                      *submitQuestion *which *is* the method invoked from
> the URL
>                                 (at this point the payload variable has the
> following value in the array index 0 : 
> [{[email protected]*<[email protected]>,
> [email protected]* <[email protected]>, subject=hello,
> question=test   test  test  test  , isST=true, searchKeyword=, expertiseId=,
> site=test}] )
>
>
>      and *payload* has the values passed on the URL but in as Array format
> instead of the Object *questionDTO* required by the method.
>      at this moment the payload comes with the following value:
>                     [{[email protected]* <[email protected]>,
> [email protected]* <[email protected]>, subject=hello,
> question=test   test  test  test  , isST=true, searchKeyword=, expertiseId=,
> site=test}]
>
>
>      So I Think that for some reason in the middle of everything the json
> object was not converted into the object type required by the method, or it
> should go into the imethod.invoke(instance, payload).
>
>      At the end I got the following error:
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> *description* *The server encountered an internal error () that prevented
> it from fulfilling this request.*
>
> *exception*
>
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>
> org.apache.tuscany.sca.binding.jsonp.runtime.JSONPServlet.invokeService(JSONPServlet.java:159)
>
> org.apache.tuscany.sca.binding.jsonp.runtime.JSONPServlet.service(JSONPServlet.java:61)
>
> org.apache.tuscany.sca.host.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:107)
>
> org.apache.tuscany.sca.host.webapp.TuscanyServletFilter.doFilter(TuscanyServletFilter.java:93)
>
>
>

Fabiano,

   Nice to see that you have ported the JSONP binding to 1.x, any chance you
want to share this with the community so other users of the 1.x code stream
could also take advantage of the binding ?

   As for your issue, It's hard for us to try to reproduce a problem on a
ported binding that is not available for the community, as it make things
harder to guess what the problem is without debugging it.  If you could
provide a sample unit test where one could reproduce the problem, that would
be very helpful, this could be done in the 2.x as there is already a JSONP
binding there, or it could be done after you provide a patch with a version
of the 1.x ported binding.


-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Reply via email to