Citrus HTTP custom message using header elements - citrus-framework

Click this link to see Error Message I want to send a custom string through header elements Send endpoint.
element name="CustomSting" value="Mycustomessage"
And I need to validate the custom string while in receiving endpoint.
element name="CustomSting" value="Mycustomessage"
enter image description here
<template name="REST_Connect_Uri">
<send endpoint="echoEndpoint">
<message name="helloMessage">
<data>Template GET message</data>
</message>
<header>
<element name="citrus_endpoint_uri" value="${Rest_EndPoint_URI}"/>
<element name="citrus_http_method" value="${Rest_Http_Method}"/>
<element name="Content-Type" value="${Rest_Content_Type}"/>
<element name="CustomSting" value="Mycustommessge"/>
</header>
</send>
</template>
<template name="REST_Get_Message">
<receive endpoint="echoEndpoint">
<message name="helloMessage">
<resource file="file:D:/expectedOutput/${OUTPUT}"/>
</message>
<header>
<element name="CustomSting" value="Mycustommessge"/>
</header>
</receive>
</template>

Related

How do I get the WSDL from this .asmx URL?

There's this web service I want to connect to. It's fully detailed here: https://simphonytsapi.docs.apiary.io/#reference/calculatetransactiontotals/overview/example-1?console=1
As you can see there's details on the right on how to connect to it. For example to call the CalculateTransactionTotals method of the web service there is:
This .asmx URL: https://private-102dc-simphonytsapi.apiary-mock.com/1/EGateway/SimphonyPosApiWeb.asmx
And these headers:
Content-Type text/xml;charset=UTF-8
SOAPAction http://micros-hosting.com/EGateway/CalculateTransactionTotals
And this example request body:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CalculateTransactionTotals xmlns="http://micros-hosting.com/EGateway/">
<vendorCode />
<ppMenuItems />
<ppComboMeals>
<SimphonyPosApi_ComboMeal>
<ComboMealMainItem>
<Condiments />
<MenuItem>
<ItemDiscount>
<DiscObjectNum>0</DiscObjectNum>
</ItemDiscount>
<MiObjectNum>181020001</MiObjectNum>
<MiReference />
<MiWeight />
<MiMenuLevel>1</MiMenuLevel>
<MiSubLevel>1</MiSubLevel>
<MiPriveLevel>0</MiPriveLevel>
</MenuItem>
</ComboMealMainItem>
<ComboMealMenuItem>
<Condiments />
<MenuItem>
<ItemDiscount>
<DiscObjectNum>0</DiscObjectNum>
</ItemDiscount>
<MiObjectNum>181010001</MiObjectNum>
<MiReference />
<MiWeight />
<MiMenuLevel>1</MiMenuLevel>
<MiSubLevel>1</MiSubLevel>
<MiPriveLevel>0</MiPriveLevel>
</MenuItem>
</ComboMealMenuItem>
<ComboMealObjectNum>11</ComboMealObjectNum>
<SideItems>
<SimphonyPosApi_MenuItem>
<Condiments />
<MenuItem>
<ItemDiscount>
<DiscObjectNum>0</DiscObjectNum>
</ItemDiscount>
<MiObjectNum>181030001</MiObjectNum>
<MiReference />
<MiWeight />
<MiMenuLevel>1</MiMenuLevel>
<MiSubLevel>1</MiSubLevel>
<MiPriveLevel>0</MiPriveLevel>
</MenuItem>
</SimphonyPosApi_MenuItem>
<SimphonyPosApi_MenuItem>
<Condiments />
<MenuItem>
<ItemDiscount>
<DiscObjectNum>0</DiscObjectNum>
</ItemDiscount>
<MiObjectNum>299030001</MiObjectNum>
<MiReference />
<MiWeight />
<MiMenuLevel>1</MiMenuLevel>
<MiSubLevel>1</MiSubLevel>
<MiPriveLevel>0</MiPriveLevel>
</MenuItem>
</SimphonyPosApi_MenuItem>
</SideItems>
</SimphonyPosApi_ComboMeal>
</ppComboMeals>
<pSvcCharge>
<SvcChgObjectNum>0</SvcChgObjectNum>
</pSvcCharge>
<pSubtotalDiscount>
<DiscObjectNum>0</DiscObjectNum>
</pSubtotalDiscount>
<revenueCenter>11</revenueCenter>
<orderType>1</orderType>
<employeeNumber>900000092</employeeNumber>
<pTotalsResponse />
</CalculateTransactionTotals>
</soap:Body>
</soap:Envelope>
I need the WSDL to connect to this web service. How do I get it?

Create dataframe from xml file transform parent row tag to column

