WSO2 Payload factory mediator 显示非法字符<D>
WSO2 Payload factory mediator shows Illegal character<D>
我的代理服务中有一个负载工厂调解器,如下所示。
<payloadFactory media-type="json">
<format>{
"EntityTypeCode":"asx",
"SchoolId":,
"Format":"json",
"InputData":{
"Accounts":{
"Account":[
{
"UserName":,
"StudentID":,
"FirstName":,
"LastName":,
"Email":,
"DOB":,
"SSN":,
"Password":,
"GenderCode":,
"Address1":,
"City":,
"State":,
"ZipCode":
}
]
}
}
}
</format>
<args>
<arg evaluator="xml" expression="get-property('SchoolId')"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml" expression="get-property('first_name')"/>
<arg evaluator="xml" expression="get-property('last_name')"/>
<arg evaluator="xml" expression="get-property('email_address')"/>
<arg evaluator="xml" expression="get-property('birth_date')"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml" expression="get-property('birth_date')"/>
<arg evaluator="xml" expression="get-property('sex')"/>
<arg evaluator="xml" expression="get-property('street_line1')"/>
<arg evaluator="xml" expression="get-property('city')"/>
<arg evaluator="xml" expression="get-property('stat_code')"/>
<arg evaluator="xml" expression="get-property('zip')"/>
</args>
</payloadFactory>
在执行上述负载工厂调解器时,出现以下错误。
ERROR - SequenceMediator javax.xml.stream.XMLStreamException: Illegal
character: org.apache.axiom.om.OMException:
javax.xml.stream.XMLStreamException: Illegal character:
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedElementImpl.java:880)
at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:122)
at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:343)
at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36)
at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:58)
at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:554)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:686)
at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113)
at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988)
at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:321)
at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:138)
at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:223)
at org.apache.synapse.mediators.builtin.LogMediator.getSimpleLogMessage(LogMediator.java:168)
at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:134)
at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:101)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:213)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
at org.apache.axis2.transport.base.threads.NativeWorkerPool.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) Caused by: javax.xml.stream.XMLStreamException: Illegal character:
at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.hasNext(AbstractXMLStreamReader.java:449)
at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.next(AbstractXMLStreamReader.java:456)
at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 31 more
可能是什么原因?我哪里错了?
请帮助克服这种情况。
提前致谢。
您通过 $1、$2 等插入的参数 - 是字符串还是数字?如果是字符串 - 将它们放入“”,例如:
"UserName":"",
"StudentID":,
"FirstName":"",
我的代理服务中有一个负载工厂调解器,如下所示。
<payloadFactory media-type="json">
<format>{
"EntityTypeCode":"asx",
"SchoolId":,
"Format":"json",
"InputData":{
"Accounts":{
"Account":[
{
"UserName":,
"StudentID":,
"FirstName":,
"LastName":,
"Email":,
"DOB":,
"SSN":,
"Password":,
"GenderCode":,
"Address1":,
"City":,
"State":,
"ZipCode":
}
]
}
}
}
</format>
<args>
<arg evaluator="xml" expression="get-property('SchoolId')"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml" expression="get-property('first_name')"/>
<arg evaluator="xml" expression="get-property('last_name')"/>
<arg evaluator="xml" expression="get-property('email_address')"/>
<arg evaluator="xml" expression="get-property('birth_date')"/>
<arg evaluator="xml"
expression="$body/*[local-name()='Object']/*[local-name()='Payload']/*[local-name()='ID'][*[local-name()='Type']='abc']/*[local-name()='Value']/text()"/>
<arg evaluator="xml" expression="get-property('birth_date')"/>
<arg evaluator="xml" expression="get-property('sex')"/>
<arg evaluator="xml" expression="get-property('street_line1')"/>
<arg evaluator="xml" expression="get-property('city')"/>
<arg evaluator="xml" expression="get-property('stat_code')"/>
<arg evaluator="xml" expression="get-property('zip')"/>
</args>
</payloadFactory>
在执行上述负载工厂调解器时,出现以下错误。
ERROR - SequenceMediator javax.xml.stream.XMLStreamException: Illegal character: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Illegal character: at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296) at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedElementImpl.java:880) at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:122) at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:343) at org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36) at org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:58) at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:554) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:686) at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113) at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988) at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:321) at org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:138) at org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:223) at org.apache.synapse.mediators.builtin.LogMediator.getSimpleLogMessage(LogMediator.java:168) at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:134) at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:101) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:213) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403) at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151) at org.apache.axis2.transport.base.threads.NativeWorkerPool.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: javax.xml.stream.XMLStreamException: Illegal character: at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.hasNext(AbstractXMLStreamReader.java:449) at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.next(AbstractXMLStreamReader.java:456) at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source) at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681) at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214) ... 31 more
可能是什么原因?我哪里错了?
请帮助克服这种情况。
提前致谢。
您通过 $1、$2 等插入的参数 - 是字符串还是数字?如果是字符串 - 将它们放入“”,例如:
"UserName":"",
"StudentID":,
"FirstName":"",