Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Sunday, 16 November 2014

Custom Properties in Informatica Session Config Properties for XML targets and parsing

Custom Properties in Informatica Session Config Properties for XML targets and parsing

a)  XMLAnyTypeToString

 Noticed  that when I was passing the below XML string to a web service consumer  transformation in Informatica the characters such as  < , “, & were getting replaced by some other characters like &amp and the xml string was not sent in a proper format to the web service transformation. Later fixed this  by setting the XMLAnyTypeToString=Yes in the session properties as shown in the screenshot. XMLAnyTypeToString=Yes setting makes the characters be passed as it is.
 
'<Batch OnError="Continue">
 <Method ID="1" Cmd="Update">
<Field Name="ID">1</Field>
<Field Name="Name">John</Field>
</Method>
 </Batch>'




 
Other XML customizations related settings that are available  are listed below and can be set as show in screenshot above:

b) WriteNullXMLFile

If you do not want an XML output file to be generated when there is no input date then use the session property WriteNullXMLFile=No. If you do not set this property then a default xml with some meta data is created when there is no input data.

c)  SuppressNilContentMethod

If the child tags have no values and you might see parent tags with no child tags depending on the properties you have set for the XML target. If you want to suppress the parent tags then use the session property SuppressNilContentMethod=ByTree
 

d) XMLWarnDupRows

Similarly if you are seeing huge session logs being generated from duplicate row warning then setting session XMLWarnDupRows=No will remove those warnings from the session log.

Found more properties here : http://www.cifconsult.com/?p=743

More XML customizations in Informatica can be done in the session- mapping-target/xml parser transformation configuration: The setting shown in yellow highlights will decide the outcome of your xml.



Wednesday, 24 September 2014

How to create XML parser in Informatica using XMLSpy and .dtd?


How to create XML parser in Informatica?


Let’s say you are reading an XML and want to create an XML parser transformation to parse the XML. If the XML is not very complex, then a very simple way to generate the XML parser transformation might be to use XML spy to generate the .dtd file using the XML. Steps below:

How to generate .dtd in XML spy:

1)      Go to File Menu- Open the XML file

2)      Go to DTD/Schema and click on Generate DTD/Schema. It will ask do you want to associate the dtd with the xml file? Click yes and save the dtd file.

3)      Go to XML menu- Click validate. If any issues with the DTD , it will show up when you validate the XML. For the sample xml, I was working with I had to remove one of the child item in the .dtd to make it the validation successful. You can figure it out from the message the validation process throws at you.

Once you have generated the .dtd you can go to Informatica designer-transformation menu and create xml parser transformation using the .dtd schema you just generated. If you need to make any changes to the XML view, you can use the XML Editor that you can access from the midstream XML parser tab of the XML parser.

Saturday, 19 July 2014

Consuming WebService In Informatica

To read data from share point or in general from any web service, use the following steps:
1)    Create a web service consumer transformation using the mapping designer.
To create the web service consumer transformation you need the wsdl (web service definition language) file of the web service you are trying to connect. In this case, it is the wsdl from the web service you are reading from sharepoint. Please ask the web service developer to provide you the wsdl file.  In the example below you are reading the GetListItems webservice.
Using the wsdl, create the web service consumer transformation. Configure the end point URL in web service consumer properties tab. Also, enter the End point URL.



2) Add the web service transformation to the mapping. The response of the web service transformation can then be parse by an xml parser. To create the xml parser use the xml from the getlistitems web service. Ask the web service developer the XML or use the web service consumer created above to write the XML to a flat file. Now take the XML from that flat and use XML editor such as xml spy can help to create .dtd files required to create the xml parser. Parse the XML using Informatica mapping to get the desired output.

 

3) Finally, in the workflow the connection to the GetListItems should be configured properly. The GetListitems connection will be application connection of type web service consumer. The End point URL should be configured for this connection.

 Check out how to create xml parser in Informatica using XML Spy:
http://dwbitechguru.blogspot.ca/2014/09/how-to-create-xml-parser-in-informatica.html