2017-05-26 50 views
0

當我調用帶有「clob」存儲過程作爲插入xml數據的數據類型的存儲過程時,使用mulesoft的數據庫,它在oracle上顯示異常。 這是我的配置文件org.mule.api.MessagingException:com.mulesoft.weave.reader.ByteArraySeekableStream不能轉換爲oracle.sql.CLOB


<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:db="http://www.mulesoft.org/schema/mule/db" 
    xmlns:http="http://www.mulesoft.org/schema/mule/http" 
    xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" 
    xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" 
    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.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd 
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd 
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/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd 
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd 
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"> 
    <flow name="opp_to_sales_orderFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/opportunity" doc:name="HTTP"/> 
     <sfdc:query config-ref="Salesforce__Basic_Authentication" query="SELECT Id, Product_Name__c, Account.name FROM Opportunity " doc:name="Salesforce"/> 
     <json:object-to-json-transformer doc:name="Object to JSON"/> 
     <dw:transform-message doc:name="Transform Message"> 
      <dw:set-payload><![CDATA[%dw 1.0 
%output application/xml skipNullOn="everywhere" 
--- 

    list: { (payload map { 
     linked-hash-map : { 
     name:$.Account.Name, 
     id: $.Id, 
     Product_name: $.Product_Name__c 

    } 
    }) 
    } 
]]></dw:set-payload> 
     </dw:transform-message> 

     <logger level="INFO" doc:name="Logger" message="#[payload]"/> 
     <byte-array-to-string-transformer encoding="UTF-8" mimeType="application/xml" doc:name="Byte Array to String"/> 
     <db:stored-procedure config-ref="Oracle_Configuration" doc:name="Database"> 
      <db:parameterized-query><![CDATA[call xxnew_order_create.xxenv_order_creation8(
               :p_mule_input, 
               :x_order_cursor 
               :x_error_code,                  :x_error_message, 
               :x_sales_order 
               )]]></db:parameterized-query> 
      <db:in-param name="p_mule_input" type="LONGVARCHAR" value="#[message.payload]"/> 
      <db:out-param name="x_order_cursor" type="CURSOR"/> 
      <db:out-param name="x_sales_order" type="VARCHAR"/> 
      <db:out-param name="x_error_code" type="VARCHAR"/> 
      <db:out-param name="x_error_message" type="VARCHAR"/> 
     </db:stored-procedure> 


     <dw:transform-message doc:name="Transform Message"> 
      <dw:set-payload><![CDATA[%dw 1.0 
%output application/java 
--- 
payload]]></dw:set-payload> 
     </dw:transform-message> 

     <logger message="#[payload]" level="INFO" doc:name="Logger"/> 
     <catch-exception-strategy doc:name="Exception Handling "> 
      <logger level="INFO" doc:name="StartLog"/> 
      <set-payload value="{ &quot;errorMessage&quot; : &quot;#[exception.message]&quot;, &quot;exception&quot;:&quot;#[exception.getDetailedMessage()]&quot; }" encoding="UTF-8" mimeType="text/html" doc:name="Catch Exception"/> 
      <set-property propertyName="http.status" value="400" doc:name="http.status"/> 
      <logger level="INFO" doc:name="EndLog"/> 
     </catch-exception-strategy> 

    </flow> 

</mule> 

謝謝

回答

0

逗號是在過程參數丟失,現在它的工作的罰款感謝您的答覆

0

,請複製粘貼您的配置文件是由於輸入傳遞,因爲你需要的數據CLOB前鑄造爲字符串格式。

+0

嗨,現在你可以看到我的配置文件先生.. –

0

請嘗試使用groovy組件並添加下面的代碼。

clobTest = (java.sql.Clob)payload.your_field bodyText = clobTest.getCharacterStream() targetString = org.apache.commons.io.IOUtils.toString(bodyText) payload.PAYLOADHEADERS=targetString return payload 
+0

嗨,現在你可以看到我的配置文件先生.. –

相關問題