Hi, I happened to come across a similar scenario when writing a jaggery test case. What i did was i wrote the whole curl message send by the browser when uploading a multipart/form-data. You can find the code at [1].
[1]. https://github.com/NipunaMarcus/product-jaggery/blob/version-update/modules/integration/tests-integration/src/test/resources/request.jag Problem with sending a form-data as multipart is that it's not adding the boundary to each content included in the request. In web-apps for testing we can user new FormData() object to create a fake form data submission. But in your case try this way. Hope this is helpful. Thank you. On Tue, Dec 8, 2015 at 4:41 PM, Keerthika Mahendralingam <keerth...@wso2.com > wrote: > Hi All, > > When we try to upload the file using multipart/form-data the header is set > as *Content-Type: multipart/form-data; charset=UTF-8; > boundary=MIMEBoundary_9e11cd10389246e6cd91ff115cb91b2666f41fd50a407413. * > > Because of charset=UTF-8 we are getting the error. I tried to remove that > by setting Content-Type header as *multipart/form-data. *But in that case > MIMEBoundary is not getting added. And also I tried by removing the > Content-Type but unable to remove the Content-Type header. > > How to remove charset from header? > > Thanks, > > On Tue, Dec 8, 2015 at 2:54 PM, Thusitha Thilina Dayaratne < > thusit...@wso2.com> wrote: > >> Hi All, >> >> I was able to post a photo to a page using photoUrl parameter. But when >> I'm trying to upload a image with multipart/form-data I'm getting same >> error. >> {"error":{"message":"(#324) Requires upload file","type":"OAuthException", >> "code":324,"fbtrace_id":"BgISg8XM9PN"}} >> >> Can someone help to figure out wWhat is the issue here? >> >> Thanks >> >> On Tue, Dec 8, 2015 at 10:37 AM, Thusitha Thilina Dayaratne < >> thusit...@wso2.com> wrote: >> >>> Hi, >>> >>> I'm trying to post a photo to a FB page via the facebook connector using >>> ESB 4.9.0. I added the proxy in[1] >>> I'm sending following request through the postman rest client >>> >>>> POST /services/multipart?pageId=562960547187253 HTTP/1.1 >>>> Host: 10.100.7.26:8280 >>>> Action: urn:addPhotoToPage >>>> Cache-Control: no-cache >>>> Postman-Token: b24c8c4d-8823-37a3-9f7e-0b7242dd2c1c >>>> Content-Type: multipart/form-data; >>>> boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW >>>> ----WebKitFormBoundary7MA4YWxkTrZu0gW >>>> Content-Disposition: form-data; name="source"; filename="images.jpg" >>>> Content-Type: image/jpeg >>>> >>>> ----WebKitFormBoundary7MA4YWxkTrZu0gW >>>> Content-Disposition: form-data; name="access_token" >>>> >>>> CAANXsShua0kBANHccTVW8peal7dn8kBSZApjm2OWsoYNfyix5WmUZAJxR6Wdi7OB49aKZBCmWpVlzQi1IcF04kulGzseMQEFV0JFCMO7CEOV2dRBfoZCc2icOCZAEoWSFwv4kR1EZBZBrYEy61BR1wzf7Iy5kmizhKV8pc9irjVrkFbWZA8noKZBWDKYdjpaBstUZA0o2aE1n30NnT4YN9vk1f >>>> ----WebKitFormBoundary7MA4YWxkTrZu0gW >>> >>> >>> But I'm always getting the below exception >>> >>>> {"error":{"message":"(#324) Requires upload >>>> file","type":"OAuthException","code":324,"fbtrace_id":"BgISg8XM9PN"}} >>> >>> >>> Am I missing something here? I tried with url parameter as well. But I'm >>> getting same error with that as well. >>> >>> [1] - >>> https://github.com/wso2/esb-connectors/blob/master/facebook/facebook-connector/facebook-connector-1.0.0/org.wso2.carbon.connector/src/test/resources/artifacts/ESB/config/proxies/facebook/multipart.xml >>> >>> Thanks >>> -- >>> Thusitha Dayaratne >>> Software Engineer >>> WSO2 Inc. - lean . enterprise . middleware | wso2.com >>> >>> Mobile +94712756809 >>> Blog alokayasoya.blogspot.com >>> About http://about.me/thusithathilina >>> >>> >> >> >> -- >> Thusitha Dayaratne >> Software Engineer >> WSO2 Inc. - lean . enterprise . middleware | wso2.com >> >> Mobile +94712756809 >> Blog alokayasoya.blogspot.com >> About http://about.me/thusithathilina >> >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > <dev-requ...@wso2.org> > Keerthika Mahendralingam > Associate Software Engineer > Mobile :+94 (0) 776 121144 > keerth...@wso2.com > WSO2, Inc. > lean . enterprise . middleware > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Nipuna Marcus *Software Engineer* WSO2 Inc. http://wso2.com/ - "lean . enterprise . middleware" Mobile : +94 (0) 713 667906 nipu...@wso2.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev