通过SOAP从asp页面传递数组到dotnet webservice [英] Pass array via SOAP from asp page to dotnet webservice
问题描述
我正在尝试使用SOAP Toolkit 3.0将数组从asp页面(JScript)传递到dotnet web
服务。这仍然是Hello World阶段,
,你可以看到:
WEB服务方法
[ WebMethod]
公共字符串AcceptArray(object []参数)
{
return" no error !!!" ;;
}
任何人都可以发布一个非常简单的工作示例,说明.asp页面如何传递
数组?下面你可以看到我得到的,错误信息我是
得到:
ASP PAGE
<%@ Language =" JScript" %>
<%
var mySoapClient = Server.CreateObject(" MSSOAP.SoapClient30");
mySoapClient.ClientProperty(" ; ServerHTTPRequest")= true;
var myArray = new Array(0);
myArray [0] =" hallo";
mySoapClient.MSSoapInit(" http://mywebservice/test.asmx?wsdl");
var answer = mySoapClient.AcceptArray(myArray);
Response.Write(回答);
//整理
mySoapClient = null;
%>
错误消息
错误类型:客户端(0x80020005)
客户端:类型转换失败对于元素参数
HRESULT = 0x80020005:
类型不匹配。 - 客户:未指定的客户端错误。
HRESULT = 0x80020005:
TIA
JON
Hi,
I am trying to pass an array from an asp page (JScript) to a dotnet web
service using the SOAP Toolkit 3.0. This is still at the Hello World stage,
as you can see:
WEB SERVICE METHOD
[WebMethod]
public string AcceptArray(object[] parameters)
{
return "no error!!!";
}
Can anyone post a very simple, working example of how the .asp page can pass
the array? Below you can see as far as I got, and the error message I''m
getting:
ASP PAGE
<%@ Language="JScript" %>
<%
var mySoapClient = Server.CreateObject("MSSOAP.SoapClient30");
mySoapClient.ClientProperty("ServerHTTPRequest") = true;
var myArray = new Array(0);
myArray[0] = "hallo";
mySoapClient.MSSoapInit("http://mywebservice/test.asmx?wsdl");
var answer = mySoapClient.AcceptArray(myArray);
Response.Write(answer);
//tidy up
mySoapClient = null;
%>
ERROR MESSAGE
Error Type: Client (0x80020005)
Client:Type conversion failure for element parameters
HRESULT=0x80020005:
Type mismatch. - Client:Unspecified client error.
HRESULT=0x80020005:
TIA
JON
推荐答案
" Jon Maz" <乔**** @ surfeu.de.no.spam>写在
news:u0 ************** @ TK2MSFTNGP15.phx.gbl:
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in
news:u0**************@TK2MSFTNGP15.phx.gbl:
[WebMethod]
公开字符串AcceptArray(object []参数)
{
返回没有错误!!!;
}
[WebMethod]
public string AcceptArray(object[] parameters)
{
return "no error!!!";
}
你只是简单地传递对象。一切都必须是seriliazible和已知的
类型。传递字符串而不是对象。我不确定string []是否会使用
工作,但你可以尝试一下。肯定会发挥作用。
-
Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/
编程是一种反击的艺术形式
博客: http://blogs.atozed.com/kudzu
You cant just simply pass objects. Everything has to be seriliazible and the
type known. Pass strings instead of objects. Im not sure if string[] will
work or not, but you can try it. string for sure will work.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Blog: http://blogs.atozed.com/kudzu
" Jon Maz" <乔**** @ surfeu.de.no.spam>写在
news:u0 ************** @ TK2MSFTNGP15.phx.gbl:
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in
news:u0**************@TK2MSFTNGP15.phx.gbl:
[WebMethod]
公开字符串AcceptArray(object []参数)
{
返回没有错误!!!;
}
[WebMethod]
public string AcceptArray(object[] parameters)
{
return "no error!!!";
}
你只是简单地传递对象。一切都必须是seriliazible和已知的
类型。传递字符串而不是对象。我不确定string []是否会使用
工作,但你可以尝试一下。肯定会发挥作用。
-
Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/
编程是一种反击的艺术形式
博客: http://blogs.atozed.com/kudzu
You cant just simply pass objects. Everything has to be seriliazible and the
type known. Pass strings instead of objects. Im not sure if string[] will
work or not, but you can try it. string for sure will work.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Blog: http://blogs.atozed.com/kudzu
您好,
感谢您的回复。
如下更改为string []不起作用:
[WebMethod]
公共字符串AcceptArray(string []参数)
{
返回没有错误!;
}
与以前相同的错误:
错误类型:客户端(0x80020005)
客户端:元素参数的类型转换失败
HRESULT = 0x80020005:类型不匹配。 - 客户端:未指定的客户端错误。
HRESULT = 0x80020005:类型不匹配。
我知道字符串可以工作,但我真的想传递一个*数组*。任何
想法?
TIA,
JON
Hi,
Thanks for your reply.
Changing to string[] as follows does NOT work:
[WebMethod]
public string AcceptArray(string[] parameters)
{
return "no error!!!";
}
Same error as before:
Error Type: Client (0x80020005)
Client:Type conversion failure for element parameters
HRESULT=0x80020005: Type mismatch. - Client:Unspecified client error.
HRESULT=0x80020005: Type mismatch.
I know that string will work, but I really want to pass an *array*. Any
ideas?
TIA,
JON
这篇关于通过SOAP从asp页面传递数组到dotnet webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!