Question

I'm trying to invoke a rest service from a worklight adapter trough HTTP but I get the following error:

[ERROR   ] FWLSE0035E: Invocation of procedure 'HttpRequest' failed. [project *****]
can't parse argument number 
   "arr": [
      {
         "method": "get"

If I open the URL that I'm invoking into a browser it returns me a json file without problems.

How can I fix it?

Was it helpful?

Solution

Make sure you implement your adapter correctly. This is my sample from my project.

My adapter called Orders.

Orders.xml

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="Orders"
    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>Orders</displayName>
    <description>Orders</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>izify.com</domain>
            <port>443</port>            
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>
<procedure name="getOrders"> </procedure>
</wl:adapter>

Orders-impl.js

function getOrders() {

    var input = {
        method : 'get',
        returnedContentType : 'json',
        path : "get_all_orders.php",
        parameters:{merchantId:"xxxxxxxxxxxxxxxxx"}
    };


    return WL.Server.invokeHttp(input);
}

If you still not understand what is about, you can read the documentation regarding to HTTP adapter here.

http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/04_02_HTTP_adapter_-_Communicating_with_HTTP_back-end_systems.pdf

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top