473,545 Members | 1,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

webservice call using MSXML2.HTTP

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?

Jul 19 '05 #1
17 14763
Hi Patrick,

ServerXMLHTTP and XMLHTTP objects provide two types of calling mode:
asynchronous and synchronous. The mode is controlled by the third input
parameter to the open call; by default, it is synchronous mode. In
asynchronous mode, the MSXML parser fires an event when the readyState
property changes. You may check for the "ReadyState " property of the object
before destroying the object. For example:
=============== =============== ====

var XmlHttp;

XmlHttp = new ActiveXObject(" Msxml2.XMLHTTP" );

XmlHttp.onready statechange = doHttpReadyStat eChange;

XmlHttp.open("G ET", "http://localhost/sample.xml", true);

XmlHttp.send();

function doHttpReadyStat eChange()

{ if (XmlHttp.readyS tate == 4)

{ alert("Done");

}

}

Luke

Jul 19 '05 #2
Rather than using MSXML.HTTP to make a WebService Call, I wonder if I could
use something like what is described at the following (in a VBScript ASP
Environment):
http://msdn.microsoft.com/workshop/a...useservice.asp
http://msdn.microsoft.com/workshop/a...allservice.asp

I had done it before in a DHTML/JavaScript client environment, but wonder if
there would be any issues if used in a server ASP/VBScript environment.

"[MSFT]" <lu******@onlin e.microsoft.com > wrote in message
news:kf******** ******@cpmsftng xa10.phx.gbl...
Hi Patrick,

ServerXMLHTTP and XMLHTTP objects provide two types of calling mode:
asynchronous and synchronous. The mode is controlled by the third input
parameter to the open call; by default, it is synchronous mode. In
asynchronous mode, the MSXML parser fires an event when the readyState
property changes. You may check for the "ReadyState " property of the object before destroying the object. For example:
=============== =============== ====

var XmlHttp;

XmlHttp = new ActiveXObject(" Msxml2.XMLHTTP" );

XmlHttp.onready statechange = doHttpReadyStat eChange;

XmlHttp.open("G ET", "http://localhost/sample.xml", true);

XmlHttp.send();

function doHttpReadyStat eChange()

{ if (XmlHttp.readyS tate == 4)

{ alert("Done");

}

}

Luke

Jul 19 '05 #3
It doesn't work!

I tried..., but how could I reference the document object from an ASP
*Server* environment?

<%@ Language = "VBScript" %>
<% Response.Buffer = True %>

<html>
<head>

<title>Web service test</title>

<body topmargin="3" leftmargin="3" marginheight="0 " marginwidth="0"
bgcolor="#FFFFF F"
link="#000066" vlink="#000000" alink="#0000FF" text="#000000">
<div id="divService " class="webservi ce"
style="behavior :url(webservice .htc)"></div>
test
<%
document.all("d ivService").use Service
"http://localhost/webservice/test.asmx","Hel loWorld"
%>
</body>
</html>
Jul 19 '05 #4
And also, is it possible to use X.509 Authentication with remote
web-services from an ASP application (NOT ASP.NET) application, using either
the MSXML2.HTTP or
webserivce div tag: useService, callService

If so, how could I do that?

With MSXML2.HTTP, just pass in
--------------------start of SOAP Msg with Security--------------------
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<wsse:Securit y
xmlns:wsse="htt p://schemas.xmlsoap .org/ws/2002/12/secext">
<wsse:BinarySec urityToken
ValueType="wsse :X509v3"
EncodingType="w sse:Base64Binar y">
Ea4AHjbs1 ...
</wsse:BinarySecu rityToken>
</wsse:Security>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/WebService/Service1">
<HelloWorldResu lt>string</HelloWorldResul t>
</HelloWorldRespo nse>
</soap:Body>
</soap:Envelope>
--------------------end of SOAP Msg with Security--------------------

instead of
--------------------start of SOAP Msg with NO Security--------------------
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/WebService/Service1">
<HelloWorldResu lt>string</HelloWorldResul t>
</HelloWorldRespo nse>
</soap:Body>
</soap:Envelope>
--------------------end of SOAP Msg with NO Security--------------------

but with the web service div tag approach, no idea of how a X509 client cert
could be passed from the client to the webservice.

"Patrick" <pa**@reply.new sgroup.msn.com> wrote in message
news:uA******** ********@TK2MSF TNGP15.phx.gbl. ..
It doesn't work!

I tried..., but how could I reference the document object from an ASP
*Server* environment?

<%@ Language = "VBScript" %>
<% Response.Buffer = True %>

<html>
<head>

<title>Web service test</title>

