Using PerformOperations

This topic includes general information for using the PerformOperations method to access any SOA web service.

General Usage Information

  • The XML passed to the PerformOperations method must be well-formed XML.

  • Declare the required namespaces in the root (PerformOperations) node: 

    For example, to use the Campaign Manager PerformOperations method the namespace declarations would be similar to: 

    <PerformOperations
       xmlns="http://EmersonProcess.WebServices/PerformOperations"
       xmlns:dc="http://EmersonProcess.WebServices/CampaignManager/DataContracts"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
    Note

    Always set the namespace 

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance".

Customizing PerformOperations

You can add XML nodes that are not defined by the web service schema. To use this feature, you must supply a stylesheet (XSL file) to transform the custom XML node/data to web service-compliant XML. You can optionally provide a schema to validate the custom XML node:

  • You can add custom schemas and stylesheets by setting the customSchema, customXslt attributes and/or CustomSchema, CustomXslt node. Add these attributes and nodes under the PerformOperations node or Operation node.

  • When using a custom schema and/or stylesheet, set the useCustom attribute of the Operation node to be transformed to True.

  • CustomSchema and CustomXslt elements must contain the schema or stylesheet inside a CDATA node. Set the customSchema and customXslt attributes to the path of the schema or stylesheet. Combinations of attribute and node are allowed. For example: 

    • CustomSchema and CustomXslt nodes 

      <CustomSchema>
         <![CDATA[
            ...insert schema here...
         ]]>
      </CustomSchema>
      <CustomXslt>
         <![CDATA[
            ...insert stylesheet here...
         ]]>
      </CustomXslt>
      
    • CustomSchema and CustomXslt attributes

      <Operation
         xsi:type="GetListOfAssignedBatchExecutives"
         customSchema="\\soa12\xsd\CustomRecipeinfo.xsd"
         customXslt="D:\xsl\CustomRecipeinfo.xslt"
         useCustomXslt="true" >
      
    • Combination 

      <Operation
         xsi:type="GetListOfAssignedBatchExecutives"
         customXslt="\\soa12\xsl\CustomRecipeinfo.xslt"
         useCustomXslt="true" >
      <CustomSchema>
         <![CDATA[
            ...insert schema here...
         ]]>
      </CustomSchema>
      
  • When inserting XML inside a CDATA tag, omit the XML declaration: <?xml version="1.0" encoding="utf-8"?> This applies to custom schemas and stylesheets and Recipe Exchange import.

  • If you set the schema or stylesheet under the PerformOperations node, they can be applied to any Operation node (global). If you set the schema or stylesheet under the Operation node, they apply only to that Operation node (local) and override any global schema or stylesheet.

  • The custom schema validates only the child nodes of the Operation node. Additional attributes to the Operation node are not allowed. See the examples.

  • The custom stylesheet transforms the entire Operation node. Make sure that the resulting XML's root node is Operation and that it retains the xsi namespace alias and declaration as well as the xsi:type attribute. Also, make sure the resulting XML passes the web service schema validation. See the examples.

Examples

CustomRecipeInfo.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Note: Sample XML for custom transformation. This XML file will not run
             if used directly in the Recipe Exchange Web service. -->
<Operation xsi:type="GetBatchExecutive" useCustom="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
   <rs:recipeInfo recipeType="Procedure" recipeName="PRC_PAINT" xmlns:rs="http://tempuri.org/RecipeSchema.xsd"/>
</Operation>

CustomRecipeInfo.xsd

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="recipeInfo" targetNamespace="http://tempuri.org/RecipeSchema.xsd" 
                           elementFormDefault="qualified" xmlns="http://tempuri.org/RecipeSchema.xsd" 
                           xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:complexType name="recipeInfoType">
      <xs:sequence>
      </xs:sequence>
      <xs:attribute name="recipeType" type="xs:string" />
      <xs:attribute name="recipeName" type="xs:string" />
   </xs:complexType>
   <xs:element name="recipeInfo" type="recipeInfoType">
   </xs:element>
</xs:schema>

CustomRecipeInfo.xslt

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://EmersonProcess.WebServices/PerformOperations"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
   <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
   <xsl:template match="Operation">
      <xsl:element name="{local-name()}">
         <xsl:apply-templates select="@type | @xsi:type" mode="xsi" />
         <xsl:apply-templates select="@useCustom" mode="attribute" />
         <!-- add other Operation attributes that will be retained or added here-->
         <!-- do custom transformations here -->
         <xsl:apply-templates select="*"/>
      </xsl:element>
   </xsl:template>
   <!-- ignore CustomSchema and CustomXslt elements -->
   <xsl:template match="CustomSchema | CustomXslt"/>
   <xsl:template match="@*" mode="attribute">
      <xsl:attribute name="{name()}" >
         <xsl:value-of select="."/>
      </xsl:attribute>
   </xsl:template>
   <xsl:template match="@*" mode="xsi">
      <xsl:attribute name="xsi:{local-name()}">
         <xsl:value-of select="."/>
      </xsl:attribute>
   </xsl:template>
   <xsl:template match="@*">
      <xsl:element name="{local-name()}">
         <xsl:value-of select="."/>
      </xsl:element>
      <xsl:apply-templates/>
   </xsl:template>
   <xsl:namespace-alias result-prefix="xsi" stylesheet-prefix="xsi"/>
   <xsl:template match="*">
      <xsl:element name="{local-name()}">
         <xsl:apply-templates select="@*|node()"/>
      </xsl:element>
   </xsl:template>
</xsl:stylesheet>