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=[{"userEmailId":";
[email protected]","expertEmailId":"[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], 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], expertEmailId=
[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)

     

Thanks & Regards,
____________________________________________ 


Fabiano Amorim Oliveira
IT Specialist - J2EE Developer
IBM Global Business Services
Sun Certified Java Programmer 6
WebSphere Application Server 7.0 Admin. Certified 

  E-mail: [email protected]
  Phone: +55 41 2141-4864
  Tie-line: 732-4864
  Mobile: +55 41 8861-9212
Please consider the environment before printing this email P

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

<<image/gif>>

Reply via email to