<body topmargin="3" leftmargin="3" marginheight="0 " marginwidth="0"
bgcolor="#FFFFF F"
link="#000066" vlink="#000000" alink="#0000FF" text="#000000">
<div id="divService " class="webservi ce"
style="behavior :url(webservice .htc)"></div>
test
<%
document.all("d ivService").use Service
"http://localhost/webservice/test.asmx","Hel loWorld"
%>
</body>
</html>

Jul 19 '05 #5
Also, if I were to use MSXML2.HTTP, how could I generate a SOAP request (as
opposed to an HTTP POST Request)?, or does it not matter, and I simply call
objXmlHttp.setR equestHeader and objXmlHttp.send with different arguments
where objXmlHttp=MSXM L2.ServerXMLHTT P
"Patrick" <pa**@reply.new sgroup.msn.com> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
And also, is it possible to use X.509 Authentication with remote
web-services from an ASP application (NOT ASP.NET) application, using either the MSXML2.HTTP or
webserivce div tag: useService, callService

If so, how could I do that?

With MSXML2.HTTP, just pass in
--------------------start of SOAP Msg with Security--------------------
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<wsse:Securit y
xmlns:wsse="htt p://schemas.xmlsoap .org/ws/2002/12/secext">
<wsse:BinarySec urityToken
ValueType="wsse :X509v3"
EncodingType="w sse:Base64Binar y">
Ea4AHjbs1 ...
</wsse:BinarySecu rityToken>
</wsse:Security>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/WebService/Service1">
<HelloWorldResu lt>string</HelloWorldResul t>
</HelloWorldRespo nse>
</soap:Body>
</soap:Envelope>
--------------------end of SOAP Msg with Security--------------------

instead of
--------------------start of SOAP Msg with NO Security--------------------
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<HelloWorldResp onse xmlns="http://tempuri.org/WebService/Service1">
<HelloWorldResu lt>string</HelloWorldResul t>
</HelloWorldRespo nse>
</soap:Body>
</soap:Envelope>
--------------------end of SOAP Msg with NO Security--------------------

but with the web service div tag approach, no idea of how a X509 client cert could be passed from the client to the webservice.

"Patrick" <pa**@reply.new sgroup.msn.com> wrote in message
news:uA******** ********@TK2MSF TNGP15.phx.gbl. ..
It doesn't work!

I tried..., but how could I reference the document object from an ASP
*Server* environment?

<%@ Language = "VBScript" %>
<% Response.Buffer = True %>

<html>
<head>

<title>Web service test</title>

<body topmargin="3" leftmargin="3" marginheight="0 " marginwidth="0"
bgcolor="#FFFFF F"
link="#000066" vlink="#000000" alink="#0000FF" text="#000000">
<div id="divService " class="webservi ce"
style="behavior :url(webservice .htc)"></div>
test
<%
document.all("d ivService").use Service
"http://localhost/webservice/test.asmx","Hel loWorld"
%>
</body>
</html>


Jul 19 '05 #6
Thanks Luke, but how could I get the web-service to invoke a
Callback-function, which could read in results returned from the
web-service? (NOTE, I want to invoke the webservice from a VBScript based
ASP Page).

