如何实现“获取" & “发布"通过Windows应用程序进行httprequest或SOAP [英] how to implement a "Get" & "Post" httprequest OR SOAP via windows app

查看:133
本文介绍了如何实现“获取" & “发布"通过Windows应用程序进行httprequest或SOAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我目前正在开发Windows应用程序的项目中,该应用程序能够将SMS发送到smsgateway.但是我之前从未做过任何形式的Web编程,并且为我提供了一个在dotnet中用于发送短信的SOAP Web引用,但是在阅读了无数文章之后,我不确定如何实现SOAP. MSDN,超越我了,所以我最好从基础开始.我的smsgateway的服务提供商为我提供了另一种使用GET& POST方法.

我如何实施以下HTTP Get&在vb.net中发布?

任何帮助或指示,我将不胜感激. :)

HTTP GET-以下是示例HTTP GET请求和响应.显示的占位符需要替换为实际值.

Hi All

I am currently in a project developing a Windows Application that has the ability to send SMS to a smsgateway. But i have never done any sort of web programming before and i have been provide with a SOAP webreference to uses in dotnet to send sms but i am unsure how to implement SOAP, after reading countless articles & MSDN, its beyond me, soo i better start from basics. The service providers of my smsgateway has provided me with an alternative method of using a GET & POST method.

How do i implment the following HTTP Get & post in vb.net?

Any help or pointers, i would be thankful. :)

HTTP GET - The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.

<pre lang="xml"><br />
GET /dotnet/lodge.asmx/LodgeSMSMessage?Username=string&Pwd=string&PhoneNumber=string&PhoneMessage=string HTTP/1.1<br />
Host: ???.???.???.???<br />
HTTP/1.1 200 OK<br />
Content-Type: text/xml; charset=utf-8<br />
Content-Length: length<br />
<?xml version="1.0" encoding="utf-8"?><br />
<string xmlns="http://???.???.???.???u/dotnet">string</string></pre><br />



HTTP POST



HTTP POST

<pre lang="xml">POST /dotnet/lodge.asmx/LodgeSMSMessage HTTP/1.1<br />
Host: ???.???.???.???<br />
Content-Type: application/x-www-form-urlencoded<br />
Content-Length: length<br />
Username=string&Pwd=string&PhoneNumber=string&PhoneMessage=string<br />
HTTP/1.1 200 OK<br />
Content-Type: text/xml; charset=utf-8<br />
Content-Length: length<br />
<?xml version="1.0" encoding="utf-8"?><br />
<string xmlns="http://???.???.???.???/dotnet">string</string</pre><br />
>

推荐答案

您只需将Web参考/服务参考添加到 ^ ],然后可以将该函数作为普通函数调用.

You just have to add web reference/service reference to LodgeSMS[^] and then you can call the function as a normal function.

Dim lsms As New ServiceReference1.LodgeSoapClient
'lsms.Open()
lsms.LodgeSMSMessage("uname", "pwd", "9999888800", "hi, this is the message")
'lsms.Close()





http://www.messagenet.com.au/downloads/MessageNetAPI.pdf [ ^ ]





http://www.messagenet.com.au/downloads/MessageNetAPI.pdf[^]


用于HTTP取得& POST在此处查找示例: http://msdn.microsoft.com/en -us/library/system.net.httpwebrequest.getresponse.aspx [ ^ ]

可以在这里找到不错的SOAP示例: http://www.example-code.com/vbdotnet/http_soap.asp [ ^ ]

希望对您有帮助.

干杯!
For HTTP GET & POST look here for a sample: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.getresponse.aspx[^]

Nice SOAP sample can be found here: http://www.example-code.com/vbdotnet/http_soap.asp[^]

Hope that helps you.

Cheers!


这篇关于如何实现“获取" &amp; “发布"通过Windows应用程序进行httprequest或SOAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