我无法在wso2 ei和wso2 esb中呼叫第三方休息api(https://api.github.com/users/hackeryou)。 以下是示例代码:
<api xmlns="http://ws.apache.org/ns/synapse" name="VerifyCustID" context="/mambu">
<resource methods="GET" uri-template="/verify">
<inSequence>
<log>
<property name="CustID API" value="*********Inside CustID API********** "/>
</log>
<send>
<endpoint>
<http method="GET" uri-template="https://api.github.com/users/hackeryou"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>
以下是服务器日志中的错误:
ID API = *********Inside CustID API**********
[2017-07-14 15:01:48,756] [] WARN - ConnectCallback Connection refused or failed for : api.github.com/192.30.253.116:443
[2017-07-14 15:01:48,759] [] WARN - EndpointContext Endpoint : AnonymousEndpoint with address https://api.github.com/users/hackeryou will be marked S
USPENDED as it failed
[2017-07-14 15:01:48,760] [] WARN - EndpointContext Suspending endpoint : AnonymousEndpoint with address https://api.github.com/users/hackeryou - cur
rent suspend duration is : 30000ms - Next retry after : Fri Jul 14 15:02:18 IST 2017
[2017-07-14 15:01:48,772] [] INFO - LogMediator To: https://api.github.com/users/hackeryou, MessageID: urn:uuid:7b834e0e-e348-4b60-adeb-f60a70f00483,
Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 101503, ERROR_MESSAGE = Error connecting to the back end, Envelope: <?
xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
答案 0 :(得分:1)
您可能会遇到first_name = serializers.CharField(max_length=30)
last_name = serializers.CharField(max_length=30)
name = serializers.CharField(max_length=30)
password = serializers.CharField(max_length=20, style={'input_type': 'password'})
class Meta:
model = User
fields = ('id', 'url', 'first_name', 'last_name', 'name', 'username', 'email', 'password',
'total_exp_year', 'total_exp_month', 'voteup_count', 'is_featured',
'is_active', 'headline', 'description', 'profile_picture', )
def create(self, validated_data):
password = validated_data.pop('password', None)
instance = self.Meta.model(**validated_data)
if password is not None:
instance.set_password(password)
instance.save()
return instance
(可能是防火墙等)的网络连接问题
API在EI611上运行良好:
如果您没有使用WSO2附带的默认信任库(api.github.com:443
)或对其进行了更改,那么可能需要导入证书for client-truststore.jks
进入您的WSO2服务器实际使用的信任库。
除了信任存储中的网络连接和缺少证书,无法看到为什么您的API无法调用远程服务