将soap消息插入mulesoft中的数据库

将soap消息插入mulesoft中的数据库,mule,Mule,我需要从SOAP获取消息,并将它们保存到Mule中的MySQL数据库中 我使用set变量获取我想要的文本: #[xpath('//tra:sayHi/ID/text()').getText()] 然后在数据库组件中,我使用以下方法: insert into account(id,name,REF1,REF2) values(#[flowVars.ID],#[flowVars.name],null,null) 当我在SoapUI中测试时,我得到以下错误消息: org.apache.cxf.in

我需要从SOAP获取消息,并将它们保存到Mule中的MySQL数据库中

我使用set变量获取我想要的文本:

#[xpath('//tra:sayHi/ID/text()').getText()]
然后在数据库组件中,我使用以下方法:

insert into account(id,name,REF1,REF2) values(#[flowVars.ID],#[flowVars.name],null,null)
当我在SoapUI中测试时,我得到以下错误消息:

org.apache.cxf.interceptor.Fault:找不到将“SimpleDataType{type=java.lang.Integer,mimeType='text/xml'}”转换为“SimpleDataType{type=javax.xml.stream.XMLStreamReader,mimeType='/'}”的转换器

我的XML是:

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

<mule xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" 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" version="EE-3.5.2"
    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/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.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/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd">
<mulexml:namespace-manager>
    <mulexml:namespace prefix="soapenv"
                       uri="http://schemas.xmlsoap.org/soap/envelope/"/>
    <mulexml:namespace prefix="tra"
                       uri="http://training/"/>
</mulexml:namespace-manager>
    <db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="admin" password="pontiac" database="sqwarepeg" doc:name="MySQL Configuration"/>
    <flow name="testFlow1" doc:name="testFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" doc:name="HTTP"/>
        <cxf:proxy-service port="SF2DBPort" namespace="http://training/" service="SF2DBService" payload="body" wsdlLocation="/src/main/resources/SF2DB.wsdl" doc:name="CXF"/>
        <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
        <set-variable variableName="name" value="#[xpath('//tra:sayHi/name/text()').getText()]" doc:name="Set name"/>
        <set-variable variableName="ID" value="#[xpath('//tra:sayHi/ID/text()').getText()]" doc:name="set ID"/>
        <db:insert config-ref="MySQL_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[insert into account(id,name,REF1,REF2) values(#[flowVars.ID],#[flowVars.name],null,null)]]></db:parameterized-query>
        </db:insert>
        <logger message="The reply &quot;#[flowVars.ID]&quot; means &quot;Customer ID&quot;" level="INFO" doc:name="Logger"/>
    </flow>
</mule>


当我检查数据库时,记录已经插入。我只是不知道为什么会有错误信息。谢谢您的帮助。

您的流中缺少一个重要的部分:没有
设置有效负载
消息处理器来设置响应对象,而
cxf:proxy service
将序列化为有效的SOAP响应。

您能附加soapUI发送的xml吗?谢谢David!是的,我没有设置SOAP响应。