Search code examples
javascriptxmlibm-mobilefirstworklight-adapters

IBM Worklight - Adapter deployment failed: Adapter 'BIIOwnAccountFundTransferAdapter.xml' contains errors


I got this error when I try to deploy my worklight adapter. I already clean up my code and check my syntax, no error at all.

error message inside console

[2014-07-21 12:04:22]             Starting adapter deployment on Worklight Server 
[2014-07-21 12:04:22]             Starting build of adapter: BIIOwnAccountFundTransferAdapter.xml 
[2014-07-21 12:04:22]             Adapter deployment failed: Adapter 'BIIOwnAccountFundTransferAdapter.xml' contains errors 

my xml code

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed Materials - Property of IBM
    5725-I43 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
    US Government Users Restricted Rights - Use, duplication or
    disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<wl:adapter name="BIIOwnAccountFundTransferAdapter"
    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>BIIOwnAccountFundTransferAdapter</displayName>
    <description>BIIOwnAccountFundTransferAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>xxx.xxx.xx.xx</domain>
            <port>9083</port>
            <!-- Following properties used by adapter's key manager for choosing specific certificate from key store  
            <sslCertificateAlias></sslCertificateAlias> 
            <sslCertificatePassword></sslCertificatePassword>
            -->     
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>

    <procedure name="processTransferDetails"/>
    <procedure name="proceedOwnTransferConfirm"/>
    <procedure name="proceedOwnTransferResult"/>

</wl:adapter>

My js code

function processTransferDetails(userId) {
    path = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    var input = {
        method: 'post',
        returnedContentType: 'json',
        path: path,
        body: {
            contentType: 'application/json; charset=UTF-8',
            content: JSON.stringify({
                "locale": "en",
                "userId": userId,
                "serviceInfoType": "FUNOWN"
            })
        }
    };
    return WL.Server.invokeHttp(input);
}

function proceedOwnTransferConfirm(userAlias, password, toCurrency, toAmount,
    fromCurrency, selectedCurrency, payMode) {
    path = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    var input = {
        method: 'post',
        returnedContentType: 'json',
        path: path,
        body: {
            contentType: 'application/json; charset=UTF-8',
            content: JSON.stringify({
                "locale": "en",
                "serviceInfoName": "Transfer Own Account",
                "fromAccountNumber": fromAccountNumber,
                "toAccountNumber": toAccountNumber,
                "toCurrency": toCurrency,
                "toAmount": toAmount,
                "fromCurrency": fromCurrency,
                "sessionId": "20140703104656008130",
                "selectedCurrency": selectedCurrency,
                "isTacRequired": false,
                "isStandingInstruction": false,
                "payMode": payMode
            })
        }
    };
    return WL.Server.invokeHttp(input);
}

function proceedOwnTransferResult(userAlias, remoteIPAddress) {
    path = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    var input = {
        method: 'post',
        returnedContentType: 'json',
        path: path,
        body: {
            contentType: 'application/json; charset=UTF-8',
            content: JSON.stringify({
                "userAlias": userAlias,
                "locale": "en",
                "channel": "2",
                "userAgent": "mobile",
                "remoteIPAddress": remoteIPAddress,
                "sessionId": "",
            })
        }
    };
    return WL.Server.invokeHttp(input);
}

Please advice


Solution

  • I did not have any build/compiling issues with your adapter (copy-paste into an empty project).

    I have personally experienced Worklight Studio (as well as other Eclipse plugins) getting into an inconsistent state for no apparent reason. When that happens I usually try to delete the contents of the <workspace>/<project>/bin directory, then I try to build apps and adapters again.

    If that doesn't help, the last resort usually is to delete the build temporary files:

    1. Close Studio
    2. Locate your temp folder (Windows, OS X)
    3. Delete the wlBuildResources folder
    4. Re-open Studio and try to build apps and adapters again