0

I am a newbiee to IBM Mobile First. I was trying to send a multi-part request using MobileFirst HTTP Adapter. But after googling, I came to know that it is not possible in MFP JavaScript Adapter (constructing a multipart form request in a adapter using MobileFirst version 6.3). But, since, this question is not specifying anything about MFP v8.0, so it let me to again search for help on Internet, but I failed to get any working solution. So, my questions are:

  1. Is it possible to create multi-part request from adapters with WL.Server.invokeHttp() function on adapter side?

  2. If yes, then please guide me with the process with which I can send multi-part request from IBM server to my actual server; and if no, please tell the ways with which I can send multi-part request from IBM server to my actual server (since API I am hitting needs data to be in multi-part format)?

IBM must have provided some way to make multi-part request from Adapters, to the extent I think.

Explanations with answer will be more appreciated as it would help to take brief look into this topic.

Community
  • 1
  • 1
  • Which MobileFirst version are you working on ? – Gaurab Kumar Apr 06 '17 at 21:11
  • I am using MFP v8.0. – Mayank Bhootra Apr 07 '17 at 05:19
  • So you're not asking about an adapter *accepting* multi-part requests, you're asking about an adapter having code that *calls* another service that accepts multi-part requests, correct? And your adapter is (or can be) Java? I doubt you'll be able to do it from a Javascript adapter. – dbreaux Apr 07 '17 at 05:27
  • yes, am not asking about adaptors accepting multi-part request. Actually I want to send multipart request from adaptor itself. The flow is like this: 1. Server API requires data to be in multi-part/form-data. 2. So for this, from my javascript file, I converted all parameters to form data object using FormData() and passed that object to procedure in adapter from my cordova application. 3. At adapter end, I assigned that variable (containing form data object) to variable named 'content' in body object before invoking http request. – Mayank Bhootra Apr 07 '17 at 06:31

1 Answers1

2

Is it possible to create multi-part request from adapters with WL.Server.invokeHttp() function on adapter side?

No, this is not possible in MFP using Javascript adapter

However like Idan explained in constructing a multipart form request in a adapter using MobileFirst version 6.3 , you can send multi-part data by adding the logic in your Java adapter code.

Refer to: How can I make a multipart/form-data POST request using Java? " .

Community
  • 1
  • 1
  • Thanks Kavitha for your time. But the question is asking specifically about v8.0, not any other version. I have already research on those version but I need to know about v8.0 only. Please provide your help for this version only. Thanks again – Mayank Bhootra Apr 07 '17 at 12:09
  • It is no different in MFP 80 as well . You need to use MFP 80 Java adapters – Vivin K Apr 10 '17 at 10:05
  • Thanks Vivin for your response. I would request you to please give a detailed help regarding how can I use Java Adapters regarding constructing http multipart request from adapters to actual server, retaining IBM analytics with adaptors using Java only since I am unable to get any help regarding IBM Mobile First (may be due to less support for IBM Mobile First online). Thanks again – Mayank Bhootra Apr 10 '17 at 12:21