使用MSXML2.HTTP调用webservice [英] webservice call using MSXML2.HTTP

查看:200
本文介绍了使用MSXML2.HTTP调用webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎可以肯定我可以使用HTTP Post / Get来提交XML Web服务

调用(通过SSL,如果使用MSXML2的第3版)来自ASP

申请?


但是,我是否只能以异步模式调用web服务

(带回调函数)?如果是这样,怎么样?

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?

推荐答案

嗨Patrick,

ServerXMLHTTP和XMLHTTP对象提供两种类型的调用模式:

异步和同步。该模式由公开呼叫的第三个输入

参数控制;默认情况下,它是同步模式。在

异步模式下,当readyState

属性发生更改时,MSXML解析器会触发一个事件。您可以检查ReadyState和ReadyState。在销毁对象之前对象的属性

。例如:

==================================
< br $>
var XmlHttp;


XmlHttp =新的ActiveXObject(" Msxml2.XMLHTTP");


XmlHttp.onreadystatechange = doHttpReadyStateChange;


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


XmlHttp.send();


函数doHttpReadyStateChange()


{if(XmlHttp.readyState == 4)


{alert(" Done));


}


}

Luke

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.onreadystatechange = doHttpReadyStateChange;

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

XmlHttp.send();

function doHttpReadyStateChange()

{ if (XmlHttp.readyState == 4)

{ alert("Done");

}

}

Luke


我不知道是否可以使用MSXML.HTTP进行WebService调用

使用类似下面描述的内容(在VBScript ASP

环境中):
http://msdn.microsoft.com/workshop/a...useservice.asp
< a rel =nofollowhref =http://msdn.microsoft.com/workshop/author/webservice/reference/methods/callservice.asptarget =_ blank> http://msdn.microsoft.com/workshop /a...allservice.asp


我之前在DHTML / JavaScript客户端环境中做过这件事,但想知道

会不会如果在服务器ASP / VBScript环境中使用,则会出现任何问题。


" [MSFT]" <卢****** @ online.microsoft.com>在消息中写道

news:kf ************** @ cpmsftngxa10.phx.gbl ...
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******@online.microsoft.com> wrote in message
news:kf**************@cpmsftngxa10.phx.gbl...
嗨Patrick,

ServerXMLHTTP和XMLHTTP对象提供两种类型的调用模式:异步和同步。该模式由打开调用的第三个输入参数控制;默认情况下,它是同步模式。在异步模式下,当readyState
属性更改时,MSXML解析器将触发事件。您可以检查ReadyState和ReadyState。在销毁对象之前
对象的属性。例如:

==================================

var XmlHttp;

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

XmlHttp.onreadystatechange = doHttpReadyStateChange;

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

XmlHttp.send();

函数doHttpReadyStateChange()

{if(XmlHttp.readyState == 4)

{alert(" Done");

}

}

卢克
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.onreadystatechange = doHttpReadyStateChange;

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

XmlHttp.send();

function doHttpReadyStateChange()

{ if (XmlHttp.readyState == 4)

{ alert("Done");

}

}

Luke



它不起作用!


我试过......,但是如何从ASP

* Server *环境中引用文档对象?


<%@ Language ="的VBScript" %>

<%Response.Buffer = True%>


< html>

< head>


< title>网络服务测试< / title>


< body topmargin =" 3" LEFTMARGIN = QUOT; 3英寸MARGINHEIGHT =" 0" marginwidth =" 0"

bgcolor =" #FFFFFF"

link ="#000066"的Vlink = QUOT;#000000" ALINK = QUOT;#0000FF" text ="#000000">

< div id =" divService" class =" webservice"

style =" behavior:url(webservice.htc)">< / div>

test

<%

document.all(" divService")。useService

" http://localhost/webservice/test.asmx" ;,&&HelloWorld" ;

%>

< / body>

< / html>
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="#FFFFFF"
link="#000066" vlink="#000000" alink="#0000FF" text="#000000">
<div id="divService" class="webservice"
style="behavior:url(webservice.htc)"></div>
test
<%
document.all("divService").useService
"http://localhost/webservice/test.asmx","HelloWorld"
%>
</body>
</html>


这篇关于使用MSXML2.HTTP调用webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