Transforming BOD documents

After completing the configuration in the connection point, you can test it:

  1. Click Test.
  2. In the pop-up, type or paste an example BOD.
  3. Click OK. The specified transformation is done and the web service operation is invoked. The web service output is merged into the BOD and on the result the specified transformation is done.
    In case of exceptions, you are informed. If the action was successful, the resulting BODs are displayed in a pop-up. If the web service operation is expected to execute any changes on the database, you can verify whether the data is as expected.
    Now the web service connection point can be used in a document flow. Select the connection point in the web service activity and select the procedure to be used. Select the document that is used to trigger the web service call. The resulting document is automatically set in the document flow.

    In this scenario, you can only use one document as input for the web service activity, and the same document as output.

    Complete the flow. For example by adding an activity that publishes the required document, an activity that receives the resulting document and mapping activities if required. After completion, you can activate the flow.

    When the document flow is active, this happens:

    The incoming BOD document is transformed to the input as required for the web service operation. Then the web service is invoked using this input. If the process is successful, the output is merged into the BOD document. If required the resulting merged BOD document is transformed to the final BOD document.

    If ION cannot connect to the server it automatically retries. A Confirm BOD is generated for the incoming document, when:

    • The server is available, and web service is unavailable.
    • The web service returns a fault.
    • Another exception occurs.

    This becomes visible in Connect > Error BODs page.

    Example 1: adding salary information to an existing employee document

    The incoming document SyncMyEmployee contains the employee ID, name and address. A web service is available to retrieve the salary based on the employee ID. The salary value is added to the same SyncMyEmployee document.

    Note: the XSLT has the BOD DataArea XML as input and the complete SOAP envelope XML as output.

    To achieve this, use this XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        <!-- change indent to "no" after testing -->
        <xsl:template match="DataArea">
            <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
               <S:Header/>
               <S:Body>
                  <GetEmployeeSalary>
                          <EmployeeID><xsl:value-of select="MyEmployee/ID"/></EmployeeID>
                  </GetEmployeeSalary>
               </S:Body>
            </S:Envelope>
        </xsl:template>
    </xsl:stylesheet>
    

    The content from the response is merged into the employee BOD. If the MyEmployee element is selected as the parent element for the merge, the response is added as the last element in MyEmployee:

    Note: the SOAP envelope and header are not included when merging. In this example an RPC-style web service is used, the children of GetEmployeeSalary are included when merging. In case of a document-style web service, the children of the Body element are merged into the BOD.

    As the last step, a transformation is used to align the BOD to its definition. In this example it means that the irrelevant EmployeeID element is removed:

    <SyncMyEmployee>
       <ApplicationArea>
            …
       </ApplicationArea>
       <DataArea>
          <Sync>
             …
          </Sync>
          <MyEmployee>
             <ID>100</ID>
             <Name>John Smith</Name>
             <Address>...</Address>
             <Salary>30,000</Salary>
          </MyEmployee>
       </DataArea>
    </SyncMyEmployee>
    

    In the XSLT, both the input and the output is the DataArea.

    To achieve this, use this XSLT:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:se="http://schemas.xmlsoap.org/soap/envelope/">
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        <!-- change indent to "no" after testing -->
        <xsl:template match="@*|node()"> <!-- identity template -->
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="DataArea/MyEmployee/EmployeeID"/>
    </xsl:stylesheet>
    
    Example 2: automatic transformation

    When using automatic transformation, the example will be the same, except that the complete data from the noun instance is used as input for the web service. In case of an RPC-style web service:

    In case of a document-style web service: