0
我使用retrofit作为我的web通信接口,针对包含在worpress网站中的php webservice发出一些问题 - 在WP网站中调用其中一个JSON API方法时,出现SSL异常我的android客户端,即使我运行在http而不是https。在改造中获取SSL异常
这里是我的代码 -
public class RestApi {
private static final String API_URL = "https://tmc.co.nf/api";
private SmokeTalkRest service;
interface SmokeTalkRest {
@FormUrlEncoded
@POST("/get_nonce")
void getNonce(@Field("controller") String controller, @Field("method") String method, Callback<String> callback);
}
public RestApi() {
// Create a very simple REST adapter which points the GitHub API
// endpoint.
RestAdapter restAdapter = new RestAdapter.Builder()
.setServer(API_URL).build();
// Create an instance of our GitHub API interface.
service = restAdapter.create(SmokeTalkRest.class);
}
public void getNonceForMethod(Method method, Callback<String> callback) {
service.getNonce("user", method.name(), callback);
}
}
的get现时是在点击一个按钮叫,也已经有人撞到了吗?
那么现在我做的完全一样使用回调来设置一些文本视图与返回的答案,我仍然得到运行在UI线程异常 – crazyPixel
我会建议提供更多的代码和一些有关您目前在做什么的更多信息。还附加logcat,以便我们可以过滤出问题可能是什么。 –
嗨kalel, 我设法最终解决这个问题,但是我现在得到一个SSL异常,即使服务器运行在http上而不是在https上 - 任何想法? 我编辑了我的问题并添加了一些代码。 – crazyPixel