Click here to Skip to main content
15,902,276 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.

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


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

>
Posted

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

VB
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[^]
 
Share this answer
 
Comments
SIFNOk 2-Feb-11 10:29am    
Really is it that simple!?

Thank You So Much! =D

So do i really need to now about the request and reponse section?
Prerak Patel 2-Feb-11 10:33am    
Yes, it is simple as that, but for your knowledge it is definitely worth knowing how that works.
SIFNOk 2-Feb-11 11:57am    
Hi Prerak im getting an error "An endpoint configuration section for contract 'SMSLIB32.LodgeSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name."

Private Sub SMSREQUEST()
Dim pwd As String
Dim user As String
Dim nmb As String
Dim message As String

XXXXXX Dim lsms As New Refer1.LodgeSoapClient XXXXXXXXXXXXXXXXXXXXX
lsms.Open()
lsms.LodgeSMSMessage(user, pwd, nmb, message) lsms.Close()
End Sub

Hope you could assist, what is the endpoint configuration of T =S
Prerak Patel 2-Feb-11 13:32pm    
Sorry, I'm at home. but this will help http://social.msdn.microsoft.com/Forums/pl-PL/wcf/thread/59039123-68c3-4031-9cfe-3cc7e3692650

Googling an error should be the first step when confused. :)
SIFNOk 3-Feb-11 1:50am    
Thanks for that Prerak :)
after reading the article, i released i had to specify the Enpoint name from the App.conf =)

Thanks for all your help and guidance!
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!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900