400 Error calling WCF web service from Ripple emulator

余生颓废 提交于 2019-12-12 06:12:52

问题


I tried to bring an old phonegap 1.0 app into VS tool for Apache Cardova. It calls an old WCF XML web service. When I ran the app in Ripple Emulator using local proxy, I got 400 error from the WCF web service. After some digging around, I found the problem in C:\Users\user_name\AppData\Roaming\npm\node_modules\vs-mda\node_modules\ripple-emulator\lib\server\proxy.js line 85-91:

if (Object.keys(req.body).length > 0) {
    if (req.is("json")) {
        proxyReqData.body = JSON.stringify(req.body);
    } else {
        proxyReqData.form = req.body;
    }
}

If the request is not json, the code would change it to a form so that an XML web service is not supported by the Ripple proxy. I fixed the code at the place, but it was not picked up by the project build. I also do not have a good way to debug my version of proxy.js. Any suggestion would be appreciated.


回答1:


I figured out the fix myself. The proxy.js that I found is the right location. However, I had to make several changes to proxy.js to make it work with a soap web service. Note that my changes works when you only call soap web services.

  1. Comment out the line with app.use(express.bodyParser()); and replace with it with raw parser in this post: Expressjs raw body

  2. Replace the code block in my question with just:

    proxyReqData.form = req.body;



来源:https://stackoverflow.com/questions/29222701/400-error-calling-wcf-web-service-from-ripple-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!