Dataweave transformation for input variable to soap header - mule

I need the value in input variable to be added to soap header, using Dataweave - I was using datamapper earlier, but since it's no more supported, want to do through Dataweave.
I'm not able to map between the data variable and outbound property in Anypoint studio. I even tried with multiple variables but no use.
Does anyone has an example?

I was able to set an outbound property from a flow variable using the 'Output' drop down in DW, choose 'Outbound Property'. This feature is described here, see section 'Handling Multiple Outputs'.

Related

Nifi AmqpConsumer get amqp$headers attribute

AmqpConsumer fetch the amqp data from given queue and put the flow.
Amqp data header value set in amqp$headers attributes.
So I tried to get this attribute by updateAttribute processor and using referance, but it was given an error.
The data like as above. But I can not reach as below by updateAttribute.
How can set the amqp$headers in flow to header attribute.
Your syntax for referencing attributes is wrong, generally it would be ${amqp$headers}, but in your case, since you have a '$' in the attribute name, you reference it like ${'amqp$headers'}.

Using template message body on WCF-SQL adapter in Biztalk to insert promoted properties into SQL database

I need to insert some data from an XML document into an SQL table using a stored procedure. This should be done using the WCF-SQL adapter on a send port in Biztalk. I've set up the connection properties on the adapter, but I am missing the message part.
I'm currently using the below code with some hardcoded values inside a body template:
<SaveDocument xmlns="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo">
<conversationID>123456</conversationID>
<dataType>OIO</dataType>
<fromID></fromID>
<toID></toID>
<msgInfoExtension><![CDATA[<infoExt><fileInfo fileName="ublinvoice.xml" encoding="utf-8" /></infoExt>]]></msgInfoExtension>
<msgBody>
<bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="string"/>
</msgBody>
<msgBodyBin></msgBodyBin>
</SaveDocument>
Instead of the hardcoded values, I need to grab some of the promoted properties in an XML document, but I'm unsure how to correctly go about doing this.
In the MS documentation I found this page, which describes the structure of the request: https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-sql/message-schemas-for-procedures-and-functions
Distinguish the properties that you want to set in the SaveDocument schema
Create a map that populates the fields, the ones you want to set from the Promoted properties, just fill them with some constants from the map.
In an Orchestration have a Construct Message that contains both the map shape pointing to the above map and a message assignment shape.
In the message assignment shape have some statements like saveSG.conversationID = sourceMSG(PropmotedProperty).
P.S. I think you have manually tried to create the SaveDocument schema. This is probably not correct. The correct way is to create the stored procedure and then use the Generate Instance dialogue in Visual Studio, and to configure that to auto generate the schema for you, and as a bonus, it even generates a binding file containing the settings you need for your send port.
You might be able to use the often overlook Property Demotion feature.
It's basically the reverse of Promotion and is done by the XmlAssembler component.

How to Read specific column value from .text file in wso2 esb

I am starting to work with wso2 esb from few days back.
I need to read particular column value and set into property in wso2 esb.
My .txt file contains following values:
**SNO|FIRSTNAME|LASTNAME|EMAIL|PHONE|ADDRESS|SELLING_DEALER**
**51|christopher|chris|cpko78#gmail.com|0406-755909|US|MacGgor**
I need to read email and phone column value from this .txt file and set into property which can be used for further operations like EmailValidation or PhoneValidation.
Can anyone help me out to fine solution?
If you use ESB one option would be to do a smooks transformation into xml and then read the values from the generated xml. Just keep in mind that if you need the original csv content later in your proxy/api, you need to store the original content and restore it after you've read the needed values (using enrich mediator).
https://docs.wso2.com/display/ESB481/Smooks+Mediator
Another option would be to do a xslt transformation into xml (similar to smooks).
https://docs.wso2.com/display/ESB481/XSLT+Mediator
The last option I could think of is using the script mediator and extract the values using JavaScript, Groovy, or Ruby.
https://docs.wso2.com/display/ESB481/Script+Mediator
If you use EI then you also might expose your csv as a data service.
https://docs.wso2.com/display/DSS351/Exposing+CSV+Data+as+a+Data+Service
Hope that helps.

Mule Datamapper values from property file

I have use case as below
In mule flow i have configured a data mapper with source to target of types XML. At target side i have some header values which should contain username and password values.
I want to read the username and password values from properties file under src/main/resources.
Using normal MEL expression ${user},${password} is not working. Can some one help on this issue.
Pass these property values as input arguments to DataMapper, as explained here: https://stackoverflow.com/a/22248164/387927

How to use Global Property name in my JSON input request using SoapUI?

I have a SoapUI project which contains around 60 plus services. Each service requires some input which will be changed for every execution. So I have created certain Global Properties and assign some values to that properties.
I have to use these properties values in my SoapUI request ( i.e. JSON Format request ).
If it is groovy script means, I will use like this.
String HTiC_Username = com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['HTiC_Username'].value;
But, how to get the value of the Global Property in the request?
Hope you understand my question. Please provide proper guidance.
Thanks
To dynamically "expand" (i.e. substitute) the value of a property into a test step, the following syntax is used: ${#scope#propertyName}
...where 'scope' refers to the level at which the property has been defined (e.g. Global, Project, TestSuite, TestCase).
So to expand a property named username defined as a Global property, for example, the following code can be used directly within a Request Test Step (e.g within a JSON body, or header value, etc):
${#Global#username}
To access the same property value within a Groovy Test Step, you can use the following syntax:
context.expand('${#scope#propertyName}')
...as in the following example:
context.expand('${#Global#username}')
What we did was the following:
created a test data file to store all the specific input data for the different services (testdata.properties)
Example content of testdata.properties:
Billing_customerID=1234567
OtherService_paymentid=12121212
....
create a SoupUi global parameter (File/Preferences/Global properties): testdata_filepath=C:\...
For specific services we added a Properties test step. You can specify the "Load from" field to our new global parameter: ${#Global#testdata_filepath} Now you can use the Load button to load parameters.
Finally you can reference the parameter in your xml in the following format: ${Properties#Billing_customerID}
Example content of a service with parameter:
...
<BillingCustomerIdentification>
<BillingCustomerID>${#Properties#Billing_customerID}</BillingCustomerID>
</BillingCustomerIdentification>
...
To set up your projects in this manner also helps to automate service tests eg. using Hudson (see my previous SO answer).
If it is too heavy and automation is not a target, you can simply use ${#Global#someinputvariable} format in your xml ;-)