처리되지 않은 레코드에 대해 데이터베이스를 읽고, JSON 페이로드 형식으로 정리 한 다음 REST 웹 서비스를 실행하는 mule 응용 프로그램을 작성하고 싶습니다. 데이터베이스에서 레코드를 읽을 수 있으며 JSON에서 데이터베이스 레코드를 변환 할 수 있습니다. 그러나, 나는 예외Mule - java.lang.String을 java.util.Map에 캐스트 할 수 없습니다.
다음 무엇입니까 응용 프로그램을 실행할 때마다java.lang.ClassCastException가 : java.lang.String의는 java.util.Map
여기내 뮬 구성 XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="root" database="my_database_name" doc:name="MySQL Configuration"/>
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="example.net" port="8000" basePath="API" doc:name="HTTP Request Configuration"/>
<flow name="cwg_clientFlow">
<poll doc:name="Poll">
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[SELECT * FROM cwg_ws_data WHERE SyncFlag = 0]]></db:parameterized-query>
</db:select>
</poll>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<json:object-to-json-transformer doc:name="Object to JSON" />
<logger message="JSON Payload is #[payload]" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="/cwg" method="POST" doc:name="HTTP">
<http:request-builder>
<http:query-params expression="#[payload]"/>
<http:header headerName="access_token" value="MQTgpMUmyQLt134maB6vPp6oWFgMtGsqzIlpCN74"/>
</http:request-builder>
</http:request>
<logger message="webservice response #[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
캐스트 할 수없는
어디에 잘못 될지 이해할 수 없습니다.
도와주세요. 지난 2 일 이래로 노력하고 있습니다. 사전에
덕분에
-Paresh ([email protected])
HTTP 요청에 대한 쿼리 매개 변수로 페이로드를 사용하는 것 같지만 표현식으로 설정하기 위해 Map (쿼리 키/쿼리 값)이어야합니다. . 그것이 캐스팅 오류에 관한 것입니다. 쿼리 매개 변수로 실제로 무엇이 필요합니까? – afelisatti
webservice는 JSON 형식의 데이터베이스 행을 변환하고이 JSON을 webservice에 전달하려고하므로 JSON 형식의 페이로드가 필요합니다. –
그러면 쿼리 매개 변수가 필요하지 않습니다. – afelisatti