3 Replies Latest reply on Jan 30, 2014 2:49 PM by S.Ananth

    "JCA Binding execute of Reference operation 'Write' failed due to: Translation Error.

    Mohammad Saif

      Hi, i am trying to read a comma delimited file using an inbound file adapter, i have used a mediator to route records to the outbound file adapter.My input.txt file contains 10 records as Fname,Lname.I have used native format builder to generate xsd. To achieve transformation,in the mediator i have mapped only the Fname from source to traget using a for-each loop.I am trying to publish records in the batches of 2 so i have configured inbound file adapter accordingly.My inbound file adapter reads the first two records and the same is visible at the em console mediator instance(payload), i am even able to see the first two records being transformed in the transformed payload in the mediator instance detail but at the outbound file adapter i get an error saying :

       

      Error during invoking 1-way operation "Write" on target service "writeFile"

      Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Write' failed due to: Translation Error. Translation Error. Error while translating message to native format. Please make sure that the payload for the outbound interaction conforms to the schema. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.


      When i map both the Fname and Lname in the xsl map file i get the output.But i only need one field at the outfile i:e either the Fname or the Lname.

       

      Given below are the details of the interface:

       

      My Interface Flow:       InboundFileAdapter--------ReadsFile------->Medaitor------Transformation----->OutboundFileAdapter-----writesFile


      Input Payload(comma delimited text file) as,

      Brad,Pitt

      Keanu,Reaves

      Martin,Lawrance

      Johnny,Depp

      .

      .

      etc

      etc

       

      Schema definition for payload:

      <?xml version="1.0" encoding="UTF-8" ?>

      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

                  xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"

                  xmlns:tns="http://TargetNamespace.com/readFile"

                  targetNamespace="http://TargetNamespace.com/readFile"

                  elementFormDefault="qualified"

                  attributeFormDefault="unqualified"

                

                  nxsd:version="NXSD"

                  nxsd:stream="chars"

                  nxsd:encoding="US-ASCII">

       

        <xsd:element name="Root-Element">

          <xsd:complexType>

            <xsd:sequence>

              <xsd:element name="Employee" minOccurs="1" maxOccurs="unbounded">

                <xsd:complexType>

                  <xsd:sequence>

                    <xsd:element name="Fname" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />

                    <xsd:element name="Lname" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />

                  </xsd:sequence>

                </xsd:complexType>

              </xsd:element>

            </xsd:sequence>

          </xsd:complexType>

        </xsd:element>

      </xsd:schema>

       

      XSL Map:

       

      <xsl:template match="/">

          <imp1:Root-Element>

            <xsl:for-each select="/imp1:Root-Element/imp1:Employee">

              <imp1:Employee>

                <imp1:Lname>

                  <xsl:value-of select="imp1:Lname"/>

                </imp1:Lname>

              </imp1:Employee>

            </xsl:for-each>

          </imp1:Root-Element>

        </xsl:template>

      </xsl:stylesheet>

       

      Please help me with the above mentioned error and if above transformation is possible using a mediator instead of BPEL

       

      Regards,

      Saif

        • 1. Re: "JCA Binding execute of Reference operation 'Write' failed due to: Translation Error.
          S.Ananth

          Hi Saif,  Are you using the same xsd for the outbound (write) file adapter as well? In that case, you may need to map both the names (Fname and Lname) but leave the name which you do not want to be written to the file as an empty text. For example, if you would need to map only the Lname, but not the Fname, the xsl will be like,

          <xsl:template match="/">

              <imp1:Root-Element>

                <xsl:for-each select="/imp1:Root-Element/imp1:Employee">

                  <imp1:Employee>

                    <imp1:Fname>

                    <xsl:text disable-output-escaping="no"></xsl:text>

                    </imp1:Fname>

                    <imp1:Lname>

                      <xsl:value-of select="imp1:Lname"/>

                    </imp1:Lname>

                  </imp1:Employee>

                </xsl:for-each>

              </imp1:Root-Element>

            </xsl:template>

          </xsl:stylesheet>

          Another option is to have a separate xsd with only one element (Fname or Lname) for the outbound file adapter, in which case you would need to map only one field.

          • 2. Re: "JCA Binding execute of Reference operation 'Write' failed due to: Translation Error.
            Mohammad Saif

            Hi S.Ananth, Thanks for your reply.

            I have got the desired result following your suggestion but i couldn't understand the logic behind why we need to map all the segments in the xsl file when we use same xsd at the inbound and outbound file adapter.Also when i add <xsl:text disable-output-escaping=''no"></xsl:text> to my xsl file as u did in the above xsl, i find Fname from source side not mapped to Fname in the destination side in the design view.

            So if you could please explain the logic behind doing these steps and why can't we just map only the fields that are required at the output(if we rae using same xsd).

             

            Regards,

            Saif

            • 3. Re: "JCA Binding execute of Reference operation 'Write' failed due to: Translation Error.
              S.Ananth

              Hi Saif,  It's because the in/out file is a native file format (here, comma delimited text file) and we would need to map each field (though the value can be empty/null) to conform to the native format. This is so to generate the file as per the format (with delimited fields) defined. This won't be the case if the output can be a xml file. And, the <xsl:text> in the xsl above is just an empty text mapping (blank value), so there is basically no mapping from source.