简体   繁体   English

asp.net mvc发布到asmx Web服务

[英]asp.net mvc post to asmx web service

I apologize if this is a stupid question. 如果这是一个愚蠢的问题,我深表歉意。

In my MVC application I have to contact an external ASMX web service. 在我的MVC应用程序中,我必须联系外部ASMX Web服务。 I haven't found the info I need to get this done. 我没有找到完成此操作所需的信息。 I want to make a HTTP POST request to the web service, I have the URL and I know the Content-Type should be application/x-www-urlencoded . 我想向Web服务发出HTTP POST请求,我有URL并且我知道Content-Type应该是application/x-www-urlencoded

I am supposed to provide two parameters, SSN and PASSWORD . 我应该提供两个参数, SSNPASSWORD The response is XML that I have to walk through and get into objects. 响应是我必须遍历并进入对象的XML

Does it matter if I do this inside a controller or not? 是否在控制器内执行此操作是否重要?

Can anyone provide an example of how to: 1. create the request, 2. walk through an XML response 任何人都可以提供以下示例:1.创建请求,2.遍历XML响应

Add a servicereference in your project to the external asmx service and call it through your controller method. 在您的项目中将服务引用添加到外部asmx服务,然后通过控制器方法调用它。 Here is a good example of consuming webservices 是使用Web服务的一个很好的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM