I'm attempting to retrieve data from Facebook using the WSO2 Facebook Connector in WSO2 ESB 4.9.0. I've provided the proxy configuration below.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="facebook_getFeed"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence onError="fault">
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<property name="apiUrl" expression="json-eval($.apiUrl)"/>
<property name="apiVersion" expression="json-eval($.apiVersion)"/>
<property name="accessToken" expression="json-eval($.accessToken)"/>
<property name="userId" expression="json-eval($.userId)"/>
<property name="numOfFeeds" expression="json-eval($.numOfFeeds)"/>
<property name="fields" expression="json-eval($.fields)"/>
<facebook.init>
<apiUrl>{$ctx:apiUrl}</apiUrl>
<accessToken>{$ctx:accessToken}</accessToken>
<apiVersion>{$ctx:apiVersion}</apiVersion>
</facebook.init>
<facebook.getFeeds>
<userId>{$ctx:userId}</userId>
<numOfFeeds>{$ctx:numOfFeeds}</numOfFeeds>
<fields>{$ctx:fields}</fields>
</facebook.getFeeds>
<respond/>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<send/>
</outSequence>
</target>
<description/>
</proxy>
The issue I'm having is that whenever I make a POST request to the service it times out. Checking the ESB error logs it appears that there was an "Error While building Passthrough stream".
[2015-12-15 15:16:54,284] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:149)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:363)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 18 more
[2015-12-15 15:16:54,377] ERROR - SequenceMediator Error while building message
org.apache.axis2.AxisFault: Error while building Passthrough stream
at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:283)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:142)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:363)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:149)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
... 13 more
Referring to the proxy configuration above, I've got a log mediator which actually successfully prints the JSON payload, so that would lead me to think it has something to do with the messager formatter?
My message formatter/builder configuration within the Axis2.xml file is as follows:
<!--JSON Message Formatters-->
<messageFormatter contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<!--JSON Message Builders-->
<messageBuilder contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
Everything else in this file is as per the default configuration.
What could be going wrong here?
Using Soap UI (Obscured IP and access token in payload):
POST http://[SERVER_IP]:8280/services/facebook_getFeed <br>
HTTP/1.1 <br>
Accept-Encoding: gzip,deflate <br>
Content-Type: application/json <br>
Content-Length: 207 <br>
Host: [SERVER_IP]:8280 <br>
Connection: Keep-Alive <br>
User-Agent: Apache-HttpClient/4.1.1 (java 1.5) <br>
Payload Data:
{
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"[TOKEN HERE]",
"userId":"409521282507981",
"numOfFeeds":"10",
"fields":"message,id,created_time"
}
As requested by @RavindraRanwala :
[2015-12-15 17:29:38,650] DEBUG - wire >> "POST /services/facebook_getFeed HTTP/1.1[\r][\n]"
[2015-12-15 17:29:38,652] DEBUG - wire >> "Accept-Encoding: gzip,deflate[\r][\n]"
[2015-12-15 17:29:38,653] DEBUG - wire >> "Content-Type: application/json[\r][\n]"
[2015-12-15 17:29:38,653] DEBUG - wire >> "Content-Length: 207[\r][\n]"
[2015-12-15 17:29:38,663] DEBUG - wire >> "Host: [SERVER_IP]:8280[\r][\n]"
[2015-12-15 17:29:38,663] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2015-12-15 17:29:38,664] DEBUG - wire >> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
[2015-12-15 17:29:38,665] DEBUG - wire >> "[\r][\n]"
[2015-12-15 17:29:38,666] DEBUG - wire >> "{[\n]"
[2015-12-15 17:29:38,666] DEBUG - wire >> ""apiUrl":"https://graph.facebook.com",[\n]"
[2015-12-15 17:29:38,667] DEBUG - wire >> ""apiVersion":"v2.4",[\n]"
[2015-12-15 17:29:38,668] DEBUG - wire >> ""accessToken":"[ACCESS_TOKEN]",[\n]"
[2015-12-15 17:29:38,669] DEBUG - wire >> ""userId":"409521282507981",[\n]"
[2015-12-15 17:29:38,669] DEBUG - wire >> ""numOfFeeds":"10",[\n]"
[2015-12-15 17:29:38,679] DEBUG - wire >> ""fields":"message,id,created_time"[\n]"
[2015-12-15 17:29:38,679] DEBUG - wire >> "}"
[2015-12-15 17:29:38,812] INFO - LogMediator To: /services/facebook_getFeed, MessageID: urn:uuid:27814841-6067-466c-b55f-b7fdd67c8d3b, Direction: request, Payload: {
"apiUrl":"https://graph.facebook.com",
"apiVersion":"v2.4",
"accessToken":"[ACCESS_TOKEN]",
"userId":"409521282507981",
"numOfFeeds":"10",
"fields":"message,id,created_time"
}
[2015-12-15 17:29:38,909] INFO - TimeoutHandler This engine will expire all callbacks after : 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2015-12-15 17:29:40,267] DEBUG - wire << "GET /409521282507981/feed?limit=10&access_token=[ACCESS_TOKEN]&fields= HTTP/1.1[\r][\n]"
[2015-12-15 17:29:40,269] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2015-12-15 17:29:40,278] DEBUG - wire << "Content-Type: application/json[\r][\n]"
[2015-12-15 17:29:40,279] DEBUG - wire << "Host: graph.facebook.com:443[\r][\n]"
[2015-12-15 17:29:40,280] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2015-12-15 17:29:40,281] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2015-12-15 17:29:40,281] DEBUG - wire << "[\r][\n]"
[2015-12-15 17:29:40,554] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2015-12-15 17:29:40,557] DEBUG - wire >> "Access-Control-Allow-Origin: *[\r][\n]"
[2015-12-15 17:29:40,558] DEBUG - wire >> "Content-Type: text/javascript; charset=UTF-8[\r][\n]"
[2015-12-15 17:29:40,559] DEBUG - wire >> "X-FB-Trace-ID: E5Iewv3ixeR[\r][\n]"
[2015-12-15 17:29:40,560] DEBUG - wire >> "X-FB-Rev: 2091546[\r][\n]"
[2015-12-15 17:29:40,561] DEBUG - wire >> "ETag: "ca13846784e4a3383090ca79b7a295fd23aa5641"[\r][\n]"
[2015-12-15 17:29:40,561] DEBUG - wire >> "Pragma: no-cache[\r][\n]"
[2015-12-15 17:29:40,562] DEBUG - wire >> "Cache-Control: private, no-cache, no-store, must-revalidate[\r][\n]"
[2015-12-15 17:29:40,563] DEBUG - wire >> "Facebook-API-Version: v2.5[\r][\n]"
[2015-12-15 17:29:40,563] DEBUG - wire >> "Expires: Sat, 01 Jan 2000 00:00:00 GMT[\r][\n]"
[2015-12-15 17:29:40,564] DEBUG - wire >> "Vary: Accept-Encoding[\r][\n]"
[2015-12-15 17:29:40,565] DEBUG - wire >> "Content-Encoding: gzip[\r][\n]"
[2015-12-15 17:29:40,565] DEBUG - wire >> "X-FB-Debug: G+b1bsKrSFxPDc4u1RDGIpHACsTbiJV6n1nGgNfMYwc0IqGO2fif1pnr9/o/dhQ1DLSpl7pXheknjzMwvH948w==[\r][\n]"
[2015-12-15 17:29:40,575] DEBUG - wire >> "Date: Tue, 15 Dec 2015 06:29:46 GMT[\r][\n]"
[2015-12-15 17:29:40,576] DEBUG - wire >> "Connection: keep-alive[\r][\n]"
[2015-12-15 17:29:40,578] DEBUG - wire >> "Content-Length: 814[\r][\n]"
[2015-12-15 17:29:40,579] DEBUG - wire >> "[\r][\n]"
[2015-12-15 17:29:40,580] DEBUG - wire >> "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3][0xad][0x93][0xef]o[0xa3]6[0x18][0xc7][0xff][0x15][0xc4][0x8b]J[0xd3]z[0x89]⌂[0x3][0x96][0xaa][0x89]$M[0xbb][0xb4][0xd7]6[0x97]\[0xda][0xb0]L[0x91]K[0x1c]B![0x98][0x82][0x9][0xcd]z[0xfd][0xdf]g[0xba]{Q[0xe5][0xa6]p[0x9a][0x6][0xbc][0xb0][0x85][0xad][0xcf][0xd7][0x1f]?[0xcf][0xab][0xbd][0x12]Z[0xd8][0xfc][0x8f]W{+[0xcb]RD[0xd2][0xe6][0xf6
3][0x97][0x96][0xf9][0x84]u[0xa5]D*,[0xfe][0x8b]}j[0x87][0x85][0x14]Z[0xae][0x96]:[0xde]6k[0x10][0x80][0xf8][0x13][0x84][0x9f][0x90];[0x5][0x88][0x3][0xc8][0xb1][0xfb]+0[0x8f]Y[0x19][0xaf][0xcc]⌂[0x2]<[0x8a] r[0x11][0x5][0x8e][0xe7][0xc2]%[0xc4].t[0x10]c[0x18][0x1][0x87]B[0x97][0xd8]o[0xa7][0x1f][0x91][0x13][0xb5][0x95]z[0x13]gQ[0xc3][0xad][0xb]e[0x6][0x1b]Y[0xc8][0xce]q0[0xe0][0x80]q[0xe0][0x1d][0x5][0x13][0x88] c[0x84][0xb9][0x1
][0x10]y[0x7][0xdc]QUjK[0xcb]R7[0xe8]T[0x85]B[0xc7]*[0xb3]D$[0xe2][0xac][0xd3]9Fw[0xa6][0x8]sJ8[0xa6][0xed]t[0xc]IC'[0xc][0x1e][0xd0][0xef][\n]"
[2015-12-15 17:29:40,592] DEBUG - wire >> "[0xa9][0xf5][0xde]*k)[0xb5][0x95][0xa7]"[0x94][0x96]V[0xd6]F[0xec][0xa4][0x95]VY[0xb8]i[\r][0x80][0x10][0x87][0xc7][0xbd]7[0x1](1/u[0xcc][0xdc]=[0x8][0xf0][0xbb]U[0x8b][0xd2]j[0xc4]'[0x8d][0x0][0xf1][0xa8]*[0xdd]L[0xcb][0xf].B][0x89]4[0xdd][0xb7]E[0x81][0x88]#[0xa7]5[\n]"
[2015-12-15 17:29:40,595] DEBUG - wire >> "![0xd8]3Q<[0x0][0xf0]A[0x94][0xdb][0x8d]%[0xb2][0x95][0xb5][0x15][0xfb]Gy[0x18][0xc1][0x94][0x84]L[0xd3][0x9f][0xb8][0x10]@9[0x81][0xad]!0[0x81][0xc]![0xc2][0x98]w[0x18][0xc2]7[0x9][0xc2][0x8d][0xc][0x13][0xeb][0x7][0x11][0xc7][0xd1][0x88]c[0xc2]I{-[0x98]6[0xf0]L-P[0xec][0xb2][0x1f][0xce]⌂[0xfa].@[0xa4][0xa5]2[0x3][0xa5]M[0xfd][[0xb9]2[0xe5][0xb9].[0xd4][0xd6]d[0x91]VU[0xca][0xa2]E[0x81][
0x4][0x8f][0xa3]v[0x5]f[\n]"
[2015-12-15 17:29:40,596] DEBUG - wire >> ")uMq[0x1e][0xd6][0xa4][0xff][0x1]*[0xde][0x91]mD[0xe0]p[0xc4]Z[0x89][0xc0][0x81][0xa0]!:[0x18][0x1d][0x12][0x9b]S[0xff]T[0xc7]AN[0xcd][0xd7][0xde][0xef][0x0]3dX[0x18][0xb8][0xc0]~[0xfb][0xf3][0xd4][0xce]Ed[0xca][0xdb][0xe6][0xaf]v^[0xc8]][0xac][0xaa][0xd2]l[0xdc]h[0x9d][0x97]|[0xd1]]t[0xa3]B[0xe4][0x9b][0xce][0xda][0xb4][0xdf][0xa3]RI'T[n[0xea]t[0xd1][0xdd][0xa1][0xe]]t[0xf][0x0][0x8b][0x
xca][0xd5]oi[0xbc][0x8d][0xf5][0x19][0x4]'e[0x9c][0x85][0xf2][0xcc][0xdc]+e[0xc0],uOD[0x18][0x9a][0xa3]-[0xb5]Jdv[0x6][0x1d][0xe8]0[0x8][0x8c]l[0x88][0x18]`[0xee][0xb7]Y[0xaa][0xcb][0xde]6z[0xca][0xa6][0x18][0xe6]j[0xb6][0xbf][0xf4][0x96]U[0x8][0x7][0xe]B[0xf5][0xc9]r[0xf9]O[0xd0][0xef]{e[0x16].[0xfd][0x95]?N@[0x8][0x8a]z[0x94][0x8c][0xb0]?q[0x82][0xde][0xa4][0x1e]^[0x87][0xec]9[0xae]f~[0x92]D[0x14][0xf5]\[0x15][0xf4][0xcb]"[0xbc]
]d=[0xbc]x[0x92][0xee]\&[0xdb][0xfb]r[0xf0][0xbc]&[0x81]/[0xf4]|[0x15][0x5][0xfe][0xe7]/[0x8f][0xf1][0x1d]<⌂[0xa9][0xf7]+_EW[0x15]c[0x13]W[0xcb]$y[0xbe][0x9a]{[0xeb][0x9b][0x88][0xc2]r[0x1a][0xf4][0xf2][0xcf][0xf7][0xa3]][0x1d][0xc][0x82]A[0x13][0xe5][0xbb][0xa9]3hLg[0xf2]E[0xff]⌂[0xca][0xfe][0xbb][0xa1]*[0xd3]q[0xfa].[0x9b][0x9a].[0x82][0xde][0xbf]+[0x1b][0xf4][0xc7][0xf2][0xe6]|>[0xc3]t|[[0x8f]]q3[0x8c][0xf1][0xae][0x9f][0x93][0
xe8]k[0x8c]/[0xef][0xee]f[0xe7][0xc9][0xa4][0xbe][0x8c][0x3]?[0xbd][0xdf][0xe5]_[0xfb]/[0xfb][0xb1][0x1f][0xf4][0xc9]5[0xb9][0x9e][0x5]f0[0xdd][0x8f]Y[0xe0][0xc3][0xc9][0xee]<{[0xc8].[0xd4]z>[0xa4]^[0xc8]*⌂=[0x99][0xc6][0xf][0x4][0xdc]#:q[0x9d][0xa2][0xff][0xc4]n[0x91][0xfc][0xcb][0x1b]^[0xd4][0xf]Q[0xa3][0xcc]~{[0xfb][0x1b][0x92][0x12][0xdf])M[0x7][0x0][0x0]"
[2015-12-15 17:29:40,674] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:149)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:154)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:529)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:247)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
[2015-12-15 17:29:40,902] ERROR - TemplateMediator Error while building message
org.apache.axis2.AxisFault: Error while building Passthrough stream
at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:283)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:142)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:154)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:529)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:247)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:149)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
... 14 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 19 more
[2015-12-15 17:29:40,991] ERROR - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:85e6d771-e7c6-4764-8431-01e0fb4782e6, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Error while building message, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
nv:Body/></soapenv:Envelope>
Many thanks @RavindraRanwala and @ThusithaThilinaDayaratne for leading me to the resolution of this issue.
After consulting the wire logs, it appears the Facebook API is responding with text/javascript content type. I had no message builder/formatter enabled within the ESB to handle this content type, so the process ended up failing. All I needed to do was open up my axis2.xml configuration file and append the following message builders:
<!--JSON Message Builders-->
<messageBuilder contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageBuilder contentType="text/javascript" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
... and formatters:
<!--JSON Message Formatters-->
<messageFormatter contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<messageFormatter contentType="text/javascript" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
The most up to date documentation on the Facebook connector seems to be at the GitHub page, where all the necessary builder/formatter information is clarified:
https://github.com/wso2/esb-connectors/tree/master/facebook/facebook-connector/facebook-connector-1.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With