9Using XML Files

Using XML Files

This chapter discusses using XML files as an input as well as inserting a file attachment into the Siebel database using XML. It includes the following topics:

Using an XML Document as Input

You can use XML documents as input in a workflow, by calling business services to convert them to Siebel Property Sets and calling business services to process the data from XML documents as required. The following illustrates a sample workflow that uses the Siebel Adapter Insert or Update method.

Workflow Using Siebel Adapter with Upsert Method

The following is an example of a sample XML document containing employee information that will get upserted by the EAI Siebel Adapter as in the workflow. Just before the EAI Siebel Adapter step in the workflow is invoked, the variable Employee Message will contain the XML document in a hierarchical format.

	<SiebelMessage MessageId=""IntObjectName="Sample Employee">
		<ListOfSampleEmployees>
			<Employee>
				<FirstName>Pace</FirstName>
				<MiddleName></MiddleName>
				<LastName>Davis</LastName>
				<LoginName>ADIOTATI</LoginName>
				<PersonalTitle>Mr.</PersonalTitle>
				<EMailAddr>pdavis@pcssiebel.com</EMailAddr>
				<JobTitle>Field Sales Representative</JobTitle>
				<Phone>4153296500</Phone>
				<Private>N</Private>
					<ListOfPosition>
						<Position>
							<Name3>Field Sales Representative - S America</Name3>
							<Division>North American Organization</Division>
							<Organization>North American Organization</Organization>
							<ParentPositionName>VP Sales</ParentPositionName>
							<PositionType>Sales Representative</PositionType>
								<ListOfPosition_BusinessAddress>
									<Position_BusinessAddress>
									<City>San Mateo</City>
									<Country>USA</Country>
									<FaxNumber></FaxNumber>
									<PhoneNumber></PhoneNumber>
									<PostalCode>94175</PostalCode>
									<State>CA</State>
									<StreetAddress>1855 South Grant St</StreetAddress>
								</Position_BusinessAddress>
							</ListOfPosition_BusinessAddress>
					</Position>
				</ListOfPosition>
			</Employee>
		</ListOfSampleEmployees>
	</SiebelMessage>

This EAI XML document shows an integration object called Sample Employee as specified by the IntObjectName attribute of the Siebel Message element.

The Sample Employee object has three integration components you can view using Siebel Tools:

  • Employee—A root component

  • Position—A Child of Employee

  • Position Business Address—A Child of Position

An upsert to this integration object is determined by the user key on the root component. In the Sample Employee Integration object provided as part of the sample database, the user key for the Employee integration object is Login name. Therefore, if the login name is unique, then a new employee is inserted. If the login name already exists, then the Siebel application performs an update. This XML document will create a new employee whose name is Pace Davis and assign the position Field Sales Representative - S America to this person. You could also specify a new position and have the employee be assigned to the new position. This can be extended to other methods such as Delete or Query. If you want to delete an employee, then the user key is the only element that must be specified.

Example. In the following example, the employee with login name ADD1 will be deleted.

<SiebelMessage MessageId="" IntObjectName="Sample Employee">
   <ListOfSampleEmployees>
      <Employee>
         <LoginName>ADD1</LoginName>
      </Employee>
   </ListOfSampleEmployees>
</SiebelMessage>

Example. Query on all employees with the first name Pace and Last name starting with D.

<SiebelMessage MessageId="" IntObjectName="Sample Employee">
   <ListOfSampleEmployees>
      <Employee>
         <FirstName>Pace</FirstName>
         <LastName>D*</LastName>
      </Employee>
   </ListOfSampleEmployees>
</SiebelMessage>
Caution: The preferred setup is Demand Mode, whereby mobile client users trying to open an attachment will see a message asking if they want to download the file the next time they synchronize. This is known as the deferred approach and gives users control over what files they do or do not download.

Inserting File Attachments Using XML

You might want to insert an attachment into the Siebel Database, such as an image file in JPEG format. This could be a customer’s picture, a site picture, an item or part image, a text document, and so on. For integration with external systems using file attachments, see Integration Platform Technologies: Siebel Enterprise Application Integration.

For integration between Siebel instances, the support for attachments is built into the Siebel Adapter and the EAI XML Converter. The integration between Siebel instances can occur when generating or reading XML, which is further defined in the next topic.

  • Generating XML. In the case of the Attachment business component being used, the Siebel Adapter will correctly perform the query. Then, the EAI XML Converter will include the attachment in XML.

  • Reading XML. If XML was generated by the EAI XML Converter as described previously, then the EAI XML Converter will read such XML and correctly bring attachments into memory. After which, the Siebel Adapter will insert them into Oracle’s Siebel database.

Removing Empty XML Tags

You can to remove empty XML tags from messages for optimization. For example, an XML representation of an integration object might have unused integration components. You can use the siebel_ws_param:RemoveEmptyTags parameter to remove empty tags when making Web service calls.

There are two ways to use the parameter:

    Adding the Remove Empty Tags Parameter to a Property Set in an Input XML File

    You add the siebel_ws_param:RemoveEmptyTags parameter to an input XML file manually as a property in the top-level property set.

    To add the RemoveEmptyTags parameter to a property set manually

    1. Open the XML file in a text editor.

    2. Add the following text (in bold) to the top-level <PropertySet> tag, as in this example:

      <?xml version="1.0" encoding="UTF-8"?>
      <?Siebel-Property-Set EscapeNames="true"?>
      <PropertySet siebel_undws_undparam_clnRemoveEmptyTags="Y">
      <SiebelMessage>
      	...
      	...
      	</SiebelMessage>
      </PropertySet>
      
    3. Save the XML file.

      Adding the Remove Empty Tags Parameter as a Process Property in a Workflow

      You can add the siebel_ws_param:RemoveEmptyTags parameter to a workflow to automate the removal of empty tags. You add the parameter as a process property of the workflow, then as an input argument to the step that reads the XML file. For information on adding workflow process properties and input arguments, see Siebel Business Process Framework: Workflow Guide.

      To add the RemoveEmptyTags parameter to a workflow

      1. In Siebel Tools, create and open a workspace.

      2. Edit the workflow process to add the following process property:

        Name Data Type In/Out

        Remove Empty Tags

        String

        In

      3. Add the following input argument to the workflow step that reads the XML file:

        Input Argument Type Value Property Name

        siebel_ws_param:RemoveEmptyTags

        Process Property

        Y

        Remove Empty Tags

      4. Deliver the workspace, which will compile the changes made above to runtime repository.