Oracle插入XML参数未在Mule中验证 [英] Oracle insert XML parameter is not validating in Mule

查看:56
本文介绍了Oracle插入XML参数未在Mule中验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Oracle XMLTYPE 列中有一个插入语句.当我在Oracle中运行它时,它的工作正常.但是,如果我在Mule中放置相同的内容,则插入其未验证.

I have an insert statement into Oracle XMLTYPE Column. When i am running it in Oracle its working fine . But if i place the same in Mule insert its not validating .

我的XML是

'<DRIVEResponse><Loan><Condition ActionStep="parties. &amp;lt;A href=''ABC.com/abc/''"/> 
 </Loan>
 </DRIVEResponse>'

这是我在数据库插入中放置的内容

This what i placed in DB insert

 {
'RESPONSE_XML' : '<DRIVEResponse><Loan><Condition ActionStep="parties. 
 &amp;lt;A href=''ABC.com/abc/''"/> </Loan></DRIVEResponse>' ,
 'SUCCESS_FLAG' : "Y"
 }

我收到的错误是

- Invalid input ''', expected `}` or ',' for the object expression.

(第2行,第88列):

(line 2, column 88):

查询文本来自java类.相同的查询文本正在发送到一个spring boot服务,并且插入正在那里进行.但是在m子中我得到了如图所示的错误.如果我在SQL Developer中运行此查询,则其运行和插入记录.

The query text is coming from a java class . This same Query text is sending to one spring boot service and the insert is happening there. But in mule i am getting error as shown. If i run this query in SQL developer its running and inserting record.

更新:-使用硬编码XML的insert语句运行正常.但是,如果我将其放置在转换中并将该变量带入查询中,它就会失败.即使我与硬编码值完全匹配,但是如果我将其放在变量中也会失败.

Update :- insert Statement with hardcoded XML , is working fine . But if i place that in a transformation and bring that variable into query , its failing . Even though i am making exact match with hardcoded value , if i place it in variable its failing .

硬编码-可以正常工作

insert into xmlpkg.BLT_DV_REQ_RESP(ID, REQUEST_XML) values (
      xmlpkg.SEQ_DV_REQ_RESP.nextval, 
'<Condition  Code= "parties. &amp;lt;A 
 href=''h''&amp;gt;h/&amp;lt;/A&amp;gt;"></Condition>' )

从变量中获取-失败下面的代码在我的转换中

Taking from Variable - Failing Below code is in my transformation

 %dw 2.0
 output text/plain
 ---
 "'"++( '<Condition  Code= "parties. &amp;lt;A 
 href=\'\'h\'\'&amp;gt;h/preventfraud/&amp;lt;/A&amp;gt;"></Condition>' )  as 
 String ++ "'"

推荐答案

RESPONSE_XML的字符串被错误地转义.您试图将XML文档作为字符串表达式放入DataWeave中.但是,在 href = 之后,引号不平衡和/或错误地转义.我不确定原始的XML文档是什么.如果是手工操作,则最好让DataWeave自动正确地对其进行转义,例如,使用类似 write(xmlPayload,"application/xml")这样的字符串.

The string for RESPONSE_XML is incorrectly escaped. You are trying to put an XML document as a string expression in DataWeave. However the quotes are unbalanced and/or incorrectly escaped after href=. I'm not sure what is the original XML document is. If this is by hand, it would be better to let DataWeave to escape it automatically, and correctly, for example using something like write(xmlPayload, "application/xml") as String.

示例:

        <ee:transform doc:name="Mock result from a request" doc:id="723fdd83-fcce-4bff-8a24-065609b235b0" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
{
    book: {
            name: "Robin Hood"
    }   
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <ee:transform doc:name="Do some transform" doc:id="aaca98c2-1f76-476f-8ab3-030061e46472" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
payload.book mapObject (title: $) ]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <ee:transform doc:name="Prepare arguments for db operation" doc:id="261e8437-d7b5-4a8e-b781-5790ea5f9f40" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
    'RESPONSE_XML' : write(payload, "application/xml") ,
    'SUCCESS_FLAG' : "Y"
}
]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <logger level="INFO" doc:name="Logger" doc:id="a90fca6e-5fd3-4aaa-963c-0f06376e4076" message="output #[payload]"/>

这篇关于Oracle插入XML参数未在Mule中验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