xmloracle-databasexsltsoajdeveloper

Oracle SOA - Transformation Error Reading an Empty String from source XML


I'm working on a SOA BPEL composite where I get data from an XML file and load it to a database. In my BPEL process transformation XSLT is failing and I'm getting this error message below.

Failed to transform source XML. oracle.xml.xpath.XpathException: Expression error: Empty string

What is the empty string being referred to?

XSD file: (source XML)

<?xml version='1.0' encoding='windows-1252'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.mycompany.com"
            targetNamespace="http://www.mycompany.com" elementFormDefault="qualified">
  <xsd:element name="MyCompanyEnvelope">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Header">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="DocumentVersion" type="xsd:integer"/>
              <xsd:element name="MerchantIdentifier"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="MessageType"/>
        <xsd:element name="Message">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="MessageID" type="xsd:integer"/>
              <xsd:element name="PaymentReport">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="ORDER_NUM" type="xsd:string"/>
                    <xsd:element name="SOURCE"/>
                    <xsd:element name="CustomerData">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="EMAIL_ADDRESS" type="xsd:string"/>
                          <xsd:element name="PHONE" type="xsd:integer"/>
                          <xsd:element name="LAST_NAME" type="xsd:string"/>
                          <xsd:element name="FIRST_NAME" type="xsd:string"/>
                          <xsd:element name="BILL_ADR_L1" type="xsd:string"/>
                          <xsd:element name="BILL_ADR_L2"/>
                          <xsd:element name="BILL_ADR_CITY" type="xsd:string"/>
                          <xsd:element name="BILL_ADR_STATE" type="xsd:string"/>
                          <xsd:element name="BILL_ADR_COUNTRY" type="xsd:string"/>
                          <xsd:element name="BILL_ADR_ZIP" type="xsd:integer"/>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="PaymentData">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="Payment" maxOccurs="unbounded">
                            <xsd:complexType>
                              <xsd:sequence>
                                <xsd:element name="MODEL" type="xsd:integer"/>
                                <xsd:element name="STYLE_NO" type="xsd:string"/>
                                <xsd:element name="PAYMENT_DESCRIPTION" type="xsd:string"/>
                                <xsd:element name="STATUS_CODE" type="xsd:string"/>
                                <xsd:element name="CREATED_BY" type="xsd:string"/>
                                <xsd:element name="CREATION_DATE" type="xsd:string"/>
                                <xsd:element name="LAST_UPDATE_DATE" type="xsd:string"/>
                              </xsd:sequence>
                            </xsd:complexType>
                          </xsd:element>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

XSLT - Transformation file:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction" xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions" xmlns:ns0="http://www.mycompany.com" xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator" xmlns:oracle-xsl-mapper="http://www.oracle.com/xsl/mapper/schemas" xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue" xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/top/dbMyCompanyPaymentRequest" xmlns:oraxsl="http://www.oracle.com/XSL/Transform/java" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes=" xsd oracle-xsl-mapper xsi xsl ns0 tns mhdr oraext xp20 xref socket dvm oraxsl"
                xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:pc="http://xmlns.oracle.com/pcbpel/"
                xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/file/default/MyCompanyPaymentRequest/ReadPaymentRequestFile"
                xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
                xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/default/MyCompanyPaymentRequest/dbMyCompanyPaymentRequest">
   <oracle-xsl-mapper:schema>
      <!--SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY.-->
      <oracle-xsl-mapper:mapSources>
         <oracle-xsl-mapper:source type="WSDL">
            <oracle-xsl-mapper:schema location="../ReadPaymentRequestFile.wsdl"/>
            <oracle-xsl-mapper:rootElement name="MyCompanyEnvelope" namespace="http://www.mycompany.com"/>
         </oracle-xsl-mapper:source>
      </oracle-xsl-mapper:mapSources>
      <oracle-xsl-mapper:mapTargets>
         <oracle-xsl-mapper:target type="WSDL">
            <oracle-xsl-mapper:schema location="../dbMyCompanyPaymentRequest.wsdl"/>
            <oracle-xsl-mapper:rootElement name="XxtgRepReqCustHdrStgCollection" namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/dbMyCompanyPaymentRequest"/>
         </oracle-xsl-mapper:target>
      </oracle-xsl-mapper:mapTargets>
      <!--GENERATED BY ORACLE XSL MAPPER 12.2.1.0.0(XSLT Build 151013.0700.0085) AT [TUE NOV 16 17:31:43 SGT 2021].-->
   </oracle-xsl-mapper:schema>
   <!--User Editing allowed BELOW this line - DO NOT DELETE THIS LINE-->
   <xsl:template match="/">
      <tns:XxtgRepReqCustHdrStgCollection>
         <xsl:for-each select="">
            <tns:XxtgRepReqCustHdrStg>
               <tns:paymentId/>
               <tns:paymentNum>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:ORDER_NUM"/>
               </tns:paymentNum>
               <tns:customerType/>
               <tns:custFirstName>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:FIRST_NAME"/>
               </tns:custFirstName>
               <tns:custLastName>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:LAST_NAME"/>
               </tns:custLastName>
               <tns:custFullName xsi:nil="">
                  <xsl:value-of select="concat (/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:LAST_NAME, /ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:FIRST_NAME )"/>
               </tns:custFullName>
               <tns:primaryEmail>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:EMAIL_ADDRESS"/>
               </tns:primaryEmail>
               <tns:billAddress1>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_L1"/>
               </tns:billAddress1>
               <tns:billAddress2>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_L2"/>
               </tns:billAddress2>
               <tns:billCity>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_CITY"/>
               </tns:billCity>
               <tns:billState>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_STATE"/>
               </tns:billState>
               <tns:billZip>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_ZIP"/>
               </tns:billZip>
               <tns:billCountry>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:BILL_ADR_COUNTRY"/>
               </tns:billCountry>
               <tns:rrPhone>
                  <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:CustomerData/ns0:PHONE"/>
               </tns:rrPhone>
               <tns:xxtgRepReqCustLinesStgCollection>
                  <xsl:for-each select="">
                     <tns:XxtgRepReqCustLinesStg>
                        <tns:srStatus>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:STATUS_CODE"/>
                        </tns:srStatus>
                        <tns:modelInfo>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:MODEL"/>
                        </tns:modelInfo>
                        <tns:itemNum>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:STYLE_NO"/>
                        </tns:itemNum>
                        <tns:ownerComments>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:PAYMENT_DESCRIPTION"/>
                        </tns:ownerComments>
                        <tns:creationDate>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:CREATION_DATE"/>
                        </tns:creationDate>
                        <tns:createdBy>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:CREATED_BY"/>
                        </tns:createdBy>
                        <tns:lastUpdateDate>
                           <xsl:value-of select="/ns0:MyCompanyEnvelope/ns0:Message/ns0:PaymentReport/ns0:PaymentData/ns0:Payment/ns0:LAST_UPDATE_DATE"/>
                        </tns:lastUpdateDate>
                     </tns:XxtgRepReqCustLinesStg>
                  </xsl:for-each>
               </tns:xxtgRepReqCustLinesStgCollection>
            </tns:XxtgRepReqCustHdrStg>
         </xsl:for-each>
      </tns:XxtgRepReqCustHdrStgCollection>
   </xsl:template>
</xsl:stylesheet>

Solution

  • What is the empty string being referred to?

    I believe it is this:

     <xsl:for-each select="">
    

    Although your error messsage does not point to a line number, this will without a doubt generate an error.