WSO2 json response variable convert with xslt - wso2-esb

I just started working with Wso2
I want to convert JSON response variables to camelCase.
I can show examples with Xslt

Related

Can I pass in an object into a SOAP API request

The object required contains a string. When I pass in the string I receive an error. Is there a way to build up an object using XML in a SOAP request. According to my knowledge, SOAP requests have to be in XML format.

WSO2-Call an API to got file from SFTP

The story is that there is a SFTP server for .csv file, and client wants to call an API to get the .csv data in json format. How do I implement this business scenario with a wso2 esb(4.8.1)? Thanks a lot for any idea.
You can create an ESB API,
Use file connector to search and read the file
Use smooks mediator to convert the content in to XML
Use messageType and ContentType properties to convert the XML payload to JSON

Mule parsing Incoming REST request

I have a REST client that is preparing payload in JSON format and invoking a REST service. My job is to create the REST service in Mule. I need some information on how I can map the incoming Payload to a java object so that I can invoke the REST service component class and get the values passed in the JSON object. Does the payload after HTTP inbound endpoint already contain the JSON values sent by the client? In which case a simple JSON to Object mapper would map it as Hashmap?
You will most likely need to create a custom transformer for this use case if you have a special use case.
See: http://www.mulesoft.org/documentation/display/current/Creating+Custom+Transformer+Class
If you get sent JSON you can convert it into a custom class like this:
<json:json-to-object-transformer name="jsonToFruitCollection" returnClass="
org.mule.module.json.transformers.FruitCollection"/>
Alternatively You can also use ObjectMapper and can probably use a bean to map your JSON directly to your Java object in your Java class.
You can also use <json:json-to-object-transformer/> directly after your Http inbound endpoint, parse and get each element value in your Mule flow and store in variables. Then these variables can be passed into your Java class where you can map these to your Java object easily.
Both the approach will work fine

Best way to parse unknown XML fom web service

I am working on a project where I required to parse XML response coming from web service. I don't know anything about the structure of response. I am given XML elements to gather data for, and the data is relational so elements represents columns in relational table.
I tried the WSDL approach where I can parse for method name and its response type. Based on that I can parse with NSXMLParser. The problem was I didn't find any WSDL parser which does this for me.
Any suggestions?!
Thanks,
Jignesh
I like to use this OpenSource library on GitHub
It will allow you to turn the XML string into an NSDictionary which you can the use dynamically.

WCF REST Service - XML response indentation

I have WCF rest service returning XML/RSS feeds. Some methods return data contracts, some Rss20FeedFormatter, and some are streams.
In all cases XML returns without any indentation. But I have requirement to return it formatted with indentations.
Is it possible to enable XML response indentation for WCF service?
You can load the xml output onto an xmlDocument and use XmlTextWriter to add "indent" settings.
Or you can use a simple xslt to transform the output xml onto the format that you want. for indent use
<xsl:output indent="yes" method="xml"/>
I'm not sure if WCF services can return formatted responses but here's a link to a nice method for formatting XML easily that you could implement from the calling source code.