2016-05-17 15 views
0

Während ich ein XML in ein anderes transformieren und Mapping-Liste innerhalb der Liste Elemente. Ich bekomme eine Ausnahme.Problem beim Mapping Liste innerhalb der Liste in Xml zu XML-Mapping mit Mule Dataweave

": string zu einem: Es kann keine coerce. Objekt (com.mulesoft.weave.mule.exception.WeaveExecutionException) Message Nutzlast ist vom Typ: WeaveMessageProcessor $ WeaveOutputHandler"

Eingang xml:

<?xml version="1.0" encoding="UTF-8"?> 
    <ZCOM_IDD2565_AGREEMENT> 
     <transaction> 
      <id>www</id> 
      <timestamp>20160512 200939</timestamp> 
      <sender>ghh566</sender> 
     </transaction> 
     <identification> 
      <R3number>88898</R3number> 
      <enterpriseId /> 
      <sourcesystemid>ffff</sourcesystemid> 
      <sourcesystemobjectid>999089</sourcesystemobjectid> 
     </identification> 
     <details> 
      <newTransaction>N</newTransaction> 
      <type>siiii</type> 
      <organizational> 
      <salesOrg>1223</salesOrg> 
      <currency>RUPEE</currency> 
      </organizational> 
      <description> 
      <internal>jhjb hjgjhg jkhjh</internal> 
      <external>jhhgjhb</external> 
      <project>owdoie</project> 
      </description> 
      <dates> 
      <validFrom>2016-04-05</validFrom> 
      <validTo>2017-04-30</validTo> 
      <fixedValue>0000-00-00</fixedValue> 
      </dates> 
      <creditTriggerEvent>S</creditTriggerEvent> 
     </details> 
     <rules> 
      <ZCOM_AGR_RULES> 
      <rule> 
       <ruleType>923</ruleType> 
       <agreementItem /> 
       <ruleNumber /> 
       <quantities> 
        <minimum /> 
        <maximum /> 
       </quantities> 
       <firstRecordA /> 
       <application /> 
       <conditionType>dddd</conditionType> 
       <salesOrg>1000</salesOrg> 
       <distributionChannel /> 
       <division /> 
       <endCustomerNumber /> 
       <serialNumber /> 
       <soldTo> 
        <ZCOM_AGR_SOLD> 
         <id>990888</id> 
         <addressNumber>2132435</addressNumber> 
         <name>dsfdg fdg</name> 
         <streetAddress>hu78hj k</streetAddress> 
         <postalCode>5654</postalCode> 
         <city>sfds</city> 
         <country>sdsa</country> 
         <phone>555-555-5555</phone> 
         <languageKey>E</languageKey> 
         <district /> 
         <houseNumber>poio aaed</houseNumber> 
         <region>iii</region> 
        </ZCOM_AGR_SOLD> 
        <ZCOM_AGR_SOLD> 
        <id>777787</id> 
        <addressNumber>121223</addressNumber> 
        <name>dsfdg fdg</name> 
        <streetAddress>hu78hj k</streetAddress> 
        <postalCode>5654</postalCode> 
        <city>sfds</city> 
        <country>sdsa</country> 
        <phone>555-555-5555</phone> 
        <languageKey>E</languageKey> 
        <district /> 
        <houseNumber>poio aaed</houseNumber> 
        <region>iii</region> 
       </ZCOM_AGR_SOLD> 
       </soldTo> 
       <shipTo> 
        <id /> 
        <addressNumber /> 
        <name /> 
        <streetAddress /> 
        <postalCode /> 
        <city /> 
        <country /> 
        <phone /> 
        <languageKey /> 
        <district /> 
        <houseNumber /> 
        <region /> 
       </shipTo> 
       <upc /> 
       <catalogNumber /> 
       <discountSchedule /> 
       <priceGroupCode /> 
       <priceFamily /> 
       <requested-discount-netPrice /> 
       <delete /> 
       <customerRate /> 
       <priceChange /> 
       <dates> 
        <validFrom>2016-04-05</validFrom> 
        <validTo>2017-04-30</validTo> 
        <fixedValue>0000-00-00</fixedValue> 
       </dates> 
       <condition> 
        <type /> 
        <calculationType /> 
        <approved-discount-netPrice>0.00000</approved-discount-netPrice> 
        <unitOfMeasue /> 
        <conditionitemindex /> 
        <additionalvaluedays /> 
        <fixedvaluedate /> 
        <maxiumSalesOrdersPerConditionRecord /> 
        <numberOfIncrementalScale /> 
        <scaleNumberForPricing /> 
       </condition> 
      </rule> 
      </ZCOM_AGR_RULES>  
      <ZCOM_AGR_RULES> 
      <rule> 
       <ruleType>920</ruleType> 
       <agreementItem /> 
       <ruleNumber /> 
       <quantities> 
        <minimum /> 
        <maximum /> 
       </quantities> 
       <firstRecordA /> 
       <application /> 
       <conditionType>rrrr</conditionType> 
       <salesOrg>1000</salesOrg> 
       <distributionChannel /> 
       <division /> 
       <endCustomerNumber /> 
       <serialNumber /> 
       <soldTo /> 
       <shipTo> 
        <id /> 
        <addressNumber /> 
        <name /> 
        <streetAddress /> 
        <postalCode /> 
        <city /> 
        <country /> 
        <phone /> 
        <languageKey /> 
        <district /> 
       <houseNumber /> 
        <region /> 
       </shipTo> 
       <upc /> 
       <catalogNumber /> 
       <discountSchedule>B5</discountSchedule> 
       <priceGroupCode /> 
       <priceFamily /> 
       <requested-discount-netPrice>0.00</requested-discount-netPrice> 
       <delete /> 
       <customerRate>0.44</customerRate> 
       <priceChange>X</priceChange> 
       <dates> 
        <validFrom>2016-04-05</validFrom> 
        <validTo>2017-04-30</validTo> 
        <fixedValue>0000-00-00</fixedValue> 
       </dates> 
       <condition> 
        <type>rrrr</type> 
        <calculationType>A</calculationType> 
        <approved-discount-netPrice>0.35000</approved-discount-netPrice> 
        <unitOfMeasue>%</unitOfMeasue> 
        <conditionitemindex /> 
        <additionalvaluedays /> 
        <fixedvaluedate /> 
        <maxiumSalesOrdersPerConditionRecord /> 
        <numberOfIncrementalScale /> 
        <scaleNumberForPricing /> 
       </condition> 
      </rule> 
      </ZCOM_AGR_RULES>  
     </rules> 
    </ZCOM_IDD2565_AGREEMENT> 

Daten weben Skriptcode

%dw 1.0 
%output application/xml 
%type dtfield = :string { format: "yyyyMMdd" } 
%namespace ns0 http://schemas.xmlsoap.org/soap/envelope/ 
%namespace ns1 FlexiWebService 
--- 
{ 
    ns0#Envelope: { 
     ns0#Header: { 
      ns1#AuthHeader: { 
       Username: "dssdfdf", 
       Password: "dfff" 
      }  
     }, 
     ns0#Body: { 
      Z_IDDO735_IRM_AGRMNTS01: { 
       IDOC: { 
        '_-IRM_-AGMTK01': { 
         (TRANS: payload.ZCOM_IDD2565_AGREEMENT.details.newTransaction as :string) when payload.ZCOM_IDD2565_AGREEMENT.details.newTransaction?, 
         (BOART_AG: payload.ZCOM_IDD2565_AGREEMENT.details.type) when payload.ZCOM_IDD2565_AGREEMENT.details.type? , 
         (AMTNUM: payload.ZCOM_IDD2565_AGREEMENT.identification.sourcesystemobjectid) when payload.ZCOM_IDD2565_AGREEMENT.identification.sourcesystemobjectid?, 
         (AGMTNUM_EXT: payload.ZCOM_IDD2565_AGREEMENT.details.description.external as :string) when payload.ZCOM_IDD2565_AGREEMENT.details.description.external?, 
         (AGMTTXT: payload.ZCOM_IDD2565_AGREEMENT.details.description.internal) when payload.ZCOM_IDD2565_AGREEMENT.details.description.internal?, 
         (VALID_FROM: payload.ZCOM_IDD2565_AGREEMENT.details.dates.validFrom as :dtfield replace "-" with "") when payload.ZCOM_IDD2565_AGREEMENT.details.dates.validFrom?, 
         (VALID_TO: payload.ZCOM_IDD2565_AGREEMENT.details.dates.validTo as :dtfield replace "-" with "") when payload.ZCOM_IDD2565_AGREEMENT.details.dates.validTo?,     
         '_-IRM_-AGMTK02': { 
          ZIDDO735_AGMTK02: { 
           (FV_DATE: payload.ZCOM_IDD2565_AGREEMENT.details.dates.fixedValue as :dtfield replace "-" with "") when payload.ZCOM_IDD2565_AGREEMENT.details.dates.fixedValue?, 
           (TDOBNAME: payload.ZCOM_IDD2565_AGREEMENT.details.creditTriggerEvent) when payload.ZCOM_IDD2565_AGREEMENT.details.creditTriggerEvent?  
          } 
         } 
        }, 
        E1EDK14: { 
         (ORGID: payload.ZCOM_IDD2565_AGREEMENT.details.organizational.salesOrg) when payload.ZCOM_IDD2565_AGREEMENT.details.organizational.salesOrg?, 
         ZIDDO735_E1EDK14: { 
          (CURR: payload.ZCOM_IDD2565_AGREEMENT.details.organizational.currency) when payload.ZCOM_IDD2565_AGREEMENT.details.organizational.currency? 
         } 
        }, 
        ((payload.ZCOM_IDD2565_AGREEMENT.rules.*ZCOM_AGR_RULES default []) map { 

         E1KOMG:{ 

         KVEWE: $.rule.firstRecordA, 
         KOTABNR: $.rule.condition.type, 
         KAPPL: $.rule.application, 
         VKORG: $.rule.salesOrg, 
         VTWEG: $.rule.distributionChannel, 
         EAN11: $.rule.upc, 
         KONDM: $.rule.discountSchedule, 
         EVRTP: $.rule.agreementItem, 
         HIENR: $.rule.endCustomerNumber, 
         POSNR: $.rule.ruleNumber, 
         ANZSN: $.rule.requested-discount-netPrice, 
         VKGRP: $.rule.priceGroupCode, 
         ZIDDO735_E1KOMG_QUANTITY: { 
          TDID_MIN_QTY: $.rule.quantities.minimum, 
          TDID_MAX_QTY: $.rule.quantities.maximum 
         }, 
         ZIDDO735_E1KOMG: { 
          ZIDD0735_SHIP_TO_KUNWE: { 
           LAND1: $.rule.shipTo.country, 
           NAME1: $.rule.shipTo.name, 
           ORT01: $.rule.shipTo.city, 
           REGIO: $.rule.shipTo.region, 
           TELF1: $.rule.shipTo.phone as :string replace "-" with "", 
           ADRNR: $.rule.shipTo.addressNumber, 
           SPRAS: $.rule.shipTo.languageKey, 
           STRAS: $.rule.shipTo.streetAddress 
          }, 

          (ZIDD0735_KNA1_DETAILS: $.rule.soldTo.*ZCOM_AGR_SOLD default [] map { 

            KUNNR: $.id, 
            LAND1: $.country, 
            NAME1: $.name, 
            ORT01: $.city, 
            PSTLZ: $.postalCode, 
            REGIO: $.region, 
            TELF1: $.phone as :string replace "-" with "", 
            ADRNR: $.addressNumber, 
            SPRAS: $.languageKey, 
            STRAS: $.streetAddress 
           }) when ($.rule.soldTo !="" and $.rule.soldTo.*ZCOM_AGR_SOLD as :object !="") 
          }, 
         E1KONH: {      
          DATAB: $.rule.dates.validFrom as :dtfield replace "-" with "", 
          DATBI: $.rule.dates.validTo as :dtfield replace "-" with "", 
          E1KONP: { 
           KSCHL: $.rule.conditionType, 
           KRECH: $.rule.condition.calculationType, 
           KBETR: $.rule.condition.approved-discount-netPrice, 
           KONWA: $.rule.condition.unitOfMeasue, 
           ZAEHK_IND: $.rule.condition.conditionitemindex, 
           VALTG: $.rule.condition.additionalvaluedays, 
           VALDT: $.rule.condition.fixedvaluedate, 
           KLF_STG: $.rule.condition.numberOfIncrementalScale, 
           KLF_KAL: $.rule.condition.scaleNumberForPricing 
          } 
         } 
        }})  
       } 
      } 
     } 
    } 
} 

Eigentlich, was geschieht, Felder unter ZIDD0735_KNA1_DETAILS-Knoten des ausgegebenen xML-Feldern unter ZCOM_AGR_SOLD abgebildet wird und ZCOM_AGR_SOLD ist Liste der Daten oder Sie können array sagen.In der Ausgabe, wo ich Werte für ZCOM_AGR_SOLD habe, bekomme ich Daten unter ZIDD0735_KNA1_DETAILS, aber anstelle der wiederholten Werte von ZIDD0735_KNA1_DETAILS bekomme ich ZCOM_AGR_SOLD unter ZIDD0735_KNA1_DETAILS mit allen Eingabe-XML-Knotennamen nicht ausgegeben Knotennamen. Dies geschieht nur mit diesem Feld. Ruhe alles funktioniert gut.

+0

können Sie Ihr dataweave-Skript und die Beispieleingabe XML bereitstellen? –

Antwort