1

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

Community
  • 1
  • 1
Ken Nelson
  • 49
  • 4

2 Answers2

1

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.

Community
  • 1
  • 1
Andrew Ferrier
  • 16,664
  • 13
  • 47
  • 76
  • Then I have two questions. Why call it REST Call Type? And why have the variable at all if it is always going to be a GET? – Ken Nelson Jun 10 '15 at 16:32
  • I agree the labels are confusing. Nevertheless, the fields in this dialog are describing how the adapter is invoked, not how it invokes the back-end service. – Andrew Ferrier Jun 10 '15 at 16:37
1

In short, the answer is that the GET will actually do a PUT.

Parameters are passed to the adapter in a GET request and then the adapter constructs a PUT request to perform the actual procedure. In your code, you can see how the 'param1' is passed by the wizard to the function and then it is set to as the 'content' of the PUT request. It's definitely a little confusing.