2014-02-20 1 views
0

Mule ESB 3.4 CE를 사용하고 있습니다. Salesforce 커넥터를 사용하여 연락처를 만드는이 흐름이 있습니다. 오류를 구문 분석하고 몇 가지 조치를 취하고 싶습니다.ESB에서 Salesforce Connector의 오류 구문 분석

[[SaveResult errors='{[1][Error fields='{[1]Email,}' 
    message='A contact with this email address already exists.' 
    statusCode='FIELD_CUSTOM_VALIDATION_EXCEPTION' 
] 
,}' 
id='null' 
success='false' 
] 
, [SaveResult errors='{[1][Error fields='{[1]Email,}' 
    message='A contact with this email address already exists.' 
    statusCode='FIELD_CUSTOM_VALIDATION_EXCEPTION' 
    ] 
,}' 
id='null' 
success='false' 
] 
] 

나는 다음과 같은 식의 구성 요소에 의해 ID를 얻을 수있었습니다 : 그러나

<expression-component doc:name="Get Failed List">flowVars.listIds = (Id in payload)</expression-component> 

, 내가 할 수 없습니다 다음과 같이

.... 
<sfdc:create config-ref="Salesforce" type="Contact" doc:name="Create Contacts"> 
    <sfdc:objects ref="#[payload]"/> 
</sfdc:create> 
<expression-component doc:name="Get Successful List">flowVars.listSuccess = ($ in payload if $.success=='true')</expression-component> 
<expression-component doc:name="Get Failed List">flowVars.listErrors = ($.errors in payload if $.success=='false')</expression-component> 

의 결과는 statusCode 및 오류시 메시지. 나는 다양한 조합을 시도했지만, 그것을 얻을 수 없었다. 예 : # [(in message in (errors in flowVars.listErrors)] Salesforce에서 오류를 반환 할 때 StatusCode 및 메시지를 얻으려면 어떻게해야합니까?

답변

1

flowVars.listErrors에는 오류 배열 목록이 포함됩니다. 영감 :

<logger message="#[flowVars.listErrors[0][0].message]" level="INFO" doc:name="Logger"/> 

<scripting:component doc:name="Groovy"> 
    <scripting:script engine="Groovy"><![CDATA[ 
     flowVars.listErrors.each{it->it.each{it2->println('message:'+it2.message)}} 
    ]]></scripting:script> 
</scripting:component> 
+0

나는 콘솔에 출력을 볼 수 있었다, 그러나 당신이 변수로 메시지와 상태 코드를 추출, 그렇게 할 수있는 방법 나는 데이터베이스에 로그인 할 수 –

+0

할 수 있다면 나도 몰라? MEL에서 중첩 된 목록을 평평하게 만들거나 오류를 기록하는 가장 좋은 방법 인 경우 Groovy에서 필자의 예를 따라 가서 메시지/상태 코드를 추출하여 변수에 할당 할 수 있습니다. –

관련 문제