简体   繁体   English

Drupal 7中的Web服务

[英]Web Service in drupal 7

I have a drupal 7 codebase in which a web service is written somewhere, which is being use by external iphone and android base applications, the url of web service in use by external applications is like. 我有一个drupal 7代码库,其中某个地方编写了Web服务,外部iphone和android基本应用程序正在使用该Web服务,外部应用程序正在使用的Web服务的URL就像。 http://example.com/api/module_name/find.json?param1=xxx&param2=xxx http://example.com/api/module_name/find.json?param1=xxx&param2=xxx

I have to modify the above said web service to meet current requirements, but i am enabled to find the code file where web service is written.I have ftp access to the codebase. 我必须修改上述Web服务以满足当前要求,但是可以找到编写Web服务的代码文件。我可以通过ftp访问代码库。 The module being used is services , i need to know where can i found the file in which web service is defined in my drupal 7 file structure. 使用的模块是services ,我需要知道在drupal 7文件结构中可以在哪里找到定义Web服务的文件。

  1. Open module_name.module 打开module_name.module
  2. look for the module_name_services_resources() function 寻找module_name_services_resources()函数
  3. Identify the 'find' resource/action 确定“查找”资源/动作
  4. Take note of the file it purports to be located in (current file if none provided). 记录它声称位于的文件(如果未提供,则为当前文件)。
  5. Take note of the callback property, that's the name of the function used to process that resource. 注意callback属性,这是用于处理该资源的函数的名称。
  6. Find that function either in the file from stage 4, or in the module file itself. 在阶段4的文件中或模块文件本身中找到该功能。
  7. Go nuts. 发疯。

It should be noted that if that isn't a custom module (ie it's a core/contrib one) then you shouldn't be manipulating the files directly. 应该注意的是,如果这不是一个自定义模块(即它是核心/贡献模块),那么您就不应该直接操作文件。

Instead, implement hook_services_resources_alter() in your own module and point the applicable resources to files/callback functions under your control instead. 而是在您自己的模块中实现hook_services_resources_alter() ,并将适用的资源指向在您控制之下的文件/回调函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM