Anda di halaman 1dari 68

CSV to XML

Task 1 Converting CSV to XML


CSV

XML

Exp219, Shankar,Bose ------------------

<Employee>

<Empid>Exp219</Empid>
<Name> Shankar</Name>
<Last Name>Bose</LastName>
</Employee>

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Input Que : CSV2XML.IN1
Input Que : CSV2XML.OUT1
Que Manger: IBM9QMGR ( This is the default Que Manager)

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Input Que : CSV2XML.IN1 (Create Input Put Que Under Default Que Manger
IBM9QMGR )

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Input Que : CSV2XML.IN1

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Input Que : CSV2XML.IN1

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Input Que : CSV2XML.IN1

CSV to XML
Step1 Create Que Using IBMWebsphere MQ Explorer
Out Put Que : CSV2XML.OUT1 (Create Out Put Que Under Default Que Manger IBM9QMGR
same as CSV2XML.IN1)

CSV to XML
Step2 Creating New Application Named CSV2XML using IBM Integration Toolkit

CSV to XML
Step3 Creating Message Model Under Application Named CSV2XML

CSV to XML

CSV to XML
Step3 Creating Message Model Under Application Named CSV2XML>> Creating Schema >>Add
Message to Schema

CSV to XML
Step4 Creating Message Model Under Application Named CSV2XML>> Creating Schema>>Add
Message to Schema

CSV to XML
Step5Creating Message Model Under Application Named CSV2XML>> Creating Schema>>Add
Message to Schema>> Test Parse Model

CSV to XML
Step6 Creating Message Model Under Application Named CSV2XML>> Creating Schema>>Add
Message to Schema>> Test Parse Model
Note: Create Input CSV file named CSV2XMLIN.txt to be transformed to XML

CSV to XML
Step6 Creating Message Model Under Application Named CSV2XML>> Creating Schema>>Add
Message to Schema>> Test Parse Model
Input Schema tested

CSV to XML
Step6 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml

CSV to XML
Step6 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml

CSV to XML
Step6 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml

CSV to XML
Step7 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml>> Creating XSD
Open http://www.freeformatter.com/xsd-generator.html to generate XSD

CSV to XML
Step7 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml>> Creating XSD
1. Paste the XSD in the Source as shown in the Screen shot and Save

CSV to XML
Step7 Creating Message Model Under Application Named CSV2XML>> Creating Schema for Out Put
Xml>> Creating XSD
1. Close the CSV2XML_OUTPUT.xsd and reopen It
2. Click the Design Tab

CSV to XML
Step8 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow

CSV to XML
Step8 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow>> Input
Node property
Paste The Que name as CSV2XML.IN1

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow>>
Compute Node property

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow>> Out
Put Node property
Paste The Que name as CSV2XML.OUT1 AND Queue Manager name as IB9QMGR

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow>>
Compute Node property

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Creating Message Flow>> Esql
Click Compute Node and add the Following Code

CSV to XML
Step9 Creating Message Model Under Application Named CSV2XML>> Deploying Message Flow

CSV to XML
Step10 Write and read from Queue using RfhUtil

CSV to XML>> Using Debug Mode>> Launching


Debugger

CSV to XML>> Using Debug Mode>> Launching


Debugger

CSV to XML>> Using Debug Mode>> Launching


Debugger

CSV to XML>> Using Debug Mode>> Launching


Debugger

CSV to XML (LOOP)


Task 2 Converting CSV to XML
Kroger,MR.,Vivek,Arora,EXP268
Kroger,MR.,Shankar,Bose,EXP2
19
Kroger,MS.,Isha,Arora,EXP214
Kroger2,Mr.,Zeeshan,Ahmad,E
XP209

<Organizations>
<Org OrgName="Kroger">
<Employee>
<EmployeeFirstName
Salutation="MR.">Vivek</EmployeeFirstName>
<EmployeetLastName>Arora</EmployeetLastName>
<EmployeeID>EXP268</EmployeeID>
</Employee>
<Employee>
<EmployeeFirstName
Salutation="MR.">Shankar</EmployeeFirstName>
<EmployeetLastName>Bose</EmployeetLastName>
<EmployeeID>EXP219</EmployeeID>
</Employee>
<Employee>
<EmployeeFirstName
Salutation="MS.">Isha</EmployeeFirstName>
<EmployeetLastName>Arora</EmployeetLastName>
<EmployeeID>EXP214</EmployeeID>
</Employee>
</Org>
<Org OrgName="Kroger2">
<Employee>
<EmployeeFirstName
Salutation="Mr.">Zeeshan</EmployeeFirstName>
<EmployeetLastName>Ahmad</EmployeetLastName>
<EmployeeID>EXP209</EmployeeID>

CSV to XML(LOOP)

CSV to XML (LOOP)

CSV to XML (LOOP) >> ESQL

CREATE FUNCTION Main() RETURNS BOOLEAN


BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE org_name CHARACTER
DECLARE i INTEGER 1;
DECLARE j INTEGER 0;

'abc';

FOR index1 AS InputRoot.DFDL.CSV2XML_LOOP_IN.record[] DO


