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.
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?
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.
Frinavale 9,735
Recognized Expert Moderator Expert
Have you declared a variable that can be used as "proxy" to the web service?
sample code -
Dim strEnvelope As String
-
Dim request As New MSXML.XMLHTTPRequest
-
Dim strReturn As String
-
Dim objReturn As New MSXML.DOMDocument
-
Dim strQuery As String
-
-
-
-
Private Sub btnAcct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResidentAcct.Click
-
-
strEnvelope = "POST /Account/Account.asmx HTTP/1.1 " & _
-
"Host: 1.1.1.1" & _
-
"Content-Type: text/xml; charset=utf-8" & _
-
"Content(655) : length()" & _
-
"SOAPAction: ""http://www.account.net/Account/Account""" & _
-
"<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/"">" & _
-
" <soap:Body>" & _
-
"<Account xmlns=""http:// www.account.net/Account "">" & _
-
-
"</Account>" & _
-
"</soap:Body>" & _
-
"</soap:Envelope>"
-
-
-
'Set up to post to our localhost server
-
request.open("post", "http:// www.account.net/Account ")
-
request.setRequestHeader("Content-Type", "text/xml")
-
request.setRequestHeader("Account", "http://www.account.net/Account/Account")
-
request.send(strEnvelope)
-
strReturn = request.responsetext
-
objReturn.loadXML(strReturn)
-
-
strQuery = "SOAP:Envelope/SOAP:Body/m:AccountResponse/Account"
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
Thank you. I will check it out.
Thanks that helped a lot. Although I do have a question. Here is my code so far - Private Sub btnAccount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccount.Click
-
Dim node As Xml.XmlNode
-
Dim strConnect As String
-
Dim wsAccount As New Account() //proxy
-
strConnect = wsAccount.TestWebServiceConnection()
-
txtboxConnectStatus.Text = strConnect
-
node = wsAccount.Account("0e7e6123-af7b-4e5e-a845-c6b0caf52
-
"", "", "1", "XML", "DOW", "JOHN", "9999")
-
txtboxResults.Text = node.ToString()
-
End Sub
Now per the web service I am expecting a response like - HTTP/1.1 200 OK
-
Content-Type: text/xml; charset=utf-8
-
Content-Length: length
-
-
<?xml version="1.0" encoding="utf-8"?>
-
<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/">
-
<soap:Body>
-
<Response xmlns="http://www.account.net/Account">
-
<Result>xml</Result>
-
</Response>
-
</soap:Body>
-
</soap:Envelope>
But in my text box it returns System.Xml.XmlE lement.
Any suggestions
Frinavale 9,735
Recognized Expert Moderator Expert
Try using: - txtboxResults.Text = node.InnerText()
Let me know how it goes :)
-Frinny
Works thanks. I must repay you for your time. So here are 1 million smooches!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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>
|
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...
|
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...
|
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...
|
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,
| |
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...
|
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
|
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>
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |