Ibm mobilefirst 通过HTTP适配器传递参数?

Ibm mobilefirst 通过HTTP适配器传递参数?,ibm-mobilefirst,worklight-adapters,Ibm Mobilefirst,Worklight Adapters,我想在用户注册我的混合应用程序(基于IBM Worklight 6.0)后向其发送电子邮件 我想将用户的参数(电子邮件ID)传递给托管的PHP文件。我尝试直接在URL中发送邮件,如下所示: http://www.xxxyyyzzz.comli.com/email.php?a=someEmailAddress@someEmailHost.com 如何通过Worklight适配器执行相同操作 ADAPTER.XML <wl:adapter name="sendmail" xmlns:xsi

我想在用户注册我的混合应用程序(基于IBM Worklight 6.0)后向其发送电子邮件

我想将用户的参数(电子邮件ID)传递给托管的PHP文件。我尝试直接在URL中发送邮件,如下所示:

http://www.xxxyyyzzz.comli.com/email.php?a=someEmailAddress@someEmailHost.com
如何通过Worklight适配器执行相同操作

ADAPTER.XML

 <wl:adapter name="sendmail"
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>sendmail</displayName>
<description>sendmail</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>xxxyyy.comli.com</domain>
        <port>80</port> 

        <sslCertificateAlias></sslCertificateAlias> 
        <sslCertificatePassword></sslCertificatePassword>
        -->     
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="getStories"/>

<procedure name="getStoriesFiltered"/>

 </wl:adapter>
Your email address: <input type="text" id="emailaddr"/>
<input type="button" onclick="sendEmail()" value="Submit Email Address"/>

参数在哪里?您没有将其传递给适配器过程AFAICT。

试试下面的方法(我没有进行端到端的测试,因为我没有一个带有PHP脚本的服务器来监听请求)。

HTML

 <wl:adapter name="sendmail"
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>sendmail</displayName>
<description>sendmail</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>xxxyyy.comli.com</domain>
        <port>80</port> 

        <sslCertificateAlias></sslCertificateAlias> 
        <sslCertificatePassword></sslCertificatePassword>
        -->     
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="getStories"/>

<procedure name="getStoriesFiltered"/>

 </wl:adapter>
Your email address: <input type="text" id="emailaddr"/>
<input type="button" onclick="sendEmail()" value="Submit Email Address"/>
myAdapter.xml

...
...
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>host-address</domain>
        <port>80</port> 
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="sendEmailProcedure"/>

见相关问题:


我在调用过程中传递了参数。我尝试调用适配器。您的代码段没有显示传递给适配器的任何参数。我尝试使用run as->invoke procedure手动调用适配器过程,并在txt框中传递参数。当您尝试上述操作时?我在引用代码后进行了微小更改后尝试了。。它工作得很好。。
function sendEmailProcedure(emailAddress) {
    var input = {
        method : 'get',
        returnedContentType : 'html',
        path : '/email.php?a=' + emailAddress
    };

    return WL.Server.invokeHttp(input);
}