未処理のレコードのデータベースを読み込み、JSONペイロード形式でそれらをまとめるためのラブアプリケーションを作成してから、REST Webサービスを起動します。 私はデータベースからレコードを読み取ることができ、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
JSON形式のデータベース行を変換し、このJSONをWebサービスに渡そうとしているため、webserviceはJSON形式のペイロードを要求しています。 –
次に、クエリパラメータは必要ありません。 – afelisatti