【问题标题】:IBM Worklight 6.1 - How to send post values in adapter?IBM Worklight 6.1 - 如何在适配器中发送帖子值?
【发布时间】:2014-01-09 08:22:19
【问题描述】:

我将 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);
}

非常感谢。

【问题讨论】:

  • 有什么特别的东西不起作用...?您的问题不完整。

标签: ibm-mobilefirst worklight-adapters


【解决方案1】:

您的问题没有说明什么不适合您...请添加更多详细信息。

您还应该阅读有关 HTTP 适配器的信息。

更多:


由于您的问题在细节上非常枯燥,
以下简单的POST 示例基于此POST method example from W3C Schools

适配器 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);
}

【讨论】:

    猜你喜欢
    • 2014-01-28
    • 1970-01-01
    • 2016-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多