Hi,

Observe the following logs. This works. output was {"tags":["TestTag"]}

Log:-

[2014-08-12 11:00:28,104]  INFO - LogMediator To:
/services/pass.passHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction:
urn:mediate, MessageID: urn:uuid:d3d3208b-7059-4266-8835-69b616d6c247,
Direction: request, Envelope: <?xml version="1.0"
encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="
http://www.w3.org/2003/05/soap-envelope";><soapenv:Body><jsonObject><?xml-multiple
 
?><tags><jsonElement>TestTag</jsonElement></tags></jsonObject></soapenv:Body></soapenv:Envelope>
[2014-08-12 11:00:28,106] DEBUG - wire << "POST /service/echo
HTTP/1.1[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "Content-Type: application/json;
charset=UTF-8[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "Transfer-Encoding:
chunked[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "Host: localhost:9000[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "User-Agent:
Synapse-HttpComponents-NIO[\r][\n]"
[2014-08-12 11:00:28,106] DEBUG - wire << "[\r][\n]"
[2014-08-12 11:00:28,107] DEBUG - wire << "14[\r][\n]"
[2014-08-12 11:00:28,107] DEBUG - wire << "{"tags":["TestTag"]}[\r][\n]"
[2014-08-12 11:00:28,107] DEBUG - wire << "0[\r][\n]"
[2014-08-12 11:00:28,107] DEBUG - wire << "[\r][\n]"

Config:-

         <payloadFactory media-type="xml">
            <format>
               <jsonObject xmlns=""><?xml-multiple?><tags>
                     <jsonElement>TestTag</jsonElement>
                  </tags>
               </jsonObject>
            </format>
            <args/>
         </payloadFactory>
         <property name="messageType" value="application/json"
 scope="axis2"   type="STRING"/>
         <log level="full"/>


On Fri, Jul 25, 2014 at 11:27 AM, Jay <[email protected]> wrote:

> Hi Malaka,
>
> I tried with this and still having a problem.
>
> var
> a=<jsonObject><?xml-multiple?><tags<jsonElement>TestTag</jsonElement></tags></jsonObject>;
>
> Output:
>
> "jsonObject":{"tags":"TestTag"}
>
> Regards,
> Janaka
>
>
> On Thu, Jul 24, 2014 at 5:50 PM, Malaka Silva [via WSO2 Oxygen Tank] <[hidden
> email] <http://user/SendEmail.jtp?type=node&node=100277&i=0>> wrote:
>
>> Hi,
>>
>> Try following
>>
>> var tagElement=<jsonObject><?xml-multiple?><tags><jsonElement>
>> TestTag</jsonElement></tags></jsonObject>;
>>
>>
>>
>> On Wed, Jul 23, 2014 at 1:52 PM, Jay <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=100231&i=0>> wrote:
>>
>>> Hi Malaka,
>>>
>>> I have tried with your solution but it didn't work.
>>>
>>> following is my javascript code:
>>>
>>> var
>>>
>>> tagElement=<tags><?xml-multiple?><jsonElement>TestTag</jsonElement></tags>;
>>>
>>> payloadXML.tags=tagElement;
>>>
>>> This will create JSON payload as :
>>>
>>> {"tags":"TestTag"}
>>>
>>> But the requirement is:
>>>  {"tags":["TestTag"]}
>>>
>>> I have enabled following message builder/formatter as well,
>>>
>>> <messageFormatter contentType="application/json"
>>>
>>> class="org.apache.synapse.commons.json.JsonFormatter"/>
>>> <messageBuilder contentType="application/json"
>>>
>>> class="org.apache.synapse.commons.json.JsonBuilder"/>
>>>
>>> Regards,
>>> Janaka
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p100001.html
>>> Sent from the WSO2 Development mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=100231&i=1>
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>
>>
>>
>> --
>>
>> Best Regards,
>>
>> Malaka Silva
>> Senior Tech Lead
>> M: <a href="tel:%2B94%20777%20219%20791" value="+94777219791"
>> target="_blank">+94 777 219 791
>> Tel : 94 11 214 5345
>> Fax :94 11 2145300
>> Skype : malaka.sampath.silva
>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>> Blog : http://mrmalakasilva.blogspot.com/
>>
>> WSO2, Inc.
>> lean . enterprise . middleware
>> http://www.wso2.com/
>> http://www.wso2.com/about/team/malaka-silva/
>> <http://wso2.com/about/team/malaka-silva/>
>>
>> Save a tree -Conserve nature & Save the world for your future. Print this
>> email only if it is absolutely necessary.
>>
>> _______________________________________________
>> Dev mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=100231&i=2>
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p100231.html
>>  To unsubscribe from [ESB] Problems sending numeric keys in JSON
>> Payloads, click here.
>> NAML
>> <http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
>  *Janaka Ranathunga* * Senior Software Engineer*
>   Tel: +94 11 256 9150  | Mobile: +94 71 168 3232
>  [hidden email] <http://user/SendEmail.jtp?type=node&node=100277&i=1>
> <https://www.facebook.com/janaka.n.ranathunga>
> <http://lk.linkedin.com/in/janakaranathunga>
> <https://plus.google.com/+janakaranathunga>
>
> ------------------------------
> View this message in context: Re: [Dev] [ESB] Problems sending numeric
> keys in JSON Payloads
> <http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p100277.html>
>
> Sent from the WSO2 Development mailing list archive
> <http://wso2-oxygen-tank.10903.n7.nabble.com/WSO2-Development-f3.html> at
> Nabble.com.
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Best Regards,

Malaka Silva
Senior Tech Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
http://www.wso2.com/
http://www.wso2.com/about/team/malaka-silva/
<http://wso2.com/about/team/malaka-silva/>

Save a tree -Conserve nature & Save the world for your future. Print this
email only if it is absolutely necessary.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to