You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Scott Kurz (JIRA)" <de...@tuscany.apache.org> on 2011/08/03 06:41:27 UTC

[jira] [Created] (TUSCANY-3908) IllegalArgumentException with XMLStreamReader2JSON transformer

IllegalArgumentException with XMLStreamReader2JSON transformer
--------------------------------------------------------------

                 Key: TUSCANY-3908
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3908
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Integration Tests
    Affects Versions: Java-SCA-2.x
            Reporter: Scott Kurz


I get this error on what seems like a relatively simple path through the XMLStreamReader2JSON:

java.lang.IllegalArgumentException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of 

This happens on line 67 of XMLStreamReader2JSON which looks like:

            return JSONHelper.toJSON(writer.toString(), type);

I can see that writer.toString() is returning the empty string.   Not sure why.

Here is the payload (including wrapper) coming in via binding.ws.   Since it's Axis2, we load it as AXIOM and first do an OMElement2XMLStreamReader:

<ns2:greetJSON xmlns:ns2="http://intf.privatecopy.itest/"><arg0><firstName>Jason</firstName><lastName>Nosaj</lastName></arg0></ns2:greetJSON>

Since JSONDataBinding doesn't provide a wrapper handler, we unwrap first (on the source side), and so the XML being passed to XMLStreamReader2JSON corresponds to:

<arg0><firstName>Jason</firstName><lastName>Nosaj</lastName></arg0>

Could the problem be that <arg0> is not a schema-declared global element?

I'm not too familiar with JSON<->XML. so figured I'd just write this up. not sure when I'd get around to investigating more and maybe someone knows the answer.

Thanks, Scott

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TUSCANY-3908) IllegalArgumentException with XMLStreamReader2JSON transformer

Posted by "Scott Kurz (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Kurz updated TUSCANY-3908:
--------------------------------

    Attachment: recreate.patch

To recreate simply apply this patch enabling one of the itest/data-copy tests using JSON



> IllegalArgumentException with XMLStreamReader2JSON transformer
> --------------------------------------------------------------
>
>                 Key: TUSCANY-3908
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3908
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Integration Tests
>    Affects Versions: Java-SCA-2.x
>            Reporter: Scott Kurz
>         Attachments: recreate.patch
>
>
> I get this error on what seems like a relatively simple path through the XMLStreamReader2JSON:
> java.lang.IllegalArgumentException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of 
> This happens on line 67 of XMLStreamReader2JSON which looks like:
>             return JSONHelper.toJSON(writer.toString(), type);
> I can see that writer.toString() is returning the empty string.   Not sure why.
> Here is the payload (including wrapper) coming in via binding.ws.   Since it's Axis2, we load it as AXIOM and first do an OMElement2XMLStreamReader:
> <ns2:greetJSON xmlns:ns2="http://intf.privatecopy.itest/"><arg0><firstName>Jason</firstName><lastName>Nosaj</lastName></arg0></ns2:greetJSON>
> Since JSONDataBinding doesn't provide a wrapper handler, we unwrap first (on the source side), and so the XML being passed to XMLStreamReader2JSON corresponds to:
> <arg0><firstName>Jason</firstName><lastName>Nosaj</lastName></arg0>
> Could the problem be that <arg0> is not a schema-declared global element?
> I'm not too familiar with JSON<->XML. so figured I'd just write this up. not sure when I'd get around to investigating more and maybe someone knows the answer.
> Thanks, Scott

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira