How to send complex message headers using citrus test frame work - citrus-framework

As of now according to the information mentioned in the citrus documentation we can send header using element tag .I have a header like this
<usr><scenarioname>xx</scenarionname><instanceID>xx<<instanceID><usr>
I am sending the above header using follwing send action
<send endpoint="helloServiceEndpoint">
<message>
<payload>
<TestMessage>
<Text>Hello!</Text>
</TestMessage>
</payload>
</message>
<header>
<element name="scenarioname" value="xx"/>
<element name="instanceID" value="xx"/>
</header>
</receive>
But I want to post a complex header which not just like name value pairs but the header contains nested xml elements. how can i achieve this using citrus
example of complex header
<usr>
<scenarioname>xx</scenarionname>
<instanceID>xx<<instanceID>
<parameters>
<basicauthentication>
<username>xxxxx</username>
<password>xxxx</password>
</basicauthentication>
.
.
.
.
.
</parameters>
</usr>

The element is for name-value pairs only. You need to use the data element in the header section in order to add a complex header fragment.
<send endpoint="helloServiceEndpoint">
<message>
<payload>
<TestMessage>
<Text>Hello!</Text>
</TestMessage>
</payload>
</message>
<header>
<data>
<![CDATA[
<usr>
<scenarioname>xx</scenarionname>
<instanceID>xx</instanceID>
</usr>
]]>
</data>
</header>
</send>

Related

Google Merchant throws warning "Unrecognized attribute"

I'm facing an issue I can not explain :
When I'm uploading a feed to Google Merchant in an other language than English, the reports tells me there is many "Unrecognized attribute" that should be valid, like title, link, description, gtin, etc.
In fact, all attributes are considered warning from Google.
But the issue only occurs if it's not in english so my feed seems correct.
What is wrong? Do you have any ideas?
Thank for your help.
Here's a dump of my export (strimed to one product) :
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Google Shopping export for PrestaShop</title>
<item>
<g:id xmlns:g="http://base.google.com/ns/1.0">12345</g:id>
<title>
<![CDATA[ Basic title ]]>
</title>
<link>
<![CDATA[
https://www.example.com/test
]]>
</link>
<description>
<![CDATA[
This is a basic product
]]>
</description>
<g:quantity xmlns:g="http://base.google.com/ns/1.0">39</g:quantity>
<g:availability xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ in stock ]]>
</g:availability>
<g:price xmlns:g="http://base.google.com/ns/1.0">8.54 EUR</g:price>
<g:product_type xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[ Ofertas > Ofertas ]]>
</g:product_type>
<g:google_product_category xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
AlimentaciĆ³n, bebida y tabaco > Bebidas > Vino
]]>
</g:google_product_category>
<g:shipping_weight xmlns:g="http://base.google.com/ns/1.0">1.4 kg</g:shipping_weight>
<g:online_only xmlns:g="http://base.google.com/ns/1.0">n</g:online_only>
<g:condition xmlns:g="http://base.google.com/ns/1.0">new</g:condition>
<g:brand xmlns:g="http://base.google.com/ns/1.0">Angove Family Winemakers</g:brand>
<g:mpn xmlns:g="http://base.google.com/ns/1.0">23500023</g:mpn>
<g:gtin xmlns:g="http://base.google.com/ns/1.0"/>
<identifier_exists>FALSE</identifier_exists>
<g:image_link xmlns:g="http://base.google.com/ns/1.0">
<![CDATA[
http://example.com/test/images/1.jpg
]]>
</g:image_link>
<g:shipping xmlns:g="http://base.google.com/ns/1.0">
<g:country>ES</g:country>
<g:service>
<![CDATA[ ENVIALIA-72H ]]>
</g:service>
<g:price>24.2 EUR</g:price>
</g:shipping>
</item>
</channel>
</rss>
I presume you are uploading this as XML.
Are you encoding correctly your xml?
If you're submitting an XML file that uses either Latin-1 or UTF-16 encoding, please make sure you specify this information in your XML file. To do this, please change the first line of your data feed from to:
For Latin-1:
<?xml version="1.0" encoding="ISO-8859-1"?>
For UTF-16:
<?xml version="1.0" encoding="UTF-16"?>
I read this from here:
https://support.google.com/merchants/answer/160079
Also, have you tried to use a XML escape tool? Such as http://www.freeformatter.com/xml-escape.html
I hope this helps!
Have you tried changing the "feed type" to "product" instead of "online product inventory update"? There has been a change since 2015.
<identifier_exists>FALSE</identifier_exists>
should be
<g:identifier_exists>false</g:identifier_exists>
also you have excessive CDATA usage. I don't have any in my XML and it works jut fine. try to submit file without CDATA`s

