最近、ESBでAPIリソースを呼び出そうとすると、payloadFactoryによって実行されるXML例外(以下のスタックトレース)が発生します。 payloadFactory全体を削除することは、これを解決する唯一の方法と思われます。私はargs、空の書式、または完全に静的なargsとフォーマットは動作し、昨日働いた方法で持つことができません!WSO2 ESBペイロードファクトリファクトリXML例外
ビルドはESB 5.0.0上であり、そのようなリソースの例としては、次のようになります。
<resource methods="POST" uri-template="/someUrl">
<inSequence>
<property name="acceptedRoles" value="RMD" scope="default" type="STRING/>
<property name="myProp" value="json-eval($)" scope="default" type="STRING"/>
<Package.ConnectorOne/>
<Package.ConnectorTwo/>
<loopback/>
</inSequence>
<outSequence>
<payloadFactory media-type="json">
<format>{"statusCode":$1,"errorMessage":"$2","errors":$3}</format>
<args>
<arg evaluator="xml" expression="get-property('statusCode')/>
<arg evaluator="xml" expression="get-property('errorMessage')/>
<arg evaluator="xml" expression="get-property('errors')/>
</args>
<payloadFactory>
<send/>
</outSequence>
<faultSequence/>
</resource>
例外のスタックトレース:
TID[-1234] [ESB] [2017-03-21 19:22:33,024] ERROR
{API_LOGGER.FleetManagement} - javax.xml.stream.XMLStreamException:
Unexpected symbol: START_OBJECT
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653
)
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedElemen
tImpl.java:880)
org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:12
2)
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.j
ava:343)
org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenI
terator.java:36)
org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractItera
tor.java:58)
org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:41
8)
org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:42
5)
org.apache.synapse.commons.json.JsonUtil.getNewJsonPayload(JsonUtil.java:587
)
org.apache.synapse.commons.json.JsonUtil.getNewJsonPayload(JsonUtil.java:654
)
org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(Payloa
dFactoryMediator.java:173)
org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(Payloa
dFactoryMediator.java:104)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:97)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:59)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:158) org.apache.synapse.rest.Resource.process(Resource.java:343)
org.apache.synapse.rest.API.process(API.java:338)
org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.jav
a:123)
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.
java:101)
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:5
6)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:304)
org.apache.synapse.mediators.builtin.LoopBackMediator.mediate(LoopBackMediat
or.java:63)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:97)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:59)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:158) org.apache.synapse.rest.Resource.process(Resource.java:343)
org.apache.synapse.rest.API.process(API.java:399)
org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.jav
a:123)
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.
java:101)
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:6
9)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:304)
org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageR
eceiver.java:75)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosing
RESTHandler(ServerWorker.java:325)
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingReq
uest(ServerWorker.java:371)
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151
)
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerP
ool.java:172) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
そして
javax.xml.stream.XMLStreamException: Unexpected symbol: START_OBJECT
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653
)
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.buildNext(OMSourcedElemen
tImpl.java:880)
org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:12
2)
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.j
ava:343)
org.apache.axiom.om.impl.traverse.OMChildrenIterator.getNextNode(OMChildrenI
terator.java:36)
org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractItera
tor.java:58)
org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:41
8)
org.apache.synapse.commons.json.JsonUtil.removeIndentations(JsonUtil.java:42
5)
org.apache.synapse.commons.json.JsonUtil.getNewJsonPayload(JsonUtil.java:587
)
org.apache.synapse.commons.json.JsonUtil.getNewJsonPayload(JsonUtil.java:654
)
org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(Payloa
dFactoryMediator.java:173)
org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(Payloa
dFactoryMediator.java:104)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:97)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:59)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:158) org.apache.synapse.rest.Resource.process(Resource.java:343)
org.apache.synapse.rest.API.process(API.java:338)
org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.jav
a:123)
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.
java:101)
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:5
6)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:304)
org.apache.synapse.mediators.builtin.LoopBackMediator.mediate(LoopBackMediat
or.java:63)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:97)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediat
or.java:59)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.
java:158) org.apache.synapse.rest.Resource.process(Resource.java:343)
org.apache.synapse.rest.API.process(API.java:399)
org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.jav
a:123)
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.
java:101)
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:6
9)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2Syn
apseEnvironment.java:304)
org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageR
eceiver.java:75)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosing
RESTHandler(ServerWorker.java:325)
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingReq
uest(ServerWorker.java:371)
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151
)
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerP
ool.java:172) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
私は明日か月曜日まで私の仕事のPCに再びいませんが、私はargフィールドなしでこれを試しました。結果は同じです。私はこれを試してみることができます。不思議なことに、私は仕事中のチームメイトに自分のサーバでこのコードを試してもらい、うまく働いたと言いました。 –
ええ、これで問題は解決しませんでした。それにもかかわらず、アイデアをありがとう。 –