IBM Worklight 6.1 - 如何在适配器中发送post值? [英] IBM Worklight 6.1 - How to send post values in adapter?

查看:131
本文介绍了IBM Worklight 6.1 - 如何在适配器中发送post值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的移动应用项目使用IBM worklight 6.1。我的问题是如何在适配器中发送帖子值?

I'm using IBM worklight 6.1 for my mobile app project. My question is how to send post values in adapter?

function getUsername(userAlias,locale) {
    path = "rest-rib/service/Login/login_username";

    var input = {
        method : 'post',
        returnedContentType : 'json',
        path : path
    };


    return WL.Server.invokeHttp(input);
}

提前多多谢谢。

推荐答案

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

Your question does not specify what is NOT working for you... please add more details.

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

You should also read about HTTP adapters.

  • Training module
  • Information Center (scroll down to invokeHttp)
  • Sample project

更多:

  • IBM Worklight - Sending HTTP POST request from the client side
  • how to use plain text in adapter worklight

由于你的问题在细节上非常沉闷,

下面简单 POST 示例基于此 POST 方法示例

Since your question is very dull on details,
The below simple POST example is based on this 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);
}

这篇关于IBM Worklight 6.1 - 如何在适配器中发送post值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