我已在WSO2AM
发布了API,商店中显示的网址为https://{ip}:8243/phoneverify/1.0.0
现在我要做的是从ESB代理服务(稍后将由调度程序调用)调用此代码,如下所示,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="a"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<send>
<endpoint>
<http method="get"
uri-template="https://{ip}:8243/phoneverify/1.0.0/CheckPhoneNumber">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
</http>
<property name="Authorization"
value="Bearer aaa4663b5851e06f2f1bc6e871fd20b7"
scope="axis2"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
</target>
<description/>
</proxy>
但是当我尝试这个时,它会在服务器中提供org.apache.axis2.AxisFault: Read timed out
[2015-03-20 08:50:48,481] INFO - LogMediator To: /services/a.aHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:ce224d0e-f158-458c-b0be-ffeb09198e47, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope>
[2015-03-20 08:50:48,500] INFO - TimeoutHandler This engine will expire all callbacks after : 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2015-03-20 08:50:49,289] ERROR - TargetHandler I/O error: Host name verification failed for host : {ip}
javax.net.ssl.SSLException: Host name verification failed for host : 52.74.66.119
at org.apache.synapse.transport.http.conn.ClientSSLSetupHandler.verify(ClientSSLSetupHandler.java:152)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:285)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:380)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:118)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:160)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:342)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:320)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:280)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:604)
at java.lang.Thread.run(Unknown Source)
[2015-03-20 08:50:49,320] WARN - EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed
[2015-03-20 08:50:49,320] WARN - EndpointContext Suspending endpoint : AnonymousEndpoint - current suspend duration is : 30000ms - Next retry after : Fri Mar 20 08:51:19 UTC 2015
我可以使用Chrome Advanced Rest Client
调用API。因此,我通过代理服务调用了什么?
答案 0 :(得分:0)
如果您的API需要REST / JSon消息,则在您的代理(WSO2 ESB)中,您应该在<property name="messageType" value="application/json" scope="axis2" type="STRING"/>
之前添加<send>
。
如果您的API需要REST / XML,请使用application/xml
。
问候。
答案 1 :(得分:0)
对于&#34;主机名称验证失败,主机&#34;例外,请尝试wso2.org/jira/browse/APIMANAGER-2089中建议的配置
此外,在您的代理服务中,您必须使用标头介体来设置授权标头。
<header name="Authorization" value="xxxxxx" scope="transport"/>