我在WSO2 Integrator 6.4上按以下顺序创建了以下REST API:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/dsb" name="evCaptureJSONProperties"
xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/api/SendSMS">
<inSequence>
<log description="Entry Confirmation" level="custom">
<property name="message" value="Request Entered the
evCaptureJSONProperties REST API"/>
</log>
<payloadFactory media-type="json">
<format><!-- A json message was here --></format>
<args/>
</payloadFactory>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
然后我使用以下命令发布请求JSON:
Curl -v -X POST --data @evCaptureJSONProperties.json http://localhost:8280/dsb/api/SendSMS --header "Content-Type:application/json"
但是没有返回有效载荷,而是在日志和控制台中出现了错误:
[2018-12-03 10:23:02,432] [EI-Core] ERROR - RelayUtils Error while building
Passthrough stream
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.
extractParametersFromRequest(XFormURLEncodedBuilder.java:223)
at
org.apache.synapse.commons.builders.XFormURLEncodedBuilder.
processDocumentWrapper(XFormURLEncodedBuilder.java:128)
at org.apache.synapse.commons.builders.XFormURLEncodedBuilder.
processDocument(XFormURLEncodedBuilder.java:52)
我谦虚地请求帮助。预先非常感谢。