473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pass array via SOAP from asp page to dotnet webservice

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


Nov 23 '05 #1
10 9331
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in
news:u0**************@TK2MSFTNGP15.phx.gbl:
[WebMethod]
public string AcceptArray(object[] parameters)
{
return "no error!!!";
}


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
Nov 23 '05 #2
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in
news:u0**************@TK2MSFTNGP15.phx.gbl:
[WebMethod]
public string AcceptArray(object[] parameters)
{
return "no error!!!";
}


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
Nov 23 '05 #3
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

Nov 23 '05 #4
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

Nov 23 '05 #5
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in news:unIFSXCaFHA.3976
@TK2MSFTNGP15.phx.gbl:
I know that string will work, but I really want to pass an *array*. Any
ideas?


I dont think arrays are serializable off hand. Use a collection instead, but
make sure its typed to a string.
--
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
Nov 23 '05 #6
"Jon Maz" <jo****@surfeu.de.no.spam> wrote in news:unIFSXCaFHA.3976
@TK2MSFTNGP15.phx.gbl:
I know that string will work, but I really want to pass an *array*. Any
ideas?


I dont think arrays are serializable off hand. Use a collection instead, but
make sure its typed to a string.
--
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
Nov 23 '05 #7
Hi Chad,

Nice idea, but unfortunately not applicable to this scenario... Remember,
I'm going FROM classic asp (the web page calling the webservice via SOAP) TO
dotnet (the .asmx). In classic asp (AFAIK) all I *have* is simple arrays,
and there is no typing at all.

I assumed this must be a simple thing to do, but I've been searching the net
for days and haven't come up with a solution yet...

:-(

JON

Nov 23 '05 #8
Hi Chad,

Nice idea, but unfortunately not applicable to this scenario... Remember,
I'm going FROM classic asp (the web page calling the webservice via SOAP) TO
dotnet (the .asmx). In classic asp (AFAIK) all I *have* is simple arrays,
and there is no typing at all.

I assumed this must be a simple thing to do, but I've been searching the net
for days and haven't come up with a solution yet...

:-(

JON

Nov 23 '05 #9
Hi All,

Well, some progress. Have defeated the evil error message, but don't quite
understand how/why:

ASP PAGE
<%@ Language="JScript" %>
<%
var mySoapClient = Server.CreateObject("MSSOAP.SoapClient30");
mySoapClient.ClientProperty("ServerHTTPRequest") = true;

var myArray = new Array(0);
myArray[0] = "hallo";
myArray[1] = "goodbye";

var myArrayTwo = new Array(0);
myArrayTwo[0] = "nuts";
myArrayTwo[1] = "squirrel";

mySoapClient.MSSoapInit("http://mywebservice/test.asmx?wsdl");
var answer = mySoapClient.AcceptArray(myArray, myArrayTwo);
Response.Write(answer);

//tidy up
mySoapClient = null;
%>

WEB SERVICE
[WebMethod]
public string AcceptArray(string myArray, string myArrayTwo)
{
return myArray + " ????? " + myArrayTwo;
}
and I get this:

hallo,goodbye ????? nuts,squirrel

In other words, the classic asp array is being converted (god knows where)
into a comma-delimited string!

Can anyone explain??

TIA,

JON


Nov 23 '05 #10
Hi All,

Well, some progress. Have defeated the evil error message, but don't quite
understand how/why:

ASP PAGE
<%@ Language="JScript" %>
<%
var mySoapClient = Server.CreateObject("MSSOAP.SoapClient30");
mySoapClient.ClientProperty("ServerHTTPRequest") = true;

var myArray = new Array(0);
myArray[0] = "hallo";
myArray[1] = "goodbye";

var myArrayTwo = new Array(0);
myArrayTwo[0] = "nuts";
myArrayTwo[1] = "squirrel";

mySoapClient.MSSoapInit("http://mywebservice/test.asmx?wsdl");
var answer = mySoapClient.AcceptArray(myArray, myArrayTwo);
Response.Write(answer);

//tidy up
mySoapClient = null;
%>

WEB SERVICE
[WebMethod]
public string AcceptArray(string myArray, string myArrayTwo)
{
return myArray + " ????? " + myArrayTwo;
}
and I get this:

hallo,goodbye ????? nuts,squirrel

In other words, the classic asp array is being converted (god knows where)
into a comma-delimited string!

Can anyone explain??

TIA,

JON


Nov 23 '05 #11

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

Similar topics

5
by: John | last post by:
I would like to pass array variables between URLs but I don't know how. I know its possible with sessions, but sessions can become useless if cookies are disabled. I have unsuccessfully tried...
1
by: Joe | last post by:
I have 3 servers server1: http://server1/login.asp, http://server1/page1.as server2: http://server2/login.asp, http://server2/page1.as server3: http://server3/login.asp, http://server3/page1.as ...
5
by: wilson | last post by:
Dear all, In this time, I want to pass array to function. What should I declare the parameter in the function?i int array or int array? Which one is correct? ...
4
by: Sai | last post by:
I am new to this area,please bear with me for this basic question. :) I have an xml schema file xyz.xsd file with me,That contains request and response xml schema ,how can I proceed to create a...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
6
by: Wijaya Edward | last post by:
Hi, How can I pass Array, Hash, and a plain variable in to a function at the same time. I come from Perl. Where as you probably know it is done like this: sub myfunc {
0
by: Jagdish | last post by:
Hello, Every body I have recently joined this group and I want to know how to pass Array of string to a Com object function.. Actually I want to pass String array from VB6 to Com Interface...
4
by: igotyourdotnet | last post by:
Is there a way to pass data from page to page without the use of a Session Variable or queryString? I need to pass drop down box selections from page to page and have the drop downs on the page be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.