IF org_name <> index1.organizationTHEN
set org_name=index1.organization;
SET j=j+1;
Set i=1;
SET OutputRoot.XMLNS.Organizations.Org[j].(XML.Attribute)OrgName= index1.organization;
END IF ;
/*Write Element and then attribute*/
SET OutputRoot.XMLNS.Organizations.Org[j].Employee[i].(XML.Element)EmployeeFirstName =index1.firstname;
SET OutputRoot.XMLNS.Organizations.Org[j].Employee[i].EmployeeFirstName.(XML.Attribute)Salutation =index1.salutation;
SET
SET
SET
SET

OutputRoot.XMLNS.Organizations.Org[j].Employee[i].EmployeetLastName =index1.lastname;
OutputRoot.XMLNS.Organizations.Org[j].Employee[i].EmployeeID =index1.empid;
org_name= index1.organization;
i=i+1;

END FOR ;
RETURN TRUE;
END;

XML to CSV (LOOP)


Task 3 Converting CSV to XML
<Organizations>
<Org OrgName="Kroger">
<Employee>
<EmployeeFirstName
Salutation="MR.">Vivek</EmployeeFirstName>
<EmployeetLastName>Arora</EmployeetLastName>
<EmployeeID>EXP268</EmployeeID>
</Employee>
<Employee>
<EmployeeFirstName
Salutation="MR.">Shankar</EmployeeFirstName>
<EmployeetLastName>Bose</EmployeetLastName>
<EmployeeID>EXP219</EmployeeID>
</Employee>
<Employee>
<EmployeeFirstName
Salutation="MS.">Isha</EmployeeFirstName>
<EmployeetLastName>Arora</EmployeetLastName>
<EmployeeID>EXP214</EmployeeID>
</Employee>
</Org>
<Org OrgName="Kroger2">
<Employee>
<EmployeeFirstName
Salutation="Mr.">Zeeshan</EmployeeFirstName>
<EmployeetLastName>Ahmad</EmployeetLastName>

Kroger,MR.,Vivek,Arora,EXP268
Kroger,MR.,Shankar,Bose,EXP2
19
Kroger,MS.,Isha,Arora,EXP214
Kroger2,Mr.,Zeeshan,Ahmad,E
XP209

XML to CSV(LOOP) >> ESQL


CREATE COMPUTE MODULE XML2CSV_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE i INTEGER 1;
FOR index AS InputRoot.XMLNS.Organizations.Org[] DO
FOR index2 AS index.Employee[] DO
SET OutputRoot.DFDL.CSV2XML_LOOP_IN.record[i].organization=index.OrgName;
SET OutputRoot.DFDL.CSV2XML_LOOP_IN.record[i].salutation=index2.EmployeeFirstName.Salutation;
SET OutputRoot.DFDL.CSV2XML_LOOP_IN.record[i].firstname=index2.EmployeeFirstName;
SET OutputRoot.DFDL.CSV2XML_LOOP_IN.record[i].lastname=index2.EmployeetLastName;
SET OutputRoot.DFDL.CSV2XML_LOOP_IN.record[i].empid=index2.EmployeeID;
SET i =i+1;
END FOR;
END FOR;

RETURN TRUE;
END;

Dynamic Que
Task 3 At run Time The Queue need to decided

Dynamic Queue
Task 3 At run Time The Queue need to decided

Dynamic Queue
Task 3 At run Time The Queue need to decided

Dynamic Queue
Task 3 At run Time The Queue need to decided

SOAP
Task 4: Currency Convertor using the Web Service : http://
www.webservicex.com/CurrencyConvertor.asmx

SOAP
Step1 : Copy the WSDL from http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
and save it
Step2: Test the Webservice using SOAP UTIL
Step3: Create the Message Flow as shown in the Previous Slide
Step4: Click the SOAP request and Select the WSDL file

SOAP
Step5 : Add the following Code in Compute Node

Note the name space you get From WSDL


<s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/">

Creating Web Service


Task : Publish the Message Flow as Service

Creating Web Service


Step1 : Create New Application Named WebService

Creating Web Service


Step2 : Create WSDL for Web Service>> Setting Message Set
Preferences

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating
Message Set

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating
Message Set

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating
Message Set

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating
Message Set

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File
>> Message

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File
>> Message
Note : Message named Currency_Convertor_Msg is for SOAP Input

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File
>> Message
Create Message named Conversion_Rate ( similar to Currency_Convertor_Msg ) for SOAP
Reply

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File >>
Message>> Generate WSDL

Creating Web Service


Step2 : Create WSDL for Web Service>> Creating Message Set>> Message Definition File >>
Message>> Generate WSDL

Creating Web Service


Step3 : Create Message Flow

Creating Web Service


Step3 : Create Message Flow

Creating Web Service


Step3 : Create Message Flow

Creating Web Service


Step3 : Create Message Flow

Creating Web Service


Step3 : Create Message Flow
Modify the Default Message Flow

Creating Web Service


Step3 : Create Message Flow> Compute Node

Test Message Flow

Test Message Flow Using SOAP UI

Note : Create WSDL again from message set and while


creating it export it to external Directory and refer the
same WSDL in SOAP UI