1
votes

I migrated a data mapper (which tranforms a xml to POJO) to a dataweave. But when executing the flow, I am seeing the below exception

Type mismatch for 'Value Selector' operator found :string, :name required :datetime, :name or required :localdatetime, :name or required :object, :name or required :time, :name or required :array, :name or required :date, :name or required :localtime, :name or required :period, :name.

Input (Payload) is a XML like below :

<?xml version="1.0" encoding="UTF-8"?>
<RESPONSE_GROUP MISMOVersionID="2.4">
    <RESPONDING_PARTY/>
    <RESPOND_TO_PARTY/>
    <RESPONSE ResponseDateTime="2016-04-21T09:03:44-05:00">
        <KEY _Name="LSF.FloodRequestID" _Value="1604008485"/>
        <KEY _Name="LSF.MAPUPDATE" _Value="N"/>
        <KEY _Name="LSF.TrackingVendor" _Value="171"/>
        <KEY _Name="CLIENT.TRACKINGID" _Value="18786574"/>
        <KEY _Name="CLIENT.ID" _Value="CREDITCENTER"/>
        <RESPONSE_DATA>
            <FLOOD_RESPONSE FEMAAdditionalLenderDescription="98756987876" MISMOVersionID="2.4">
                <BORROWER _FirstName="###############" _LastName="###############"/>
                <MORTGAGE_TERMS LenderCaseIdentifier="068461451"/>
                <PROPERTY _City="MASON CITY" _County="CERRO GORDO" _PostalCode="50401" _State="IA" _StreetAddress="929 N ADAMS AVE">
                    <_IDENTIFICATION CountyFIPSCode="033" StateFIPSCode="19"/>
                </PROPERTY>
                <EMBEDDED_FILE MIMEType="application/pdf" _Description="Adobe Pdf" _EncodingType="Base64" _Extension="pdf" _Name="Certificate_1604008485" _Version="1.3">
                    <DOCUMENT>bae64encodedData</DOCUMENT>
                </EMBEDDED_FILE>
                <FLOOD_DETERMINATION FloodCertificationIdentifier="1604008485" FloodPartialIndicator="N" FloodProductCertifyDate="2016-04-05 08:21:24 AM" SpecialFloodHazardAreaIndicator="N" _LifeOfLoanIndicator="Y">
                    <_LOAN_INFORMATION RegulatoryAgencyLenderIdentifier="123456789"/>
                    <_COMMUNITY_INFORMATION NFIPCommunityFIRMDate="1980-12-02" NFIPCommunityIdentifier="190060" NFIPCommunityName="MASON CITY, CITY OF" NFIPCommunityParticipationStartDate="1975-03-21" NFIPCounty="CERRO GORDO" NFIPStateCode="IA"/>
                    <_BUILDING_INFORMATION NFIPFloodZoneIdentifier="X" NFIPMapIdentifier="19033C" NFIPMapIndicator="Y" NFIPMapPanelDate="2012-05-16" NFIPMapPanelIdentifier="0162" NFIPMapPanelSuffixIdentifier="C"/>
                    <_INSURANCE_INFORMATION NFIPCommunityParticipationStatusType="Regular" ProtectedAreaIndicator="N"/>
                    <FULFILLMENT_PARTY _City="Austin" _Name="CoreLogic Flood Services" _PostalCode="78758" _State="TX" _StreetAddress="11902 Burnet Road">
                        <CONTACT_DETAIL>
                            <CONTACT_POINT _RoleType="Work" _Type="Phone" _Value="1-800-447-1772"/>
                        </CONTACT_DETAIL>
                    </FULFILLMENT_PARTY>
                </FLOOD_DETERMINATION>
                <LENDER _City="Jacksonville" _Identifier="98756987876" _PostalCode="32256" _State="FL" _StreetAddress="9000 Southside Blvd, Bldg 100" _UnparsedName="Bank of America"/>
                <EXTENSION>
                    <EXTENSION_SECTION>
                        <EXTENSION_SECTION_DATA>
                            <FLOOD_DETERMINATION SplitDeterminationIndicator="N"/>
                        </EXTENSION_SECTION_DATA>
                    </EXTENSION_SECTION>
                </EXTENSION>
            </FLOOD_RESPONSE>
        </RESPONSE_DATA>
        <STATUS _Code="S0010" _Condition="Success" _Description="This is a TEST ORDER. It cannot be used for any purpose other than system testing. Section II.B.4 applies to all buildings on property described in Sec I.2.   THIS FLOOD DETERMINATION IS PROVIDED TO THE LENDER PURSUANT TO THE FLOOD DISASTER PROTECTION ACT.  IT SHOULD NOT BE USED FOR ANY OTHER PURPOSE." _Name="Complete"/>
    </RESPONSE>
</RESPONSE_GROUP>

and dw transform looks like

%dw 1.0
%output application/java
---
{
    brwrFirstName: payload.RESPONSE_GROUP.RESPONSE.RESPONSE_DATA.FLOOD_RESPONSE.BORROWER.@"_FirstName",

    brwrLastName: payload.RESPONSE_GROUP.RESPONSE.RESPONSE_DATA.FLOOD_RESPONSE.BORROWER.@"_LastName" default '',

I am seeing an error at brwrFirstName: payload.RESPONSE_GROUP.RESPONSE.RESPONSE_DATA.FLOOD_RESPONSE

3
What does your input look like? What does your transform look like? Usually when that error is show, there is a corresponding snippet showing the DW transform. Can you post that as well?Chad Gorshing

3 Answers

4
votes

As Chad mentioned, you should post your input and actual mule XML (not just DW code), which will help folks understand it better.

Based on the information provided, it looks like the payload is a string and DW is saying that it can't apply the "." selector on a string. That's the error you are getting. Selectors can only be applied to the types it says in the error.

Now you are expecting DW to interpret your string as XML and parse accordingly. Sometimes, DW doesn't know to do that. However, you can force a type on the payload that will make DW interpret the string as XML. Just add the child element below with the appropriate mimeType to the <dw:transform-message> element.

<dw:input-payload  mimeType="application/xml"/>

This will force DW to parse the string as XML and your app should work at that point. You can also apply the mimeType attribute to <dw:input-variable> as well.

Full DW example in mule xml file:

<dw:transform-message doc:name="Transform Message">
  <dw:input-payload  mimeType="application/xml"/>
  <dw:set-payload>
        <![CDATA[%dw 1.0
%output application/java
---
{
    brwrFirstName: payload.RESPONSE_GROUP.RESPONSE.RESPONSE_DATA.FLOOD_RESPONSE.BORROWER.@"_FirstName",
    brwrLastName: payload.RESPONSE_GROUP.RESPONSE.RESPONSE_DATA.FLOOD_RESPONSE.BORROWER.@"_LastName" default ''    
}]]>
    </dw:set-payload>
</dw:transform-message>
2
votes

Error Faced:

ERROR 2017-03-07 12:49:50,060 [[bulk_create_poc].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
Message               : Exception while executing: 
 payload.ns0#ResponseData_MT.*Item map {
 ^
Type mismatch for 'Value Selector' operator
     found :binary, :name
  required :datetime, :name or
  required :localdatetime, :name or
  required :object, :name or
  required :time, :name or
  required :array, :name or
  required :date, :name or
  required :localtime, :name or
  required :period, :name.

Addition of the below snippet for the Resolution

<dw:input-payload  mimeType="application/xml"/>

As in here

<dw:transform-message doc:name="Transform Message" metadata:id="b12f4d65-2bb0-43e9-b775-c2077863ba48">
<dw:input-payload  mimeType="application/xml"/>
<dw:set-payload><![CDATA[ 
0
votes

addition of the data type for the mime type really worked for me

Error that I was facing :

ERROR 2017-03-07 12:49:50,060 [[bulk_create_poc].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:


Message : Exception while executing: payload.ns0#ResponseData_MT.*Item map { ^ Type mismatch for 'Value Selector' operator found :binary, :name required :datetime, :name or required :localdatetime, :name or required :object, :name or required :time, :name or required :array, :name or required :date, :name or required :localtime, :name or required :period, :name.

****Resolution that worked for me :****