我正在将 IBM worklight 6.1 用于我的移动应用程序项目。我的问题是如何在适配器中发送发布值?
function getUsername(userAlias,locale) {
path = "rest-rib/service/Login/login_username";
var input = {
method : 'post',
returnedContentType : 'json',
path : path
};
return WL.Server.invokeHttp(input);
}
预先非常感谢。
您的问题没有具体说明什么不适合您...请添加更多详细信息。
您还应该阅读有关 HTTP 适配器的内容。
- 培训模块
-
信息中心(向下滚动到invokeHttp)
- 示例项目
More:
- IBM Worklight - 从客户端发送 HTTP POST 请求
- 如何在适配器工作灯中使用纯文本
由于你的问题在细节上很乏味,
下面简单的POST
例子是基于这个POSTW3Schools 的方法示例.
适配器 XML:
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="PostExample"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>PostExample</displayName>
<description>PostExample</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>www.w3schools.com</domain>
<port>80</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="sendParams"/>
</wl:adapter>
适配器实现:
function sendParams() {
path = "tags/demo_form_method_post.asp";
var input = {
method : 'post',
path: path,
parameters: {fname: 'idan', lname: 'adar' }
};
return WL.Server.invokeHttp(input);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)