Hi Willian,

​
No in this case​ since response from service (connector) is soap. Only when
the m
​e​
ssage format is application/json throughout the flow json will be
used internally.

On Tue, Apr 26, 2016 at 7:57 PM, Willian Antunes <
[email protected]> wrote:

> Guys,
>
> Internally the message travel as SOAP, but when the client receives the
> message it gets as a JSON (please attached file).
>
> [image: Inline image 2]
>
> Is there a way to change the $body to JSON automatically internally too?
>
>
> On Tue, Apr 26, 2016 at 12:56 PM, Willian Antunes <
> [email protected]> wrote:
>
>> @Nuwan and @Malaka,
>>
>> I'm using LDAP Connector
>> <https://docs.wso2.com/display/ESBCONNECTORS/LDAP+Connector> not a
>> endpoint mediator itself. I tried with messageType but it didn't work. Thus
>> I tried with the following as well without success:
>>
>> <property name="messageType" value="application/json" scope="axis2"
>> type="STRING"/>
>> <property name="ContentType" value="application/json" scope="axis2"
>> type="STRING"/>
>> <property name="CONTENT_TYPE" value="application/json" scope="axis2"
>> type="STRING"/>
>>
>> Does it apply to Connectors? In my case wouldn't be better using Script
>> Mediator <https://docs.wso2.com/display/ESB480/Script+Mediator> to
>> change the LDAP answer?
>>
>> On Tue, Apr 26, 2016 at 5:11 AM, Nuwan Pallewela <[email protected]> wrote:
>>
>>> Hi Willian,
>>>
>>> Do you want to change the message structure?
>>>
>>> If you don't need to change the message structure, you can change the
>>> axis2 messageType property to "json/application" and esb formatters will
>>> convert it to JSON.
>>> Eg:
>>>
>>> <property name="messageType" value="application/json" scope="axis2"/>
>>>
>>> If you want to change the message structure you can use FastXSLT mediator 
>>> [1] and then formatter to convert it to JSON as mention above.
>>> Performance of FastXSLT mediator in transforming messages is also better as 
>>> you can see in the [2].
>>>
>>> You can find more information abount JSON support in [3].
>>>
>>> [1] https://docs.wso2.com/display/ESB481/FastXSLT+Mediator
>>> [2] 
>>> http://soatutorials.blogspot.com/2016/01/wso2-esb-performance-tuning-for-xslt.html
>>> [3] 
>>> https://docs.wso2.com/display/ESB481/JSON+Support#JSONSupport-ConvertingapayloadbetweenXMLandJSON
>>>
>>> Thanks,
>>> Nuwan
>>>
>>> On Tue, Apr 26, 2016 at 2:47 AM, Willian Antunes <
>>> [email protected]> wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> One I consult my internal LDAP using LDAP Connector to retrieve the
>>>> details regarding some user I receive a huge response. For example (I'm
>>>> omitting anothers groups contained in memberOf):
>>>>
>>>> <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
>>>> <ns:result xmlns:ns="http://org.wso2.esbconnectors.ldap";>
>>>> <ns:entry>
>>>> <ns:dn>CN=Willian Lima Antunes,OU=Users,OU=Online,OU=DU
>>>> Editorial,DC=aqlbras,DC=com,DC=br</ns:dn>
>>>> <ns:displayName>Willian Lima Antunes - Tecnologia Digital - Editora
>>>> Globo</ns:displayName>
>>>> <ns:givenName>Willian</ns:givenName>
>>>> <ns:mail>[email protected]</ns:mail>
>>>> <ns:sn>Lima Antunes</ns:sn>
>>>>
>>>> <ns:memberOf>CN=grupoedgfuncionarios,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>>
>>>> <ns:memberOf>CN=EgspPRINT_6A1-new,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>>
>>>> <ns:memberOf>CN=EgspPRINT_9A3,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>>
>>>> <ns:memberOf>CN=EgspPRINT_8A1,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>> <ns:memberOf>CN=aws,OU=Groups,OU=Online,OU=DU
>>>> Editorial,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>> <ns:memberOf>CN=Ecommerce,OU=Groups,OU=Online,OU=DU
>>>> Editorial,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>> <ns:memberOf>CN=Grupo E-commerce -
>>>> TI,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>>
>>>> <ns:memberOf>CN=EgspUTLFILE_TRN02CP,CN=Users,DC=aqlbras,DC=com,DC=br</ns:memberOf>
>>>> </ns:entry>
>>>> </ns:result>
>>>> </soapenv:Body>
>>>>
>>>> What is the fastest way to change it to JSON? I know a way to do it
>>>> through Payload Factory mediator, but the work to map each value in a
>>>> variable is hard-working and the response may vary.
>>>>
>>>> Can I configure to receive a JSON instead of SOAP at the LDAP Connector
>>>> side?
>>>>
>>>> Any suggestions would be appreciated.
>>>>
>>>> Thanks.
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> ----------------------------------------------------------
>>>
>>> *Nuwan Chamara Pallewela*
>>>
>>>
>>> *Software Engineer*
>>>
>>> *WSO2, Inc. *http://wso2.com
>>> *lean . enterprise . middleware*
>>>
>>> Email   *[email protected] <[email protected]>*
>>> Mobile  *+94719079739 <%2B94719079739>@*
>>>
>>>
>>>
>>
>>
>> --
>> Yours sincerely,
>>
>> Willian Antunes
>>
>
>
>
> --
> Atenciosamente,
>
> Willian Antunes
>



-- 

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/>
https://store.wso2.com/store/

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