我的代理服务中有一个有效负载工厂中介,如下所示。
<payloadFactory media-type="json">
<format>{
"EntityTypeCode":"asx",
"SchoolId":$1,
"Format":"json",
"InputData":{
"Accounts":{
"Account":[
{
"UserName":$2,
"StudentID":$3,
"FirstName":$4,
"LastName":$5,
"Email":$6,
"DOB":$7,
"SSN":$8,
"Password":$9,
"GenderCode":$10,
"Address1":$11,
"City":$12,
"State":$13,
"ZipCode":$14
}
]
}
}
}
</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>
在执行上述有效负载工厂介体时,我收到以下错误。
错误 - SequenceMediator javax.xml.stream.XMLStreamException:非法 character:org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException:非法字符: 在org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296) 在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) 在org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:343) 在org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenIterator.java:36) 在org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:58) 在org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:554) 在org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:686) 在org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555) 在org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875) 在org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125) 在org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113) 在org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988) at org.apache.synapse.util.xpath.SynapseXPath.stringValueOf(SynapseXPath.java:321) 在org.apache.synapse.mediators.MediatorProperty.getEvaluatedExpression(MediatorProperty.java:138) 在org.apache.synapse.mediators.builtin.LogMediator.setCustomProperties(LogMediator.java:223) 在org.apache.synapse.mediators.builtin.LogMediator.getSimpleLogMessage(LogMediator.java:168) 在org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:134) 在org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:101) 在org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59) 在org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:213) 在org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403) 在org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151) 在org.apache.axis2.transport.base.threads.NativeWorkerPool $ 1.run(NativeWorkerPool.java:172) 在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)引起:javax.xml.stream.XMLStreamException:非法字符: 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) 在javax.xml.stream.util.StreamReaderDelegate.next(未知来源) 在org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681) 在org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214) ......还有31个
可能是什么原因?我哪里错了?
请帮助克服这种情况。
提前致谢。
答案 0 :(得分:4)
您通过$ 1,$ 2等插入的参数 - 是字符串还是数字?如果字符串 - 将它们放入&#34;&#34;,如:
"UserName":"$2",
"StudentID":$3,
"FirstName":"$4",