I have a payload factory mediator in my proxy service, which looks like below.
<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>
On executing the above payload factory mediator, I am getting the below error.
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$1.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
What could be the reason? Where am I going wrong?
Please help to overcome the situation.
Thanks in advance.
Arguments your inserted via $1,$2 and so on - is it strings or numbers? If strings - put them into "", like:
"UserName":"$2",
"StudentID":$3,
"FirstName":"$4",