I have the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<Tables>
<Table Name="T1">
<Field Order="1" ColumnName="c1" Length="1" Type="C" />
<Field Order="2" ColumnName="c2" Length="50" Type="C" />
<Field Order="3" ColumnName="c3" Length="2" Type="C" />
</Catalog>
<Table Name="T2">
<Field Order="1" ColumnName="c1" Length="9" Type="I" />
<Field Order="2" ColumnName="c2" Length="120" Type="C" />
</Table>
</Tables>
And I want to transform it in the following Dataframe using PySpark:
How can I accomplish this using PySpark?
I tried:
df= spark.read.format('com.databricks.spark.xml').option("rowTag", "Field").load(path))
But with a solution like this I lose the Table Name.

Cannot filter by string from remote url

Created a WCF Data Service to pull data from Oracle database and when debugging in VS I can use the ?$filter syntax to filter returned sets.
However, using the remote url I cannot.
Point to note: I can filter by integers and dates, however I cannot filter by strings.
Also, I cannot filter by any string field in code. The filter is ignored.
Sample item below:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://localhost:61905/CampaignerSVC.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Contacts</title>
<id>http://localhost:61905/CampaignerSVC.svc/Contacts</id>
<updated>2015-04-29T15:06:48Z</updated>
<link rel="self" title="Contacts" href="Contacts" />
<entry>
<id>http://localhost:61905/CampaignerSVC.svc/Contacts(23517014)</id>
<title type="text"></title>
<updated>2015-04-29T15:06:48Z</updated>
<author>
<name />
</author>
<link rel="edit" title="ContactList" href="Contacts(23517014)" />
<category term="Campaigner_DAL_WCF.ContactList" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:LicenseNumber m:type="Edm.Int32">23517014</d:LicenseNumber>
<d:ClientCode>2000</d:ClientCode>
<d:ClientName>Doodler</d:ClientName>
<d:ClientMnemonic>DD</d:ClientMnemonic>
<d:LastName>Kerr</d:LastName>
<d:FirstName>Rover</d:FirstName>
<d:MiddleName>Frank</d:MiddleName>
<d:Title>Mr.</d:Title>
<d:PreferredFirstName>Rover</d:PreferredFirstName>
<d:PreferredMiddleName>Frank</d:PreferredMiddleName>
<d:CompanyName m:null="true" />
<d:JobTitle m:null="true" />
<d:Gender>M</d:Gender>
<d:DateOfBirth m:type="Edm.DateTime">1947-04-27T00:00:00</d:DateOfBirth>
<d:PrimaryChapterCode m:type="Edm.Int16">400</d:PrimaryChapterCode>
<d:AlternateChapterCode m:type="Edm.Int16" m:null="true" />
<d:MainAddrStreetNo>121</d:MainAddrStreetNo>
<d:MainAddrLine1>So Crescent</d:MainAddrLine1>
<d:MainAddrLine2 m:null="true" />
<d:MainAddrLine3 m:null="true" />
<d:MainAddrCity>MAICK</d:MainAddrCity>
<d:MainAddrProvCode>ON</d:MainAddrProvCode>
<d:MainAddrProv>Ontario</d:MainAddrProv>
<d:MainAddrPostalCode>KB7</d:MainAddrPostalCode>
<d:MainAddrCountryCode>CA</d:MainAddrCountryCode>
<d:MainAddrCountry>Canada</d:MainAddrCountry>
<d:MainPhoneNum>610-000-0703</d:MainPhoneNum>
<d:MainPhoneExt m:null="true" />
<d:MainFaxNum m:null="true" />
<d:MainEmailAddr>someone#rogers.com</d:MainEmailAddr>
<d:CellPhoneNum m:null="true" />
<d:ChangeType>D</d:ChangeType>
<d:EventTimeStamp m:type="Edm.DateTime">2015-04-29T02:40:02</d:EventTimeStamp>
<d:PrivacyIndicator>N</d:PrivacyIndicator>
</m:properties>
</content>
</entry>
</feed>
You can filter by string also by using the string in quotes like below-
'string'
Ok, so the issue was that I had created a class to store the results from the entity model.
Although I had a DataKey value specified, the problem was that the field I specified was not unique, therefore the filters were being ignore (or only the first matching record was filtered).
What I had to do was decorate the class with a composite DataKey.

How to Store the Images into PostgreSQL using wso2esb and wso2dss

