Citrus: Need to validate the status code while receiving. What is the element name? - citrus-framework

Need to validate the status code while JMS receiving. What is the element name?
Is it possible to get the error code in the citrus HTML report?
enter image description here
<send endpoint="jms:${INLET}?connectionFactory=${AMQConnection}" >
<message name="helloMessage" type="text">
<resource file="file:D:/INPUT/${INPUT}"/>
</message>
<header>
<element name="scenarioId" value="${IntegrationID}" />
<element name="messageID" value="156666"/>
</header>
</send>
<receive endpoint="jms:${OUTLET}?connectionFactory=${OutletConnectionFactory}">
<message name="helloMessage">
<resource file="file:D:/expectedOutput/${OUTPUT}"/>
</message>
<header>
<element name="scenarioId" value="${IntegrationID}"/>
<element name="messageID" value="156666"/>
NEED TO VALIDATE STATUS CODE FOR JMS AND SHOW IN REPORT
</header>
</receive>

Related

WSO2 EI Send Email as Attachment From base64 String

I am using WSO2 EI 6.5.0 to send email with attachment. Is it possible to send an HTML email with attachment while the attachment is in base64 string stored in database? As of now I tried to send email but the email received in plain text.
My flow should be:
Proxy service > Get base64 string from database sequence > Send email sequence.
I tried to find references but none found regarding my issue.
Below are the source code for send email sequence
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="SendMailSequence">
<log level="full">
<property name="sequence" value="sendMailSequence" />
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">$1</ns:binary>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<!-- messageBody is from database -->
<arg expression="$ctx:messageBody" />
</args>
</payloadFactory>
<property name="messageType" value="application/octet-stream" scope="axis2" />
<property name="Subject" value="File Received" scope="transport" />
<property name="OUT_ONLY" value="true" />
<send>
<endpoint name="FileEpr">
<address uri="mailto:my-email#gmail.com" />
</endpoint>
</send>
</sequence>
Is there any reason why you have set the messageType as application/octet-stream? If you set the right messageBuilder, it should work right. Have a look at the following links.
http://sachirajapakse.blogspot.com/2016/06/sending-mails-with-attachments-via-wso2.html
Why WSO2 ESB is Encoding Email Attachment in Base64

Qlikview REST connector pagination settings for OData source xml

I can't seem to get the pagination settings right for the Qlik REST connector getting data from an OData-source. It's publicly available Dutch statistics (CBS).
An example is: https://opendata.cbs.nl/ODataFeed/odata/37259ned/TypedDataSet
First bit of the response:
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http://opendata.cbs.nl/ODataFeed/OData/37259ned" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet</id>
<title type="text">TypedDataSet</title>
<updated>2018-06-25T02:00:00+02:00</updated>
<link rel="self" title="TypedDataSet" href="https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet" />
<entry>
<id>https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet(0)</id>
<category term="Cbs.OData.TData" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="self" href="https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet(0)" />
<title />
<updated>2018-06-25T02:00:00+02:00</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ID m:type="Edm.Int32">0</d:ID>
<d:Geslacht>T001038</d:Geslacht>
<d:RegioS xml:space="preserve">NL01 </d:RegioS>
<d:Perioden>1960JJ00</d:Perioden>
<d:BevolkingOp1Januari_1 m:type="Edm.Double">11417254</d:BevolkingOp1Januari_1>
<d:LevendGeborenKinderen_2 m:type="Edm.Double">238789</d:LevendGeborenKinderen_2>
<d:LevendGeborenKinderenRelatief_3 m:type="Edm.Double">20.8</d:LevendGeborenKinderenRelatief_3>
<d:Overledenen_4 m:type="Edm.Double">87486</d:Overledenen_4>
<d:OverledenenRelatief_5 m:type="Edm.Double">7.6</d:OverledenenRelatief_5>
<d:Geboorteoverschot_6 m:type="Edm.Double">151303</d:Geboorteoverschot_6>
<d:TotaalVestiging_7 m:type="Edm.Double">551116</d:TotaalVestiging_7>
<d:TotaalVestigingRelatief_8 m:type="Edm.Double">48</d:TotaalVestigingRelatief_8>
<d:Immigratie_9 m:type="Edm.Double">45407</d:Immigratie_9>
<d:UitAndereGemeente_10 m:type="Edm.Double">505709</d:UitAndereGemeente_10>
<d:TotaalVertrekInclusiefCorrecties_11 m:null="true" />
<d:TotaalVertrekInclusiefCoRelatief_12 m:null="true" />
<d:TotaalVertrekExclusiefCorrecties_13 m:type="Edm.Double">564209</d:TotaalVertrekExclusiefCorrecties_13>
<d:TotaalVertrekExclusiefCoRelatief_14 m:type="Edm.Double">49.1</d:TotaalVertrekExclusiefCoRelatief_14>
<d:EmigratieInclusiefAdministratieveC_15 m:null="true" />
<d:EmigratieExclusiefAdministratieveC_16 m:type="Edm.Double">58226</d:EmigratieExclusiefAdministratieveC_16>
<d:NaarAndereGemeente_17 m:type="Edm.Double">505983</d:NaarAndereGemeente_17>
<d:VestigingsoverschotInclusiefCorrecties_18 m:null="true" />
<d:VestigingsoverschotExclusiefCorrecties_19 m:type="Edm.Double">-13093</d:VestigingsoverschotExclusiefCorrecties_19>
<d:TotaalSaldoCorrecties_20 m:type="Edm.Double">544</d:TotaalSaldoCorrecties_20>
<d:SaldoAdministratieveCorrecties_21 m:null="true" />
<d:SaldoOverigeCorrecties_22 m:null="true" />
<d:TotaleGroei_23 m:type="Edm.Double">138754</d:TotaleGroei_23>
<d:TotaleGroeiRelatief_24 m:type="Edm.Double">12.2</d:TotaleGroeiRelatief_24>
<d:BevolkingOp31December_25 m:type="Edm.Double">11556008</d:BevolkingOp31December_25>
</m:properties>
</content>
</entry>
The source gives a maximum of 10000 records per page. I need to get the data on the following page(s) as well.
The last few lines look like this:
</entry>
<link rel="next" href="https://opendata.cbs.nl/ODataFeed/odata/37259ned/TypedDataSet?$skip=10000" />
</feed>
I've tried the sollution in this thread: Qlikview REST connector pagination namespaced XML
However this gives me an unlimited number of records. The data-load does not stop at the last record.
Pagination settings used:
Pagination Type: Next URL
Next URL field path: feed/link/attr:href
Can anybody help me with the settings?

Apache ODE BPEL soapenv:Server axis2ns1:selectionFailure