Qlikview REST connector pagination namespaced XML

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" 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">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!
Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);
This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.

wso2esb enrich mediator deletes node soap:Header

I have 2 child wsse:Security in soap:Header and trying to delete one. I tried to do this with Enrich Mediator, but instead of replace soap:Header it deletes. Here is simple example that reproduces it:
<inSequence>
<enrich>
<source type="inline" clone="true">
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<foo/>
</soapenv:Header>
</source>
<target xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xpath="//soapenv:Header"/>
</enrich>
<log level="full"/>
</inSequence>
Log mediator logs message without Header. If I add to target action="child", everything work just as expected. So i have 2 questions:
1. Why enrich mediator act like that?
2. How can i change header with other way?
You should use header mediator to change SOAP Headers
Have a look there : https://docs.wso2.com/display/ESB481/Header+Mediator
Sample to add a custom header :
<header xmlns:myns="http://com/header" name="myns:MyHeader" value="0"/>
Sample to remove it :
<header xmlns:myns="http://com/header" name="myns:MyHeader" action="remove"/>
You can use this mediator to change http headers : just add a scope attribute with a value equals to 'transport'

action-state not accept evaluate tags Spring Web Flow 2.3

Eclipse marks this error
cvc-complex-type.2.4.a: Invalid content was found starting with element 'action-state'. One of '{"http://www.springframework.org/schema/webflow":on-end, "http://www.springframework.org/schema/webflow":output, "http://www.springframework.org/schema/webflow":exception-handler, "http://www.springframework.org/schema/webflow":bean-import}' is expected.
on this flow code
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
abstract="true">
<global-transitions>
<transition on="logIn" to ="login" />
<transition on="signup" to="signup"/>
<transition on="logOut" to="logout"/>
</global-transitions>
<action-state id="logout">
<evaluate expression="login.logout(currentUser)" />
<transition on="successLogout" to="main" />
<transition on="failLogout" to="error" />
</action-state>
I only find action-state samples and everyone are writting like my code and people use the same XSD. Either, I have read XSD file and on action-state section tag evaluate is missing. Why eclipse marks this error?
Thanks in advance!
I think there has to be an order in which the elements are defined. Try defining the action-state before the global-transitions. If you hover your mouse pointer over the "flow" xml definition in your xml file this info appears (among others):
Content Model : (attribute*, secured?, persistence-context?, var*, input*, on-start?, (action-state | view-state | decision-state | subflow-state | end-state)*, global-transitions?, on-end?, output*, exception-handler*, bean-import*)
So, there is a strict sequence.

Wikipedia API: how to retrieve multiple titles AND resolve redirects in 1 call?

It appears from the MediaWiki API:Query page that you can only resolve a redirect one at a time.
The document even says "The example below isn't really useful because it doesn't use any query modules, but shows how the redirects parameter works."
But how can you get the redirect information -- using a query module that does return multiple results?
If you have any result that returns pages, then you can just append redirects to the query and it resolves the redirects. If you don't have results that returns pages, you can usually convert it to that by using a generator.
For example, the query
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Redirects_from_gender&redirects
returns something like (shortened)
<api>
<query>
<categorymembers>
<cm pageid="648" ns="0" title="Actress" />
<cm pageid="19887132" ns="0" title="Administratrix" />
</categorymembers>
</query>
</api>
If you convert that into a generator
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender
you get
<api>
<query>
<pages>
<page pageid="648" ns="0" title="Actress" />
<page pageid="19887132" ns="0" title="Administratrix" />
</pages>
</query>
</api>
And if you now add redirects
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender&redirects
you get
<api>
<query>
<redirects>
<r from="Actress" to="Actor" />
<r from="Administratrix" to="Administrator (law)" />
</redirects>
<pages>
<page pageid="21504235" ns="0" title="Actor" />
<page pageid="6676496" ns="0" title="Administrator (law)" />
</pages>
</query>
</api>
You can also use prop=redirects with any generator, e.g. generator=allpages. This is a new feature since MW-1.23, fixing bug T59057.
When using generator=allpages with max limits (gaplimit=max and rdlimit=max) and apihighlimits right is available, all redirects on ArchWiki are resolved in a single query ;)
https://wiki.archlinux.org/api.php?action=query&generator=allpages&gapfilterredir=nonredirects&gaplimit=max&prop=redirects&rdprop=pageid|title|fragment&rdlimit=max