I am using wso2esb4.7.0 , wso2dss 3.0.1 and posgresql 9.1.4
In postgresql i used data type bytea and in wso2dss 3.0.1 we dont have bytea so i used binary data type while i am inserting via dss it inserting the values but selecting query is not working
In wso2esb or wso2dss has any example for this
data is saving in this format x5c78
but selection time its not showing in dss what is the issue
<query id="insert_testing_query" useConfig="default">
<sql>INSERT INTO public.testing(username,password,remoteaddress,result,img) VALUES(?,?,?,?,?)</sql>
<param name="username" ordinal="1" sqlType="STRING"/>
<param name="password" ordinal="2" sqlType="STRING"/>
<param name="remoteaddress" ordinal="3" sqlType="STRING"/>
<param name="result" ordinal="4" sqlType="STRING"/>
<param name="img" ordinal="5" sqlType="BINARY"/>
</query>
<operation name="insert_testing_operation">
<call-query href="insert_testing_query">
<with-param name="result" query-param="result"/>
<with-param name="remoteaddress" query-param="remoteaddress"/>
<with-param name="username" query-param="username"/>
<with-param name="img" query-param="img"/>
<with-param name="password" query-param="password"/>
</call-query>
</operation>
In the select query the element should be in the xs:base64 type. Please refer this doc. Here is a sample dataservices configuration for select query.
<query id="select_testing_query" useConfig="default">
<sql>SELECT username,password,remoteaddress,result,img FROM public.testing</sql>
<result element="SAMPLECollection" rowName="SAMPLE">
<element column="username" name="username" xsdType="xs:string"/>
<element column="password" name="password" xsdType="xs:string"/>
<element column="remoteaddress" name="remoteaddress" xsdType="xs:string"/>
<element column="result" name="result" xsdType="xs:string"/>
<element column="img" name="img" xsdType="xs:base64"/>
</result>
</query>
<operation name="select_testing_operation">
<call-query href="select_testing_query"/>
</operation>

Do I have to use XML parsing or any other way of saving the server response

I am getting the following response from server:
<?xml version="1.0" encoding="UTF-8"?>
<tracks type="array">
<track>
<id type="integer">13082503</id>
<created-at type="datetime">2011-04-05T05:48:05Z</created-at>
<user-id type="integer">2796383</user-id>
<duration type="integer">6715</duration>
<commentable type="boolean">true</commentable>
<state>finished</state>
<sharing>public</sharing>
<tag-list />
<permalink>myfirstsong-tutorial1-6</permalink>
<description nil="true" />
<streamable type="boolean">true</streamable>
<downloadable type="boolean">false</downloadable>
<genre nil="true" />
<release nil="true" />
<purchase-url nil="true" />
<label-id nil="true" />
<label-name nil="true" />
<isrc nil="true" />
<video-url nil="true" />
<track-type nil="true" />
<key-signature nil="true" />
<bpm nil="true" />
<title>MyFirstSong-Tutorial1</title>
<release-year nil="true" />
<release-month nil="true" />
<release-day nil="true" />
<original-format>m4a</original-format>
<license>all-rights-reserved</license>
<uri>http://api.soundcloud.com/tracks/13082503</uri>
<permalink-url>http://soundcloud.com/sleuth007/myfirstsong-tutorial1-6</permalink-url>
<artwork-url nil="true" />
<waveform-url>http://w1.sndcdn.com/8MqNbtkeyhNZ_m.png</waveform-url>
<user>
<id type="integer">2796383</id>
<permalink>sleuth007</permalink>
<username>sleuth007</username>
<uri>http://api.soundcloud.com/users/2796383</uri>
<permalink-url>http://soundcloud.com/sleuth007</permalink-url>
<avatar-url>http://a1.sndcdn.com/images/default_avatar_large.png?5fb6c47</avatar-url>
</user>
<stream-url>http://api.soundcloud.com/tracks/13082503/stream</stream-url>
<downloads-remaining type="integer">100</downloads-remaining>
<secret-token>s-5vz60</secret-token>
<secret-uri>http://api.soundcloud.com/tracks/13082503?secret_token=s-5vz60</secret-uri>
<user-playback-count type="integer">1</user-playback-count>
<user-favorite type="boolean">false</user-favorite>
<playback-count type="integer">0</playback-count>
<download-count type="integer">0</download-count>
<favoritings-count type="integer">0</favoritings-count>
<comment-count type="integer">0</comment-count>
<created-with>
<id type="integer">61</id>
<name>Cocoa API Wrapper Test</name>
<uri>http://api.soundcloud.com/apps/61</uri>
<permalink-url>http://soundcloud.com/apps/cocoa-api-wrapper-test</permalink-url>
</created-with>
<attachments-uri>http://api.soundcloud.com/tracks/13082503/attachments</attachments-uri>
</track>
</tracks>
Do I have to do XML parsing for this or is there any other way to save this as array
You will have to use NSXMLParser for parsing the xml file. "type=array" is XML attribute and not an array.