Mmm, it looks like its a problem with the json data binding not being able to convert an int response value into a json string.
...ant On Tue, Aug 31, 2010 at 5:52 PM, Florian MOGA <moga....@gmail.com> wrote: > Thanks Ant. Line 45 is self-explanatory. That's what I was referring to as > in the previous version of the binding only the instance variables were > initialized with the objects coming from the framework. This wouldn't have > brought any differences from the target contract. Didn't expect for changes > in the service binding provider so I didn't check it out for updates earlier > but it is actually logical to have this kind of operation there. > I've committed the jsonp webapp sample which you can find here [0]. It > simulates an app where you enter your pesonal data and share it online. I've > used the cases where you submit from html, from javascript, used $.getJSON > from jQuery and multiple services with different parameter types. If you > check it out, you can see that it successfully works with services having > String and Object parameters. For other primitive parameters, it gets a JSON > Exception saying: > > org.json.JSONException: A JSONObject text must begin with '{' at character 1 > of 54 > org.json.JSONTokener.syntaxError(JSONTokener.java:451) > org.json.JSONObject.<init>(JSONObject.java:180) > org.json.JSONObject.<init>(JSONObject.java:327) > > org.apache.tuscany.sca.databinding.json.JSONHelper.toJSON(JSONHelper.java:100) > > org.apache.tuscany.sca.databinding.json.jackson.Object2JSON.transform(Object2JSON.java:65) > > org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint$LazyPullTransformer.transform(DefaultTransformerExtensionPoint.java:209) > > org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:116) > > org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer.transform(Output2OutputTransformer.java:243) > > org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint$LazyPullTransformer.transform(DefaultTransformerExtensionPoint.java:209) > > org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:116) > > org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediateOutput(MediatorImpl.java:410) > > org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:87) > > org.apache.tuscany.sca.core.invocation.RuntimeInvoker.invoke(RuntimeInvoker.java:91) > > org.apache.tuscany.sca.core.invocation.RuntimeInvoker.invoke(RuntimeInvoker.java:74) > > org.apache.tuscany.sca.core.invocation.RuntimeInvoker.invoke(RuntimeInvoker.java:63) > > org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl.invoke(RuntimeEndpointImpl.java:282) > > org.apache.tuscany.sca.binding.jsonp.runtime.JSONPServlet.invokeService(JSONPServlet.java:218) > > org.apache.tuscany.sca.binding.jsonp.runtime.JSONPServlet.service(JSONPServlet.java:63) > > org.apache.tuscany.sca.host.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:110) > > org.apache.tuscany.sca.host.webapp.TuscanyServletFilter.doFilter(TuscanyServletFilter.java:94) > > It seems there are some more special cases for conversion than initially > planned... I tried adding quotes or parentheses for the integer argument but > it didn't solve the problem... > Florian > [0] https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/contrib/samples/jsonp-webapp/ > > On Tue, Aug 31, 2010 at 4:00 PM, ant elder <ant.el...@gmail.com> wrote: >> >> On Tue, Aug 31, 2010 at 11:49 AM, Florian MOGA <moga....@gmail.com> wrote: >> > Hi Simon, >> > Thanks for pointing where can I find more info. I've taken a look at >> > the DatabindingRuntimeWireProcessor and the only thing I'm trying to >> > clarify >> > is how tuscany finds out that a String array is actually hiding behind >> > the >> > Object[] argument when invoking the wire and decides to use JSON (even >> > in >> > the case when other databindings are included). Considering that >> > databinding >> > occurs between the service invocation from the binding and the actual >> > service, I believe source contract type, operation, data types are taken >> > from: >> > >> > wire.invoke(operation, args); >> > >> > I don't see how operation can be different and I'm not aware of a >> > mechanism >> > for determining what types exactly hide under Object[]. >> > I'm currently building a jsonp sample that will include the various ways >> > of >> > calling jsonp services (json objects, jquery, etc.). It will be good for >> > testing and if you consider it good enough, for the samples/ directory >> > too. >> >> The Operation object does include the data binding type information, >> see methods such as getInputType which return DataType objects. >> Binding impls set the type of data they expect, in the jsonp binding >> see that done at line 45 of JSONPServiceBindingProvider. >> >> (Not sure if that was the question you're asking, does that help?) >> >> ...ant > >