I am new to BPEL and struggling to get started.
I created a simple If/Else workflow, but getting the following error when I am testing the wsdl file with eclipse web services explorer:
soapenv:Server axis2ns1:selectionFailure
My understanding from other similar questions is its probably something very simple and related to namespace or variable name in the if condition, but I can't understand why, and how to solve it.
I am using Apache ODE 1.3.7 on Eclipse 4.7.1 Oxygen and Tomcat 8.5.
This is my workflow design:
BPEL FILE:
<!-- Flow1 BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Mon Nov 13 23:18:38 AST 2017 -->
<bpel:process name="Flow1"
targetNamespace="http://Flow1"
suppressJoinFailure="yes"
xmlns:tns="http://Flow1"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
>
<!-- Import the client WSDL -->
<bpel:import location="Flow1Artifacts.wsdl" namespace="http://Flow1"
importType="http://schemas.xmlsoap.org/wsdl/" />
<!-- ================================================================= -->
<!-- PARTNERLINKS -->
<!-- List of services participating in this BPEL process -->
<!-- ================================================================= -->
<bpel:partnerLinks>
<!-- The 'client' role represents the requester of this service. -->
<bpel:partnerLink name="client"
partnerLinkType="tns:Flow1"
myRole="Flow1Provider"
/>
</bpel:partnerLinks>
<!-- ================================================================= -->
<!-- VARIABLES -->
<!-- List of messages and XML documents used within this BPEL process -->
<!-- ================================================================= -->
<bpel:variables>
<!-- Reference to the message passed as input during initiation -->
<bpel:variable name="input"
messageType="tns:Flow1RequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:Flow1ResponseMessage"/>
</bpel:variables>
<!-- ================================================================= -->
<!-- ORCHESTRATION LOGIC -->
<!-- Set of activities coordinating the flow of messages across the -->
<!-- services integrated within this business process -->
<!-- ================================================================= -->
<bpel:sequence name="main">
<!-- Receive input from requester.
Note: This maps to operation defined in Flow1.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:Flow1"
operation="process" variable="input"
createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<bpel:if name="If">
<bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[$input.payload/tns:input="John"]]></bpel:condition>
<bpel:sequence name="Sequence">
<bpel:assign validate="no" name="Assign">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">Hi John</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="replyOutput" partnerLink="client" portType="tns:Flow1" operation="process" variable="output" />
</bpel:sequence>
<bpel:else>
<bpel:sequence name="Sequence1">
<bpel:assign validate="no" name="Assign1">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">Not john</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="Reply" partnerLink="client" operation="process" portType="tns:Flow1" variable="output"></bpel:reply>
</bpel:sequence>
</bpel:else>
</bpel:if>
</bpel:sequence>
</bpel:process>
WSDL FILE:
<?xml version="1.0"?>
<definitions name="Flow1"
targetNamespace="http://Flow1"
xmlns:tns="http://Flow1"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TYPE DEFINITION - List of types participating in this BPEL process
The BPEL Designer will generate default request and response types
but you can define or import any XML Schema type and use them as part
of the message types.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<types>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://Flow1"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="Flow1Request">
<complexType>
<sequence>
<element name="input" type="string"/>
</sequence>
</complexType>
</element>
<element name="Flow1Response">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MESSAGE TYPE DEFINITION - Definition of the message types used as
part of the port type defintions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<message name="Flow1RequestMessage">
<part name="payload" element="tns:Flow1Request"/>
</message>
<message name="Flow1ResponseMessage">
<part name="payload" element="tns:Flow1Response"/>
</message>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PORT TYPE DEFINITION - A port type groups a set of operations into
a logical service unit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- portType implemented by the Flow1 BPEL process -->
<portType name="Flow1">
<operation name="process">
<input message="tns:Flow1RequestMessage" />
<output message="tns:Flow1ResponseMessage"/>
</operation>
</portType>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PARTNER LINK TYPE DEFINITION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<plnk:partnerLinkType name="Flow1">
<plnk:role name="Flow1Provider" portType="tns:Flow1"/>
</plnk:partnerLinkType>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BINDING DEFINITION - Defines the message format and protocol details
for a web service.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<binding name="Flow1Binding" type="tns:Flow1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="process">
<soap:operation
soapAction="http://Flow1/process" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SERVICE DEFINITION - A service groups a set of ports into
a service unit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<service name="Flow1Service">
<port name="Flow1Port" binding="tns:Flow1Binding">
<soap:address location="http://localhost:8084/ode/processes/Flow1" />
</port>
</service>
</definitions>
and Deploy.xml
<?xml version="1.0" encoding="UTF-8"?>
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:Flow1="http://Flow1">
<process name="Flow1:Flow1">
<active>true</active>
<retired>false</retired>
<process-events generate="all"/>
<provide partnerLink="client">
<service name="Flow1:Flow1Service" port="Flow1Port"/>
</provide>
</process>
</deploy>
SelectionFailure indicates that xml element that is being queried is not found. Looking at your BPEL, I assume the output variable is being queried before initializing it.
Initialize the output variable before the if/else:
<bpel:assign validate="no" name="initialize">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">
<tns:Flow1Response xmlns:tns="http://Flow1"><tns:result /></tns:Flow1Response>
</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output" />
</bpel:copy>
</bpel:assign>

Confusion regarding passing a SOAP related XML request:

I have the following message available in the WSDL:
<message name="checklookupRequest">
<part name="mobileNumber" type="xsd:string" />
<part name="userName" type="xsd:string" />
<part name="password" type="xsd:string" />
</message>
I have created the following request inside the body tag of coldfusion page:
<cfsavecontent variable="soapBody">
<cfoutput>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:p1 = "https://abcd/checkLookup.php?wsdl" >
<soap:Header>
</soap:Header>
<soap:Body>
<p1:checklookupRequest>
<phonenumber>4135671234</phonenumber>
<username>test</username>
<password>password</password>
</p1:checklookupRequest>
</soap:Body>
</soap:Envelope>
</cfoutput>
</cfsavecontent>
My question is that, I am using username and password in the cfhttp tag as well. So, it seems like I am bound to send username and password as a part of message invocation and as a part of cfhttp requirements. Please correct me if I am wrong.
Thanks
P.S: I don't have any Web API documentation available for the Web Service I am using.

Add User and Pass to SOAP Header in Mule

It seems this should be simple but the solution has been eluding me. My flow is XML -> XSLT translation -> consume web service (IBM Web Sphere Web Service to be specific). I have the pieces working individually but I am having trouble figuring out how to add user/pass to the SOAP header. I would think that I should be able to add them to the keys in the security tab on the Mule SOAP Component (I have the operation set to Proxy Client). Unfortunately, I cannot figure out what the valid keys are. Maybe I am way off base even attempting to use the security tab. So ultimately I need my outgoing XML to contain:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1">
<wsse:UsernameToken>
<wsse:Username>
myUserName
</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
myPa33W0rd
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
Currently my Mule flow is putting out:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
Do I need to add the security information manually (maybe in the XSLT translation)? That doesn't feel right but I can't figure out how to add it.
Here are the relevant lines from my flow:
<mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="src\main\resources\MappingMapToChangeCatalogEntry.xslt" outputEncoding="US-ASCII" doc:name="XSLT"/>
<cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
In order to add WS-Sec you need to configure the CXF WSS4J interceptors and inject them into Mule's CXF message processors.
Pre 3.3 =
<spring:bean name="wss4jOutConfiguration"
class="org.springframework.beans.factory.config.MapFactoryBean">
<spring:property name="sourceMap">
<spring:map>
<spring:entry key="action" value="Signature" />
<spring:entry key="user" value="joe" />
<spring:entry key="signaturePropFile" value="org/mule/module/cxf/wssec/wssecurity.properties" />
<spring:entry key="passwordCallbackClass" value="org.mule.module.cxf.wssec.ClientPasswordCallback" />
</spring:map>
</spring:property>
</spring:bean>
...
<cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP">
<cxf:outInterceptors>
<spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<spring:property name="properties" ref="wss4jOutConfiguration"/>
</spring:bean>
</cxf:outInterceptors>
</cxf:proxy-client>
Rough Sample Password Callback class:
public class ClientPasswordCallback implements CallbackHandler{
#Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
WSPasswordCallback callback = (WSPasswordCallback) callbacks[0];
if(callback.getIdentifier().equals("joe")){
callback.setPassword("pass");
}
}
See more here: http://www.mulesoft.org/documentation/display/current/WS-Security+Usability+Improvement
3.3.+ :
There is a new cxf:ws-security element availble in 3.3+ Here is an example flow here: https://svn.codehaus.org/mule/tags/mule-3.4-M2/modules/cxf/src/test/resources/org/mule/module/cxf/wssec/cxf-secure-proxy-flow.xml
<cxf:proxy-client payload="body"
enableMuleSoapHeaders="true" doc:name="SOAP">
<cxf:ws-security>
<cxf:ws-config>
<cxf:property key="action"
value="UsernameToken
Timestamp" />
<cxf:property key="user" value="joe" />
<cxf:property key="passwordCallbackClass"
value="com.mulesoft.mule.example.security.PasswordCallback" />
<cxf:property key="mustUnderstand" value="false" />
</cxf:ws-config>
</cxf:ws-security>
</cxf:proxy-client>
Previously I have also just handled he entire envelope myself when using XSLT. I have then passed the user and pass into the XSLT via context params
<xm:xslt-transformer xsl-file="xslt/ToSomethingSOAPY.xsl">
<xm:context-property key="user" value="${my.user}" />
<xm:context-property key="password" value="${my.pass}" />
</xm:xslt-transformer>
And then reieived them via xsl params like so:
<xsl:param name="user" />
....
<wsse:UsernameToken
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="UsernameToken-1018444980">
<wsse:Username><xsl:value-of select="$user" /></wsse:Username>