Parsing HTTP POST data to XML in BizTalk - schema

how can I parse a POST data like this
ELEMENT1=12345&ELEMENT2=56789&ELEMENT3=9
or
{"ELEMENT1":"12345","ELEMENT2":"56789","ELEMENT3":"9"}
to
<ELEMENT1>12345</ELEMENT1>
<ELEMENT2>56789</ELEMENT2>
<ELEMENT3>9</ELEMENT3>
Where the element name comes from the POST data
The different POST data doesn't have to be in the same schema.

Related

In BPMN JS how to get process ID and process name

In addition to parsing XML, can I get the ID and name of the process through the API of BPMN?
At present, it is realized in the following ways.
Parse XML to get process name;Convert XML to JSON to get process name
You can get these information using bpmn-js-properties-panel extension

WSO2- MSF4J to parse XML dynamically

I am in a requirement to develop a middleware API on MSF4J framework which shoudl be able to accept XML as input and send a transformed XML back to client? Could see examples with json as input like the below snippet but not with XML anywhere?
How to receive and parse XML dynamically?.
With JSON code :-
import com.google.gson.JsonObject;
#POST
#Path("/orderpizza")
public Response post(JsonObject orderDetailsJson) { }
P.S- not with XML file in local system.

Outpan API C# POST Request

What does the Outpan server expect when posting data?
GET was giving me a json info that I was able to convert to an object.
Now when I'm giving information back just like the name:
https://api.outpan.com/v2/products/UPCCode/name?apikey=xxx
it will always not understand my information (error 400). Already tried sending the json back with additional info, "Foodname" and "name = Foodname"

ShopStyle API - How to Invoke an HTTP request

How do I Invoke an HTTP request with a particular URL and process the body of the response as XML?
Information Provided by ShopStyle:
HOW TO USE THE API:
Choose the method that returns the data your application needs. For example, the /products method is used to get products that match a given category or brand.Construct a URL for that method with the appropriate host, method name, and query parameters. Invoke the URL as an HTTP GET.
When the HTTP response arrives, extract the required data elements from the response's body.The rest of this document describes the details of constructing the right URL for each of the API methods. The XML format of the responses may be seen by clicking on the sample URLs shown for each method. The responses in JSON format contain identical information, just in a different format.
SHOPSTYLE API URLS
All ShopStyle API URLs have the following form:
http://api.shopstyle.com/api/VERSION/METHOD_NAMEpid=YOUR_API_KEY&format=FORMAT&...
The METHOD_NAME is taken from the list of methods in the various API shown at left (Press Link To View List of Methods-https://www.shopstylecollective.com/api/overview).
COMMON API PARAMETERS
All methods in the API accept these parameters:
API_KEY (my unique key is ******************)
pid Unique API_KEY string that is assigned to the caller. You can find your API Key on the Account Settings page.
FORMAT
The format of the response. Supported values are:
json - The response is in JSON format with UTF-8 encoding. This is the default if the parameter is absent.
xml - The response is in XML format with UTF-8 encoding.
jsonp - The response is in JSON format with UTF-8 encoding wrapped in a JavaScript method called padding. The padding must be specified with the query parameter 'callback'. Only single expressions (function reference, or object property function reference) are accepted as valid padding.
When set to 1 or 'true' the HTTP status will always be 200. Use the field "errorCode" in the response to detect whether the API Call was successful. By default, when an error occur the HTTP Status of the response will be different than 200
Again I am a beginner, so please provide detailed information on how to retrieve CATEGORY data (Examples: Dresses, Tops, Buttoms, etc) in XML format.**
Thank you!!!
Here's a simple example to get your started. Copy the code below and put it into a file, say "cat.php". Then run it by typing "php cat.php" at a command prompt (assumes you have php on your machine):
<?php
// don't show dom parse errors
libxml_use_internal_errors(true);
// grab the xml from the api
$response = file_get_contents("http://api.shopstyle.com/api/v2/categories?pid=TEST&format=xml");
$doc = new DOMDocument();
$doc->loadHTML($response);
// grab all the categories
$elements = $doc->getElementsByTagName('categories');
foreach($elements as $node){
foreach($node->childNodes as $child) {
// get the name out of the category
$nodes = $child->getElementsByTagName("name");
foreach ($nodes as $name) {
echo $name->nodeValue . PHP_EOL;
}
}
}

JMeter save unencoded Request (Sampler) parameters

I've made my test plan and set up samplers, assertions, listeners and so on.
My Http Samplers post XML data to an URL sending a parametrized encoded http request.
In my listeners I'm able to save many info about any sample, but I'm not able to save in the sample information the XML request sent in the request parameter without encoding.
Is there a way to do this?
Update
Here is an example of the exported listener:
<httpSample t="1001" ts="1376663141980" lb="Caso 1 (VI16)" rm="OK" by="648">
<assertionResult>
<name>Response Assertion</name>
<failure>false</failure>
<error>false</error>
</assertionResult>
<responseData class="java.lang.String"><?xml version="1.0" encoding="ISO-8859-1"?> [... the rest of the html encoded response ...]</responseData>
<cookies class="java.lang.String"></cookies>
<method class="java.lang.String">POST</method>
<queryString class="java.lang.String">data=%3CFastBankRichiesta+%3E+%0A%09%3CTestata+NomeMessaggio%3D%22VI16%22+Timestamp%3D%2220130816162541928%22 [... the rest of the URL encoded request ...]</queryString>
</httpSample>
So, the request and the response are encoded, but while the response is correctly html encoded (because I choosed XML export), the request is URL encoded; how to apply decoding back to text and html encoding in order to see request and response correctly with a web browser?