IBM BUS REST API Text Responce - ibm-integration-bus

I created a Rest Service using IBM Integration BUS 10.0.0.5.
And using compute node I return simple json data {"OTP":"123456"} like on image.
But I need return a simple text like "123456" not json object.
Which node or domain I must use? any sample code for this?

Check this code
SET OutputRoot.BLOB.BLOB = CAST ('Test string' AS BLOB CCSID 1208);

Related

Spring Data Elasticsearch - create SerachHits object from a JSON string

I'm using Spring Data Elasticsearch v4.3.3 and I want to mock the return value of elasticsearchOperations.search() in one of my tests.
I am looking for a way to instantiate the SearchHits object from a JSON string that contains the response (I got the internal curl response via the spring data trace).
I found this link that shows how to do what I want with native Elasticsearch - enter link description here
Is there a way to do this for Spring Data?

How do I send data in http transformation in informatica?

I have to send Id and owner id two fields from a flat file to http transformation which hits a web service(rest API).They need the data to be sent as below json format
[
{
"Id":"000xxxvvbnh",
"Ownerid":"xxxvvv1b5dmk"
}
]
how do I pass this two fields in json format as one request to the web service?
And also I need to create multiple session doing same operation parallelly hitting webservice. Is target webservice or we need to create a target flat file to capture the success or failure response?
Use http transformation to send json data to api.
First of all, read data using SQ. Using expression transformation remove [,] brackets.
Then, create a http transformation, create 1 input port as inp_id_ownerid(string) and content type(default). Then attach expression output to this input.
http will create default output port HTTPOUT and you can use this to capture return data of api.
Mention the api URL correctly. Test the URL first using swagger first if needed.
Mapping should look like this -
SQ --> EXP--> HTTP-->EXP-->TGT

Using PowerApps AzureServiceBus connector SendMessage ContentData

The PowerApps - Azure Service Bus Connector function that I am trying to use is defined as:
ServiceBus.SendMessage(EntityName:Text, {systemProperties :Text, ContentData:Blob, ContentType:Text, Properties:Table, MessageId:Text, To:Text, ReplyTo:Text, ReplyToSesionId:Text, Label:Text, ScheduledEnquequeTimeUtc:DateTime, SessionId:Text, CorrelationId:Text, SequenceNumber:Number, LockToken:Text, TimeToLive:Text})
As you can see ContentData is of type Blob, and PowerApps seems unable to convert a text string to a blob. So although the below will send a message, the content is empty on inspection in either the service bus explorer or a receiving application. Note that the Properties table data and Label value can be seen in the received message.
ServiceBus.SendMessage("TestTopic",{ContentData:"HelloWorld", Label:"MyLabel", Properties:Table({key:"MyUserDefinedKey",value:"MyUserDefinedKeyValue"})})
Is there anyway to directly populate the ContentData with text? I was hoping to use a PowerApp text input.
I have tried changing the ContentType and ContentData to various options without success.
From what I can tell in the docs, the data type for ContentData is bytes which I don't believe PowerApps supports (find supported data types here).
One thing to try would be: ContentData: JSON("Hello World", JSONFormat.IncludeBinaryData)
This is the only way I know of to handle binary data in PowerApps but I'm unsure if it will encode text.
You can send custom properties in a Power Apps Service Bus connector SendMessage call using the Properties parameter. The Properties parameter takes a Table with specific rows of key and value pairs.
I didn't find the ContentData parameter well documented. In my testing it takes a data URI string value with mandatory base64 encoding. Unfortunately there is no built in way to base64 encode in a canvas Power App. If the parameter value isn't properly formatted the resulting Servivce Bus queue message will have an empty ContentData value. Below is an example that sends a new message to the queue, setting the broker property: Label, and three custom properties, along with the text "Hello world!" in the ContentData parameter.
Example:
ServiceBus.SendMessage("p1imagecaptureevents",
{ContentType:"text/plain"
,Properties:Table (
{key: "Label", value: "labelvalue2"},
{key: "myFirstFieldName", value: "'My first field's value8'"},
{key: "mySecondFieldName", value: "My second field's value5"},
{key: "myOtherFieldName", value: "More values5"})
,ContentData:"data:text/plain;base64,SGVsbG8gd29ybGQh" // "Hello world!" base64 encoded text
})

Unable to access POST parameter values - IIB Esql

So I'm quite new to IIB and Extended SQL but what I want to do should be straight forward. I have a REST application which has a resource that is attached to a subflow. What I want to do is to get the input value passed to the service and use it to call a remote web service using the HTTP request node as shown below
SET OutputLocalEnvironment.Destination.HTTP.RequestLine.Method = 'POST';
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://localhost:8002/MyService';
SET OutputLocalEnvironment.Destination.HTTP.QueryString.RemoteParam= InputLocalEnvironment.REST.Input.Parameters.myValue;
What is happening is, when I call the REST method and pass the value as a GET, I'm able to access the value. However, when I pass the parameter value using POST, I'm unable to access the value. My current flow is as follows:
Input > Compute > HTTPRequest > Compute > Output
I have searched on Google and applied all recommendations (e.g. setting compute node to LocalEnvironment) but nothing seems to work.
Well, we need more information in order to solve your problem but I guess you have problem in your HTTP request node
Go to HTTP request then in properties go to HTTP setting and change HTTP method to the method that you are using ( get or post )
and if you want to see if you are fetching data from right property just lunch debugger and put breakepoint in before and after of your nodes, then you can see what data you are receiving in each level and you can call the proper property.
ps. don't forget to deploy your project again in order to see new
changes
I hope that works for you
After further research, I found that IIB does not automatically parse content submitted as application/x-www-form-urlencoded. I inserted a trace node and realised that the parameters are instead submitted as a BLOB. All I had to do was read the blob, cast it to a string then use a Split function or a message model to get the individual parameters. Thanks for the pointers

How to serialise payment details in google protocol buffers?

In particular I'm trying to successfully return a payment object to the bitcoin client,
this line of code:
required bytes serialized_payment_details = 4;
in the PaymentRequest message of .proto is required but I don't know how to generate the serialised payment details or even what it means to be honest?
Thanks in advance for any help :)
all that does is declare that field 4 should hold a blob - a sequence of raw data. No meaning, translation or intent is provided for that, so all processing must be done externally to protocol buffers. As for how to serialize it: that comes down to bitcoin and whatever bitcoin library / tools you are using.
The answer was:
serialized_payment_details = PaymentDetailsObject.SerializeToString()

Resources