thank for you reply,
yes i run my code successfully on the sandbox,but i can't get the
data form the response,
the result of the obj.text and obj.data =="" ,that is why i think i
have a error,
so how can i get the data from the response, and i use the makerequest
wrong?
or makerequest can't post data (cross-domain );
i request the webservice on a html ,and use the ajax method, that get
the data successfully
my html code :
<body>
<script type="text/javascript">
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (err) {
xmlhttp = null;
}
}
if(!this.xmlhttp && typeof XMLHttpRequest != "undefined") xmlhttp =
new XMLHttpRequest();
if (this.xmlhttp){ alert("success");}
function test(){
var data;
data = '<?xml version="1.0" encoding="utf-8"?>';
data = data + '<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/">';
data = data + '<soap:Body>';
data = data + '<IdentityCard xmlns="http://webservice.jaron.cn/">';
data = data + '<IdentityCardID>330226</IdentityCardID>';
data = data + '<LicenceKey>111</LicenceKey>';
data = data + '</IdentityCard>';
data = data + '</soap:Body>';
data = data + '</soap:Envelope>';
var URL="http://webservice.jaron.cn/default.asmx?op=IdentityCard";
try {
xmlhttp.Open("POST",URL, true);
xmlhttp.onreadystatechange=loginStatusProc;
xmlhttp.SetRequestHeader ("Content-Type","text/xml; charset=utf-8");
xmlhttp.SetRequestHeader ("SOAPAction","http://webservice.jaron.cn/
IdentityCard");
xmlhttp.Send(data);
} catch (e) { alert("catch");}
}
function loginStatusProc(){
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
alert(xmlhttp.responseText);
} else if (xmlhttp.status == 500){
alert(xmlhttp.status);
} else {alert(xmlhttp.readyState);} }} </script><input
type=button value="test" onclick="test()"/>
</body>
On Aug 27, 6:33 am, "Jerome (Guru)" <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> As long as you are on the iGoogle sandbox, not in the production
> environment, your code should run ok, and you should see your alert()
> popups. As you are most likely aware, the Gadget 0.7 API is not yet
> available on the iGoogle production platform.
>
> If you are on the sandbox, please send the error you are getting for
> other developers review. I just tried your code, and this ran
> successfully for me.
>
> Jerome
>
> On Aug 26, 5:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi all
> > i hava a gadget which need to connect a webservice (like
> > urlhttp://webservice.jaron.cn/default.asmx?op=IdentityCard)
>
> > i use the post ContentType ,but has a error;
> > My code :
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <Module>
> > <ModulePrefs title="post" height="100" >
> > </ModulePrefs>
> > <Content type="html">
> > <![CDATA[
> > <script type="text/javascript">
> > function test(){
> > var data;data = '<?xml version="1.0" encoding="utf-8"?>';
> > data = data + '<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/">';
> > data = data + '<soap:Body>';
> > data = data + '<IdentityCard xmlns="http://webservice.jaron.cn/">';
> > data = data + '<IdentityCardID>330226</IdentityCardID>';
> > data = data + '<LicenceKey>111</LicenceKey>';
> > data = data + '</IdentityCard>';
> > data = data + '</soap:Body>';
> > data = data + '</soap:Envelope>';
> > var params = {};
> > //data=gadgets.io.encodeValues(data);
> > alert(data);
> > params[gadgets.io.RequestParameters.CONTENT_TYPE]=gadgets.io.ContentType.DOM;
> > params[gadgets.io.RequestParameters.METHOD]=gadgets.io.MethodType.POST;
> > params[gadgets.io.RequestParameters.HEADERS]={"SOAPAction":"http://
> > webservice.jaron.cn/IdentityCard"};
> > params[gadgets.io.RequestParameters.POST_DATA]=data;
> > var URL="http://webservice.jaron.cn/default.asmx?op=IdentityCard";
> > gadgets.io.makeRequest(URL, response, params);}
>
> > function response(obj){
> > alert("errors"+obj.errors);
> > alert("data"+obj.data);
> > alert("text "+obj.text);
> > alert("oauthErrorText "+obj.oauthErrorText); } </script><input
> > type=button value="test" onclick="test()"/>]]></Content></Module>
>
> > may i employed an application proxy ?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---