Search code examples
ibm-mobilefirstmobilefirst-adapters

How do I invoke a MobileFirst Platform Adapter using PUT?


This is similar to the question asked here, but that question was not exactly answered to what the problem is.

Customer.xml

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="Customer"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.ibm.com/mfp/integration"
    xmlns:http="http://www.ibm.com/mfp/integration/http">

    <displayName>Customer</displayName>
    <description>Customer</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>kenatibm.cloudant.com</domain>
            <port>443</port>
        </connectionPolicy>
    </connectivity>

    <procedure name="addCustomer"> </procedure>

</wl:adapter>

Customer-impl.js

function addCustomer(param1) {

    var input = {
        method : 'PUT',
        returnedContentType : 'json',
        path : 'userInputRequired',
        body : {
            contentType: 'application/json',
            content : param1
        }
    };

    return WL.Server.invokeHttp(input);
}

The issue is that even though I have defined the method as a PUT, when testing using File Run As | Call MobileFirst Adapter the user interface only displays a GET method, there is no option for PUT.

So is the answer that the GET will actually do a PUT or is this a bug or is there a configuration parameter that I am missing?

enter image description here


Solution

  • I think you are confusing how you invoke/test the adapter, with what verb it uses on the back-end system it is calling. You are testing/invoking it using GET, but the adapter is then calling your backend system - http://kenatibm.cloudant.com/backendsystem - using PUT.

    This is broadly the same explanation as Dave gave in your previous question.