Click here to Skip to main content
15,892,927 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: vb2010os dev Pin
Dave Kreskowiak4-Jun-12 4:08
mveDave Kreskowiak4-Jun-12 4:08 
AnswerRe: vb2010os dev Pin
Paul Conrad4-Jun-12 6:47
professionalPaul Conrad4-Jun-12 6:47 
AnswerRe: vb2010os dev Pin
Luc Pattyn4-Jun-12 7:12
sitebuilderLuc Pattyn4-Jun-12 7:12 
AnswerRe: vb2010os dev Pin
Paul Conrad4-Jun-12 7:16
professionalPaul Conrad4-Jun-12 7:16 
AnswerRe: vb2010os dev Pin
Bert Mitton5-Jun-12 8:00
professionalBert Mitton5-Jun-12 8:00 
QuestionPosting a XML String to a Web Service via VB.NET VS2010 Pin
Member 77438051-Jun-12 12:06
Member 77438051-Jun-12 12:06 
AnswerRe: Posting a XML String to a Web Service via VB.NET VS2010 Pin
Paul Conrad2-Jun-12 8:10
professionalPaul Conrad2-Jun-12 8:10 
AnswerRe: Posting a XML String to a Web Service via VB.NET VS2010 Pin
David Mujica4-Jun-12 3:32
David Mujica4-Jun-12 3:32 
Maybe this will help ...

I've cut & Pasted some of the relevant code and had to make a few changes to obfuscate the server and other proprietary business logic.

I'm very new to the webservice arena so this might not be the best way to implement it, but it is working for me.

The idea is that a salesman can make a webService request for a Product price quote.

VB
sURL = "http://myServer/myApp/TQWebService.asmx?op=CreateQuoteRequest"
  WRequest = WebRequest.Create(sURL)
  WRequest.Method = "POST"

  WRequest.Credentials = System.Net.CredentialCache.DefaultCredentials

  SOAPdata = BuildSoapTQRequest(Salesman, ProductCode)

  WRequest.ContentType = "application/soap+xml; charset=utf-8"
  WRequest.ContentLength = SOAPdata.Length

  postStream = WRequest.GetRequestStream()
  postStream.Write(SOAPdata, 0, SOAPdata.Length)
  postStream.Close()

  Try
    WResponse = WRequest.GetResponse()
    responseStream = WResponse.GetResponseStream
    Dim sr As New StreamReader(responseStream)

    xDoc.LoadXml(sr.ReadToEnd)




Private Function BuildSoapTQRequest(ByVal ReqID As String, ByVal ProductCode as String) As Byte()

        Dim sb As New StringBuilder

        sb.Append("<soap12:Envelope xmlns:xsi=" + Chr(34) + "http://www.w3.org/2001/XMLSchema-instance" + Chr(34) + " xmlns:xsd=" + Chr(34) + "http://www.w3.org/2001/XMLSchema" + Chr(34) + " xmlns:soap12=" + Chr(34) + "http://www.w3.org/2003/05/soap-envelope" + Chr(34) + "> ")
        sb.Append(System.Environment.NewLine)
        sb.Append("<soap12:Body> " + System.Environment.NewLine)
        sb.Append("<CreateQuoteRequest xmlns=" + Chr(34) + "http://myServer/" + Chr(34) + "> " + System.Environment.NewLine)
        sb.Append("<myRequestorID>" + ReqID + "</myRequestorID>" + System.Environment.NewLine)
        sb.Append("<myProductCode>" + ProductCode + "</myProductCode>" + System.Environment.NewLine)
        sb.Append("</CreateQuoteRequest> " + System.Environment.NewLine)
        sb.Append("</soap12:Body> " + System.Environment.NewLine)
        sb.Append("</soap12:Envelope> " + System.Environment.NewLine)

        Return Encoding.ASCII.GetBytes(sb.ToString)

    End Function

QuestionStructure passing problem Pin
Bret Stern31-May-12 10:23
Bret Stern31-May-12 10:23 
AnswerRe: Structure passing problem Pin
David Mujica31-May-12 10:58
David Mujica31-May-12 10:58 
GeneralRe: Structure passing problem Pin
Bret Stern31-May-12 12:36
Bret Stern31-May-12 12:36 
AnswerRe: Structure passing problem Pin
Dave Doknjas31-May-12 11:25
Dave Doknjas31-May-12 11:25 
GeneralRe: Structure passing problem Pin
Bret Stern31-May-12 12:39
Bret Stern31-May-12 12:39 
GeneralRe: Structure passing problem Pin
Dave Doknjas31-May-12 13:01
Dave Doknjas31-May-12 13:01 
QuestionPlugin Manager Pin
Member 819828330-May-12 4:52
Member 819828330-May-12 4:52 
AnswerRe: Plugin Manager Pin
Wayne Gaylard30-May-12 5:20
professionalWayne Gaylard30-May-12 5:20 
GeneralRe: Plugin Manager Pin
Member 819828330-May-12 9:03
Member 819828330-May-12 9:03 
AnswerRe: Plugin Manager Pin
Dave Kreskowiak30-May-12 5:21
mveDave Kreskowiak30-May-12 5:21 
QuestionUnhandled exception Pin
digibat29-May-12 17:59
digibat29-May-12 17:59 
AnswerRe: Unhandled exception Pin
digibat29-May-12 20:07
digibat29-May-12 20:07 
AnswerRe: Unhandled exception Pin
Paul Conrad4-Jun-12 7:18
professionalPaul Conrad4-Jun-12 7:18 
QuestionSuper Trojan with source code made in vb.net Pin
mustoyildiz29-May-12 3:37
mustoyildiz29-May-12 3:37 
AnswerVoted to remove Pin
Dave Kreskowiak29-May-12 3:48
mveDave Kreskowiak29-May-12 3:48 
AnswerRe: Super Trojan with source code made in vb.net Pin
Eddy Vluggen29-May-12 4:11
professionalEddy Vluggen29-May-12 4:11 
Questionanybody has usable code sending attachment with winsock?Thanks! Pin
vb6fan28-May-12 19:04
vb6fan28-May-12 19:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.