At this point I have created a python app-engine endpoint api called paper
(as also noted in the app.yaml
) file. I have placed all the jars, including the …-java-1.13.2-beta-sources.jar
file, in the libs directory of my android project. How do I call one of my web services (aka endpoint methods)? As in I don't know the name of the package that would lead me to the api, which in the python backend is simply class PageApi(remote.Service):
. Imagine the paper
api has a method called countPages(self):
. How would I call the service? I have already tried importing import com.appspot.api.services.[etc]
but eclipse does not see the importing path.
此时我创建了一个名为paper的python app-engine端点api(在app.yaml中也有提到)。我把所有的jar,包括... -java-1.13.2-beta-sources.jar文件放在我的android项目的libs目录中。如何调用我的某个Web服务(也称为端点方法)?因为在我不知道将导致我到api的包的名称,在python后端只是类PageApi(remote.Service):.想象一下,纸质api有一个叫做countPages(self)的方法:我该怎么称呼这项服务?我已经尝试导入导入com.appspot.api.services。[etc]但是eclipse没有看到导入路径。
EDIT:
编辑:
I reload the api. I check that everything looks okay on api explorer. Then I found two packages that seem to be my packages -- except they contain no classes at all.
我重装了api。我检查api explorer上的一切看起来都没问题。然后我找到了两个似乎是我的包的包 - 除了它们根本不包含任何类。
import com.google.api.services.page.*;
import com.google.api.services.page.model.*;
If they are indeed the packages, why would the classes be missing?
如果他们确实是包裹,为什么会缺少课程?
1 个解决方案
#1
0
First. Once you have your projects setup correctly then the same wizard that generated your client library will copy it to your Android project and extra the source files. then you will find the packages you need in the endpoint-libs folders in your project explorer. Take a look at this post for tips on getting that working.
第一。正确设置项目后,生成客户端库的同一向导会将其复制到Android项目并添加源文件。然后,您将在项目资源管理器的endpoint-libs文件夹中找到所需的软件包。看一下这篇文章,了解如何使用它。
Then you invoke an endpoint using Android code like this:
然后使用Android代码调用端点,如下所示:
final HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = new JacksonFactory();
endpointname.Builder builder = new endpointname.Builder( transport, jsonFactory, null );
builder.setApplicationName( appName );
endpointname service = builder.build();
try {
response = service.methodName( parameters ).execute();
} catch (IOException e) {
Log.e(...);
}
#1
0
First. Once you have your projects setup correctly then the same wizard that generated your client library will copy it to your Android project and extra the source files. then you will find the packages you need in the endpoint-libs folders in your project explorer. Take a look at this post for tips on getting that working.
第一。正确设置项目后,生成客户端库的同一向导会将其复制到Android项目并添加源文件。然后,您将在项目资源管理器的endpoint-libs文件夹中找到所需的软件包。看一下这篇文章,了解如何使用它。
Then you invoke an endpoint using Android code like this:
然后使用Android代码调用端点,如下所示:
final HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = new JacksonFactory();
endpointname.Builder builder = new endpointname.Builder( transport, jsonFactory, null );
builder.setApplicationName( appName );
endpointname service = builder.build();
try {
response = service.methodName( parameters ).execute();
} catch (IOException e) {
Log.e(...);
}