0

i have a application from which i need to construct a multipart form in a HTTP adapter and send it to webservice using WL.Server.invokeHttp. is there a way by which i can achieve this?.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89

1 Answers1

1

JavaScript adapters do not support multi-part.

You have two options:

  1. In MFPF 6.3, use Java in JavaScript adapters
  2. Upgrade to MFPF 7.0, which now provides Java adapters

You can then try to implement the following (or similar for your specific use case): How can I make a multipart/form-data POST request using Java?

If the form post is not directed at a backend protected by Worklight's security framework, then you could also opt to not use adapters at all: Sending multipart/formdata with jQuery.ajax

Community
  • 1
  • 1
Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • i followed the steps as mention in the first link. the following is my adater code : function addTwoIntegers(a,b){ return { result: com.worklight.customcode.Calculator1.addTwoIntegers(a,b) }; } function subtractTwoIntegers(a,b){ var calcInstance = new com.worklight.customcode.Calculator1(); return { result : calcInstance.subtractTwoIntegers(a,b) }; } i am getting the following error on invoking the adapter. "Ecma Error: TypeError: Cannot call property addTwoIntegers in object [JavaPackage com.worklight.customcode.Calculator1]. It is not a function, it is \"object\". – yashwanth balaji Apr 28 '15 at 05:47