473,659 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

soap request using vb .net

15 New Member
I am new to soap and web services. I want to send an xml soap request to an existing web service created by outside party. how do i go about doing this and viewing the response. any help would be greatly appreciated.
Apr 14 '09 #1
17 56673
Frinavale
9,735 Recognized Expert Moderator Expert
Nice question.

I would have though it would be easy to look up an article on how to consume and use web services but apparently this has changed drastically and can't find a good enough article for you at this time.

What have you done so far?
Apr 14 '09 #2
vlsw
15 New Member
I have been looking all day for something that will do exactly what I need it to do. My search has been unsuccessful either b/c there is no info out there or I am extremely frustrated. Either way.

I have the soap xml created already. I am just having a problem sending it. I have just a simple form with two buttons and a list box. Each button calls a different method on a service (I didn't create service by the way I just want to access two methods) and I want the response to show up in a list box.

i guess my issue is after i create the message how do i send it.
Apr 14 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Have you declared a variable that can be used as "proxy" to the web service?
Apr 14 '09 #4
vlsw
15 New Member
sample code

Expand|Select|Wrap|Line Numbers
  1. Dim strEnvelope As String
  2.     Dim request As New MSXML.XMLHTTPRequest
  3.     Dim strReturn As String
  4.     Dim objReturn As New MSXML.DOMDocument
  5.     Dim strQuery As String
  6.  
  7.  
  8.  
  9.     Private Sub btnAcct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResidentAcct.Click
  10.  
  11.         strEnvelope = "POST /Account/Account.asmx HTTP/1.1 " & _
  12.         "Host: 1.1.1.1" & _
  13.         "Content-Type: text/xml; charset=utf-8" & _
  14.         "Content(655) : length()" & _
  15.         "SOAPAction: ""http://www.account.net/Account/Account""" & _
  16.               "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
  17.           " <soap:Body>" & _
  18.             "<Account xmlns=""http:// www.account.net/Account "">" & _
  19.  
  20.               "</Account>" & _
  21.            "</soap:Body>" & _
  22.          "</soap:Envelope>"
  23.  
  24.  
  25.         'Set up to post to our localhost server
  26.         request.open("post", "http:// www.account.net/Account ")
  27.         request.setRequestHeader("Content-Type", "text/xml")
  28.         request.setRequestHeader("Account", "http://www.account.net/Account/Account")
  29.         request.send(strEnvelope)
  30. strReturn = request.responsetext
  31.   objReturn.loadXML(strReturn)
  32.  
  33.         strQuery = "SOAP:Envelope/SOAP:Body/m:AccountResponse/Account"
Apr 14 '09 #5
Frinavale
9,735 Recognized Expert Moderator Expert
Ok I'm going to recommend you change your implementation to use a proxy class instead of trying to create the soap message by hand.

I've found an article that explains how to do this...sort of. It explains how to consume a web service in an asp.net application, but the same concepts should apply to a windows desktop application as well.

Check out this quick article and let me know if you're having any problems with it.

-Frinny
Apr 15 '09 #6
vlsw
15 New Member
Thank you. I will check it out.
Apr 15 '09 #7
vlsw
15 New Member
Thanks that helped a lot. Although I do have a question. Here is my code so far
Expand|Select|Wrap|Line Numbers
  1.   Private Sub btnAccount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccount.Click
  2.         Dim node As Xml.XmlNode
  3.         Dim strConnect As String
  4.         Dim wsAccount As New Account()  //proxy
  5.         strConnect = wsAccount.TestWebServiceConnection()
  6.         txtboxConnectStatus.Text = strConnect
  7.         node = wsAccount.Account("0e7e6123-af7b-4e5e-a845-c6b0caf52
  8.                      "", "", "1", "XML", "DOW", "JOHN", "9999")
  9.         txtboxResults.Text = node.ToString()
  10.     End Sub
Now per the web service I am expecting a response like

Expand|Select|Wrap|Line Numbers
  1. HTTP/1.1 200 OK
  2. Content-Type: text/xml; charset=utf-8
  3. Content-Length: length
  4.  
  5. <?xml version="1.0" encoding="utf-8"?>
  6. <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  7.   <soap:Body>
  8.     <Response xmlns="http://www.account.net/Account">
  9.       <Result>xml</Result>
  10.     </Response>
  11.   </soap:Body>
  12. </soap:Envelope>
But in my text box it returns System.Xml.XmlE lement.

Any suggestions
Apr 15 '09 #8
Frinavale
9,735 Recognized Expert Moderator Expert
Try using:
Expand|Select|Wrap|Line Numbers
  1.         txtboxResults.Text = node.InnerText()
Let me know how it goes :)

-Frinny
Apr 15 '09 #9
vlsw
15 New Member
Works thanks. I must repay you for your time. So here are 1 million smooches!
Apr 15 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
13854
by: The Grand Admiral | last post by:
Question. I have a wsdl soap request structure as follows: <soap:Envelope xmlns:xsi="..." xmlns:xsd="..." xmlns:soap="..."> <soap:Header>... </soap:Header> <soap:Body> <SaveItem xmlns="..."> <ItemXml>xml</ItemXml> <PropertyView>string</PropertyView>
0
3719
by: ramas | last post by:
Hi, I am new to PHP scripting and i am trying to connect to a soap server (as mentioned below) using the SOAP extension comesup with PHP. Now my requirement is to add my HTTP header fields along with my SOAP request, so that the SOAP server will receive it and does some high level processing. Is it possible to add our own HTTP header fields in PHP? If i use the header() function to add the field into the HTTP header and it neither...
0
1865
by: nitin via DotNetMonster.com | last post by:
Hi I had developed a VB.NET desktop client application which act as a SOAP client. To invoke the web service method I am using MSSOAP(2.0)'s low level interfaces. i.e SoapSerializer,SoapReader and SoapConnector. I am able to invoke the web service method and can show the SOAP response. But I don't know how to get SOAP request using above mentioned low level interfaces. Will some one help out me please ? (I tried SOAPConnector.InputStream...
0
2933
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method but I'm not sure. Below is a water-downed version of the code that I'm working on. While debugging, I noticed that if I pass an invalid SOAP request, the schema validation catches it and throws the error appropriately. However, when I pass in a...
3
7719
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce value for the UserName token. Is it possilbe at all to do this from VBScript (or jscript?)? I know I will be limited with what I can do with the SOAP message. Eg/ can't sign/encrypt it etc. Thanks,
2
3449
by: urs | last post by:
Hello, I want to intercept every request made to a web service in order to be able to display the actual SOAP request in a WebBrowser control (for documentation purposes in a test tool). I know how to do this on the server side (using a SOAPExtension), but I found no way to do this on the client side. I tried to override GetWebRequest and GetWriterForMessage of the SoapHttpClientProtocol class, but couldn't figure out how to actually get...
0
4742
by: Florian Laws | last post by:
Hello, to work around an interoperability problem with the PHP5 SOAP extension, I'd like to modify the generate XML SOAP request. (as described in http://www.schlossnagle.org/~george/blog/index.php?/archives/235-Salesforce.com-and-PHP.html ) To acheive this, I subclass SoapClient and overwrite the __doRequest() method. According to the PHP documentation and the article above, the
1
3043
by: moorcroft | last post by:
I'm sending the following SOAP request to a webservice (I've had to star out some parts of it for privacy purposes): <?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header/><soap-env:Body> <GetAppList xmlns="https://***.***.***.***/***/***.asmx?op=***"> <requestId>1</requestId> <laNumber>5</laNumber> <hashCode>*******</hashCode> </GetAppList>
4
6845
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
Why is it so difficult?!? Ok, Bungie has created an API for their new game, Halo Reach. The API allows you to access details stats and information about the game. There are two endpoints, JSON and SOAP. I figured that since SOAP was already XML that it would be easier to get that file than to translate the JSON into usable data. I think I was wrong. I cannot figure out how to make a SOAP request using C#. When I just use a regular old...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8535
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.