I figured out I could use the following to call a web-service with callback
function even with JavaScript, by referencing a <div/> tag that references
webservice.htc (see
http://msdn.microsoft.com/archive/de...ce/default.asp)
http://msdn.microsoft.com/workshop/a...useservice.asp
http://msdn.microsoft.com/workshop/a...allservice.asp

unfortunately, I don't think I can (correct me if I am wrong) use this from
an ASP (Server side) application because:
- how could I reference a client side element (e.g. a <div> tag that
references webserivce.htc) from a server side ASP page?! (I can't even
reference document object from Server side code)!
- webservice.htc does not appear to support X.509 client certificate
authentication.
"[MSFT]" <lu******@onlin e.microsoft.com > wrote in message
news:kf******** ******@cpmsftng xa10.phx.gbl...
Hi Patrick,

ServerXMLHTTP and XMLHTTP objects provide two types of calling mode:
asynchronous and synchronous. The mode is controlled by the third input
parameter to the open call; by default, it is synchronous mode. In
asynchronous mode, the MSXML parser fires an event when the readyState
property changes. You may check for the "ReadyState " property of the object before destroying the object. For example:
=============== =============== ====

var XmlHttp;

XmlHttp = new ActiveXObject(" Msxml2.XMLHTTP" );

XmlHttp.onready statechange = doHttpReadyStat eChange;

XmlHttp.open("G ET", "http://localhost/sample.xml", true);

XmlHttp.send();

function doHttpReadyStat eChange()

{ if (XmlHttp.readyS tate == 4)

{ alert("Done");

}

}

Luke

Jul 19 '05 #7
Hi Patrick,

MSXML doesn't support X.509 certificates. And with MSXML2.HTTP request, we
need to compose the SOAP body manually. If your client application cannot
be .NET based, I suggest you may consider SOAP toolkit to call a web
service. For more information, you can refer to:

http://msdn.microsoft.com/webservices/building/soaptk/

Luke

Jul 19 '05 #8
Hi Patrick,

An HTC is an HTML file that contains script and a set of HTC-specific
elements that define the component. It provides a mechanism to implement
components in script as Dynamic HTML (DHTML) behaviors.It is a client
technology and cannot be used in server side script.

Additionally, Web service cannot call a client function. We have to
implement the call back with XMLHttp's event.

And, you may consider soap toolkit as I suggested in another message.

Luke

Jul 19 '05 #9
I have downloaded the SOAP Toolkit 3.0. You said MSXML does not support
WS-Security's authentication using X.509 certificates.

Presumably, using SOAP Client dll, I would just have to set
objSoapClient.C onnectorPropert y.SSLClientCert ificateName and
objSoapClient.C onnectorPropert yUseSSL to use X.509 Authentication.

Am I right or not in thinking that to implement X.509 certificate
authentication with Web Services, the client simply need to send in
something like the following, and as such, coulding MSXML2.HTTP do the same
thing?
--------------Start of X.509 Client authentication? ???--------------
<wsse:Securit y
xmlns:wsse="htt p://schemas.xmlsoap .org/ws/2002/12/secext">
<wsse:BinarySec urityToken
ValueType="wsse :X509v3"
EncodingType="w sse:Base64Binar y">
Ea4AHjbs1 ...
</wsse:BinarySecu rityToken>
</wsse:Security>
--------------End of X.509 Client authentication? ???--------------

Additionally, the examples from the SOAP Toolkit 3.0 (some of which are at
http://msdn.microsoft.com/library/de...tml/xpsoap.asp)
seems to indicate calling webservice in a "Synchronou s" mode, as opposed to
an asynchronous mode with a Callback function? Could this be done with the
SOAP Client? If so, how?

"[MSFT]" <lu******@onlin e.microsoft.com > wrote in message
news:Dd******** ******@cpmsftng xa10.phx.gbl...
Hi Patrick,

MSXML doesn't support X.509 certificates. And with MSXML2.HTTP request, we
need to compose the SOAP body manually. If your client application cannot
be .NET based, I suggest you may consider SOAP toolkit to call a web
service. For more information, you can refer to:

http://msdn.microsoft.com/webservices/building/soaptk/

Luke

Jul 19 '05 #10

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

Similar topics

19
9293
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not recognise datasets and requires a recordset. Can the datatypes be converted? At the Classic ASP end or .NET end? Can SOAP toolkit provide the...
1
14617
by: ehilario | last post by:
Hello everyone, I am trying to access a webservice to post some values via MSXML2.ServerXMLHttp The OS used is win2003 on both machines. When I access the local machine (A) which has the same service the call works great. When I access the other machine (B) that is on the same subnet, I get a Status of 500.
2
21719
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
0
1098
by: Josh Harris | last post by:
You can copy and paste the following into a .aspx page (change names for your purpose) and it will call a webservice on every 1 minute. I used this piece of code for the purpose of refreshing a datagrid without having to make a postback to the server. <script language="javascript"> function startRefreshDelay() { UpdateGrid(); timer =...
0
1316
by: Chad | last post by:
Hi In vb6 I downloaded multiple pages from a website asynchronously by instantiating a dll 3 times that used an inet control with a doevents on the getchunk method when finished I simply raised the event through the dll. This method allowed control back to the application but more importantly to download more pages not waiting for the page...
2
10684
by: Ramya A | last post by:
Hi All: I have a .NET webservice accepting an XML request document as a parameter How do I call this webservice with ServerXMLHTTP object from my VB6.0 client? I have enabled the HttpPost and HttpGet protocols in the web.config file.
0
1306
by: rakeshkumawat | last post by:
I am facing a problem while reading the result which is loaded in DOMDocument. In which I am sending a request to web service and getting a record of Single Order. This is my VB Code which is i am using.... ........................ Dim Connector As SoapConnector30 ' To connect to webservice Dim Serializer As SoapSerializer30 ...
1
3228
by: magister pips | last post by:
Hello, I have encountered some strange behaviour when using the XMLHTTP Request object in Javascript to return xml from a C# Webservice Method. I create a SOAP envelope and send it off to the Webservice, which I have debug points in, which when hit I can see that all the parameters are coming thru as null. I can't figure out why this is,...
0
886
by: amollokhande1 | last post by:
Hi, I have one xml node containing webservice information. <Webservices> <Webservice id="1" name="WebServiceOfTheDay"> <Messagedata> <Message id="1" method="HTTPPost" contenttype="application/x-www-form-urlencoded" soapaction="" namespaceuri=""...
0
7656
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. ...
0
7807
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...
1
7419
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...
0
7756
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...
0
5971
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...
0
3450
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...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.