473,706 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DotNet WS from VB6 with MSXML2.XMLHTTP

I'm trying to consume a WS from Excel (Office 98), seems that I can't
send arguments into the WS. In order to pinpoint the problem I've
written the following application i C# and VB6. It reproduces exaclty
the same problem with less code. Any hints on how to solve this would be
greatly appreciated. /Regards Björn

The webservice is:

using System;
using System.Web.Serv ices;

[WebService(Name space="http://tempuri.org/")]
public class DotNetWS : WebService {
[WebMethod]
public string ReturnArgument( string Argument) {
return Argument;
//return "We can't get Argument into WS!";
}
}

And this is the client:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String

Set mhttp = New MSXML2.XMLHTTP
mhttp.open "Post", "http://localhost/DotNetWS/DotNetWS.asmx", False
mhttp.setReques tHeader "Content-Type", "text/xml; charset=utf-8"
mhttp.setReques tHeader "SoapAction ",
"http://tempuri.org/ReturnArgument"

s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"

mhttp.send s
MsgBox mhttp.responseT ext
End Sub
Nov 21 '05 #1
3 11297
Hi Björn,
I was able to make it work with a few adjustments. You'll need to change the
URL and the namespaces that are for my system:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String
Set mhttp = CreateObject("M SXML2.XMLHTTP")
mhttp.Open _
"POST", "http://p4320/p4320work/args.asmx", False, "", ""
mhttp.setReques tHeader "SOAPAction ", _
"http://tempuri.org/p4320work/args/ReturnArgument"
mhttp.setReques tHeader "Content-Type", "text/xml"
s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org/p4320work/args"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"
mhttp.send s
Debug.Print mhttp.responseT ext
End Sub
"BjörnHolmb erg" <bj************ ************@su litelma.com> wrote in message
news:40******** *******@sulitel ma.com...
I'm trying to consume a WS from Excel (Office 98), seems that I can't
send arguments into the WS. In order to pinpoint the problem I've
written the following application i C# and VB6. It reproduces exaclty
the same problem with less code. Any hints on how to solve this would be
greatly appreciated. /Regards Björn

The webservice is:

using System;
using System.Web.Serv ices;

[WebService(Name space="http://tempuri.org/")]
public class DotNetWS : WebService {
[WebMethod]
public string ReturnArgument( string Argument) {
return Argument;
//return "We can't get Argument into WS!";
}
}

And this is the client:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String

Set mhttp = New MSXML2.XMLHTTP
mhttp.open "Post", "http://localhost/DotNetWS/DotNetWS.asmx", False
mhttp.setReques tHeader "Content-Type", "text/xml; charset=utf-8"
mhttp.setReques tHeader "SoapAction ",
"http://tempuri.org/ReturnArgument"

s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"

mhttp.send s
MsgBox mhttp.responseT ext
End Sub


Nov 21 '05 #2
Hello Ken! I've found the problem, it was a trailing slash in the namespace declaration of WS, that
was not in the <ReturnArgument >-element of client. A bunch of thanks to You, without your reply I
would still be out in the (be-)wilderness. /Björn

"Ken Cox [Microsoft MVP]" wrote:
Hi Björn,
I was able to make it work with a few adjustments. You'll need to change the
URL and the namespaces that are for my system:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String
Set mhttp = CreateObject("M SXML2.XMLHTTP")
mhttp.Open _
"POST", "http://p4320/p4320work/args.asmx", False, "", ""
mhttp.setReques tHeader "SOAPAction ", _
"http://tempuri.org/p4320work/args/ReturnArgument"
mhttp.setReques tHeader "Content-Type", "text/xml"
s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org/p4320work/args"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"
mhttp.send s
Debug.Print mhttp.responseT ext
End Sub

"BjörnHolmb erg" <bj************ ************@su litelma.com> wrote in message
news:40******** *******@sulitel ma.com...
I'm trying to consume a WS from Excel (Office 98), seems that I can't
send arguments into the WS. In order to pinpoint the problem I've
written the following application i C# and VB6. It reproduces exaclty
the same problem with less code. Any hints on how to solve this would be
greatly appreciated. /Regards Björn

The webservice is:

using System;
using System.Web.Serv ices;

[WebService(Name space="http://tempuri.org/")]
public class DotNetWS : WebService {
[WebMethod]
public string ReturnArgument( string Argument) {
return Argument;
//return "We can't get Argument into WS!";
}
}

And this is the client:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String

Set mhttp = New MSXML2.XMLHTTP
mhttp.open "Post", "http://localhost/DotNetWS/DotNetWS.asmx", False
mhttp.setReques tHeader "Content-Type", "text/xml; charset=utf-8"
mhttp.setReques tHeader "SoapAction ",
"http://tempuri.org/ReturnArgument"

s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"

mhttp.send s
MsgBox mhttp.responseT ext
End Sub


Nov 21 '05 #3
Hi Björn,

Glad to hear you're running again!

Why don't computers tell us when we're missing something simple - or better
yet, just fix it? <grin>

Ken

"BjörnHolmb erg" <bj************ *************** **@sulitelma.co m> wrote in
message news:40******** *******@sulitel ma.com...
Hello Ken! I've found the problem, it was a trailing slash in the
namespace declaration of WS, that
was not in the <ReturnArgument >-element of client. A bunch of thanks to
You, without your reply I
would still be out in the (be-)wilderness. /Björn

"Ken Cox [Microsoft MVP]" wrote:
Hi Björn,
I was able to make it work with a few adjustments. You'll need to change
the
URL and the namespaces that are for my system:

Private Sub Command1_Click( )
Dim mhttp As MSXML2.XMLHTTP
Dim s As String
Set mhttp = CreateObject("M SXML2.XMLHTTP")
mhttp.Open _
"POST", "http://p4320/p4320work/args.asmx", False, "", ""
mhttp.setReques tHeader "SOAPAction ", _
"http://tempuri.org/p4320work/args/ReturnArgument"
mhttp.setReques tHeader "Content-Type", "text/xml"
s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
s = s & "<soap:Enve lope
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
s = s & "<soap:Body >"
s = s & "<ReturnArgumen t xmlns=""http://tempuri.org/p4320work/args"">"
s = s & "<Argument> Easy go, easy come back?</Argument>"
s = s & "</ReturnArgument> "
s = s & "</soap:Body>"
s = s & "</soap:Envelope>"
mhttp.send s
Debug.Print mhttp.responseT ext
End Sub

"BjörnHolmb erg" <bj************ ************@su litelma.com> wrote in
message
news:40******** *******@sulitel ma.com...
> I'm trying to consume a WS from Excel (Office 98), seems that I can't
> send arguments into the WS. In order to pinpoint the problem I've
> written the following application i C# and VB6. It reproduces exaclty
> the same problem with less code. Any hints on how to solve this would
> be
> greatly appreciated. /Regards Björn
>
> The webservice is:
>
> using System;
> using System.Web.Serv ices;
>
> [WebService(Name space="http://tempuri.org/")]
> public class DotNetWS : WebService {
> [WebMethod]
> public string ReturnArgument( string Argument) {
> return Argument;
> //return "We can't get Argument into WS!";
> }
> }
>
> And this is the client:
>
> Private Sub Command1_Click( )
> Dim mhttp As MSXML2.XMLHTTP
> Dim s As String
>
> Set mhttp = New MSXML2.XMLHTTP
> mhttp.open "Post", "http://localhost/DotNetWS/DotNetWS.asmx", False
> mhttp.setReques tHeader "Content-Type", "text/xml; charset=utf-8"
> mhttp.setReques tHeader "SoapAction ",
> "http://tempuri.org/ReturnArgument"
>
> s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>"
> s = s & "<soap:Enve lope
> xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance"" "
> s = s & "xmlns:xsd=""ht tp://www.w3.org/2001/XMLSchema"" "
> s = s & "xmlns:soap=""h ttp://schemas.xmlsoap .org/soap/envelope/"">"
> s = s & "<soap:Body >"
> s = s & "<ReturnArgumen t xmlns=""http://tempuri.org"">"
> s = s & "<Argument> Easy go, easy come back?</Argument>"
> s = s & "</ReturnArgument> "
> s = s & "</soap:Body>"
> s = s & "</soap:Envelope>"
>
> mhttp.send s
> MsgBox mhttp.responseT ext
> End Sub
>
>


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12450
by: Dan Sikorsky | last post by:
Uploading from browser to server using Msxml2.XMLHTTP takes a long time about 15 minutes for a 1.5MB file at 37.2Kbps, although it does get there. Is there anyway to speed things up? here's the code ... var sFilename = (document.form1.myFileName.value); // create ADO-stream Object var ado_stream = new ActiveXObject("ADODB.Stream"); // create XML document with default header and primary node
17
14789
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call web-service in a an asynchronous mode (with a callback function)? If so, how?
5
11013
by: RK | last post by:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am sending XML string over Msxml2.XMLHTTP object. I am sending data in POST, also passing querystring variable and here is the code. Also error comes only sometimes. var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.Send(xmldoc);
2
21803
by: Michael Christensen | last post by:
Hi How do I send an input-param to my web service with MSXML2.ServerXMLHTTP? Can this be done without the soap-toolkit? Can't find anything about it - looking forward getting some help :-) ------------- Function GetLatest() Dim url, xmlhttp, XMLDOM, XMLNode
1
6584
by: Raúl Martín | last post by:
I´ve a function in asp that run correctly but If I tried to change it forasp.net in asp: xmlHTTP = CreateObject("Microsoft.XMLHTTP") And I thought to use this sentence for asp.net but the server don´t response right. xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
2
8751
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking binary code; code not accessible). I send XML requests to it. If my request is accepted, ServerXMLHTTP returns XML with accept details. If my request is rejected, ServerXMLHTTP returns XML with reject details.
5
3785
by: Brent | last post by:
This AJAX stuff is all new to me. To try it out, I borrowed this code from a website: ======================== var http_request = false; function makeRequest(url) { http_request = false;
2
11308
by: noOby | last post by:
Hi developers, currently i'm doing a school project and i am stuck on MSXML2.XMLHTTP conversion from vb code to c#. Below is the vb Coding that i need to convert to C# Dim sUrl As String Dim xHttp As MSXML2.XMLHTTP
2
19227
by: Dave | last post by:
I am running the following code and I get an error: Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0") xmlHttp.Open "Get", URLToRSS, false xmlHttp.Send RSSXML = xmlHttp.ResponseText The error is: msxml3.dll error '800c0005'
0
9285
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...
0
9155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
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...
0
7906
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6614
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
4448
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
4709
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.