我正在使用wso2esb 4.7.0和wso2dss 3.0.0 ..我创建了dataservice来更新表中的记录。我的Dss配置如下
<query id="trial_query" useConfig="default">
<sql>update muser set username=? where userid=?</sql>
<param name="username" ordinal="1" sqlType="STRING"/>
<param name="userid" ordinal="2" sqlType="BIGINT"/>
</query>
<operation name="trial_op">
<call-query href="trial_query">
<with-param name="username" query-param="username"/>
<with-param name="userid" query-param="userid"/>
</call-query>
</operation>
之后我创建了一个ESB配置:
<target>
<inSequence>
<property name="username"
expression="//username/text()"
scope="default"
type="STRING"/>
<property name="userid"
expression="//userid/text()"
scope="default"
type="STRING"/>
<log level="full"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<payloadFactory media-type="xml">
<format>
<p:trail_op xmlns:p="http://ws.wso2.org/dataservice">
<p:username>$1</p:username>
<p:userid>$2</p:userid>
</p:trail_op>
</format>
<args>
<arg evaluator="xml" expression="get-property('username')"/>
<arg evaluator="xml" expression="get-property('userid')"/>
</args>
</payloadFactory>
<send>
<endpoint>
<address uri="http://192.168.1.23:9764/services/Capp_muser_dataservice/trail_op"
format="soap12"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
这也有效..现在我想在esb中添加一个序列中介,它的配置如下:
<property name="messageType" value="application/json" scope="axis2"></property>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" name="username" expression="get-property('username')" scope="default" type="STRING"></property>
<log>
<property name="username" value="UPDATED SUCCESSFULLY"></property>
</log>
<send></send>
我正在使用curl命令发送请求:
curl -v -H "Accept:application/json" -H "Content-Type:application/json" -d '{"username":"Harry","userid":"347367127872701992"}' http://youtility-desktop:8282/services/capp1
现在,他发出的问题是当我在send mediator中添加序列时,ESB会抛出错误:
ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:55)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:116)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:91)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:381)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2116)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2022)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1114)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 17 more
配置仍然正常,但也有错误.. 我在wso2esb 4.8.0和wso2dss 3.1.0中尝试了相同的代码。这里ESB工作正常但是wso2dss 3.1.0发生了错误。它显示如下错误:
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:username
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: Capp_muser_dataservice
Location: /Capp_muser_dataservice.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: trail_op
Current Params: {}
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:107)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:112)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:80)
at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:127)
... 40 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:username
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: Capp_muser_dataservice
Location: /Capp_muser_dataservice.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: trail_op
Current Params: {}
at org.wso2.carbon.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:208)
at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:177)
at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.executeElement(CallQueryGroup.java:111)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:548)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:101)
... 43 more
为什么会发生错误?他们在发送调解器期间是否有任何soap格式问题,或者我必须在esb配置中添加一些属性?我该怎么做才能解决这个问题?请告诉我..