我正在尝试使用Basic authentication type
从WSO2 ESB 4.9调用第三方rest API。我已尝试在标题中使用不同的属性和授权。在WSO2 ESB中是否需要启用任何配置?谁能帮我吗?我收到以下错误:
TID: [-1234] [] [2016-03-20 20:44:37,746] ERROR {org.apache.synapse.mediators.base.SequenceMediator} - Error while building message {org.apache.synapse.mediators.base.SequenceMediator}
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.base.SequenceMediator.mediate(SequenceMediator.java:261)
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:744)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'N' (code 78) 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.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:65)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:158)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
... 13 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'N' (code 78) 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)
... 21 more
从SOAP UI一切正常。
我的ProxyCode:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestSecureAPI"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log separator="==== Before Call ===="/>
<property name="Authorization"
value="Basic API Encoded UserName/Password"
scope="transport"
type="STRING"/>
<header name="Accept" scope="transport" value="application/json"/>
<property name="Content-Type"
value="application/json"
scope="default"
type="STRING"/>
<property name="x-tenant-domain"
value="test.nl"
scope="transport"
type="STRING"/>
<call>
<endpoint>
<http method="GET"
uri-template="http://myapi.com/rest/iam/portalusers/search/hordine"/>
</endpoint>
</call>
<log level="full" separator="==== After Call ===="/>
</inSequence>
</target>
<description/>
</proxy>
答案 0 :(得分:0)
您在代理
中定义了无效的属性检查以下属性
<property name="Authorization"
value="Basic "API Encoded UserName/Password"
scope="transport"
type="STRING"/>
无效的属性删除&#34;登录("Basic "API EncodedUserName/Password"
)并尝试保存代理。