It looks like Synapse fails to parse the response sent by the server. It might 
be helpful if you trace the communication between Synapse and the backend 
server using a tool like TCPMon.

Thanks,
Hiranya

On Nov 25, 2014, at 2:31 PM, Vishvjit Khalipe <[email protected]> wrote:

> Hello,
> 
> I have defined a proxy for REST API and trying to redirect requests to
> swagger documentation using a sequence. So I have following config in main
> sequence -
> * <sequence xmlns="http://ws.apache.org/ns/synapse
> <http://ws.apache.org/ns/synapse>" name="main" statistics="enable"> <in>
> <property name="REST_URL_POSTFIX" action="remove" scope="axis2" /> <log
> level="full"/> <switch source="get-property('To')"> <case
> regex="/rest/api/api-docs/"> <log level="custom"> <property name="api_doc"
> value="Redirecting to API DOCS"/> </log> <send> <endpoint> <address
> uri="https://api-hostname/api/api-docs/
> <https://api-hostname/api/api-docs/>" format="get" /> </endpoint> </send>
> </case> </switch> </in> <out> <property name="messageType"
> value="text/html"/> <send/> </out> </sequence>*
> 
> .However when I hit the URL https://synapse-host:port/rest/api/api-docs/
> following exception is thrown -
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> *2014-11-25 17:28:08,014 [-] [HttpClientWorker-5]  WARN ClientWorker
> Unexpected response received. HTTP response code : 200 HTTP status : OK
> exception : javax.xml.stream.XMLStreamException: DOCTYPE is not
> allowed2014-11-25 17:28:08,014 [-] [HttpClientWorker-5] ERROR
> NativeWorkerPool Uncaught exceptionjava.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMTextImpl cannot be cast to
> org.apache.axiom.om.OMElement        at
> org.apache.synapse.util.MessageHelper.cloneSOAPFault(MessageHelper.java:444)
> at
> org.apache.synapse.util.MessageHelper.cloneSOAPEnvelope(MessageHelper.java:257)
> at
> org.apache.synapse.core.axis2.SOAPUtils.convertSOAP11toSOAP12(SOAPUtils.java:95)
> at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:323)
> at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:160)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
> at
> org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:275)
> at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)*
> How should I configure URL redirection for swagger api docs ? Thank you in
> advance for your help.
> 
> -- 
> Regards,
>  Vish

--
Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;  http://cs.ucsb.edu
E-mail: [email protected];  Mobile: +1 (805) 895-7443
Blog: http://techfeast-hiranya.blogspot.com

Reply via email to