How to view soap service data from my browser

时光毁灭记忆、已成空白 提交于 2021-01-28 04:05:51

问题


I'm completely new to how soap services work, please correct me if my understanding is wrong. I would like to pass parameters and call a function from a soap service by typing in a url on my browser (Chrome) and then would like to see the results. I tried searching and following the information from here, but I'm not sure what I'm doing wrong. I have tried the following variations:

http://<servername>/apppath/MyService.asmx?op=GetData?loc=01&status=OPEN

http://<servername>/apppath/MyService.asmx/GetData?loc=01&status=OPEN

This is what I get when I go to the url.

http:/<servername>/apppath/MyService.asmx?op=GetData?

Please help.


回答1:


Maybe you are requesting wrong urls? If you have .asmx in your application - you should be able to see the description page on the url

http://{servername}/{apppath}/MyService.asmx

Of course you should replace {servername} the {apppath} with your values.




回答2:


You have to send an HTTP POST request in order to call your web service GetData.

Your JS code should be something like:

//url should be MyService.asmx/GetData
function callWS(url) {
    var loc = "01";
    var status = "OPEN";

    var options = { error: function(msg) { alert(msg.d); },
                    type: "POST", url: "webmethods.aspx/UpdatePage",
                    data: JSON.stringify({ loc: loc, status: status }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    async: true, 
                    success: function(response) { alert(response); } 
                  }; 

    $.ajax(options);
}



回答3:


So the error was my understanding of SOAP and host to use Postman. In short, I wasn't able to accomplish a SOAP request through the browser. Also, the picture supplied, it showed I was missing 2 things. 1) The SoapAction 2) The parameters were not supplied in the url but rather in the <soap:Body> tag. These were supplied in the POST and I was able to view my results in Postman



来源:https://stackoverflow.com/questions/36065577/how-to-view-soap-service-data-from-my-browser

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