473,569 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web-Services with a Collection of a custom object

Hi there,

I'm trying to consume a web-service that is supposed to return a
collection of a custom object. The web-service was not created with C# or
VS.net. It was created with IBM VisualAge Smalltalk 6. I haven't had
problems consuming other web-services but c# seems to choke with
"Collection " return types.

If you'd like to try to see an example of this problem you can add the
following web-reference to your project:

http://216.18.68.93:9999/CollectionWsInterface.wsdl
(The browser window will say that there are no functions found, but they
are there)
After adding the web-reference and renaming it "CollectionsTes t", I
created a plain vanilla windows app and inserted the following into the
form load event:

CollectionsTest .CollectionWsIn terface ws =
new CollectionsTest .CollectionWsIn terface();

//PsmWsCollection seems to be the return object
//which is supposed to be a collection.
CollectionsTest .PsmWsCollectio n wsCollection;

wsCollection = ws.getCollectio n();

At this point, the debugger halts execution. The first lines of the stack
trace:

-------------------------------
Unhandled Exception: System.InvalidO perationExcepti on: There is an error
in XML document (16, 14). ---> System.InvalidC astException: Cannot assign
object of type WindowsApplicat ion3.Collection sTest.PsmWsResu lt to an
object of type WindowsApplicat ion3.Collection sTest.PsmWsResu lt[].
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.Rea
d1_PsmWsCollect ion()
-------------------------------

Which leads me to believe that the collection is being returned as an
array itself. I'm stuck at this point, how do I cast the return type to
be an array of itself??

If I try the following:

wsCollection = (CollectionsTes t.PsmWsCollecti on[])ws.getCollecti on();

I get a "Cannot convert type" error when compiling.
I tried invoking the getCollection function using "Web Service Studio"
and it chokes on it as well!
If anyone has any clue on what I should do to correct this, I'd
appreciate it!

Thanks!

Jorge
Nov 16 '05 #1
3 2132
hellrazor <jo***@anothe r-world.com> wrote in
news:Xn******** *************** ***********@64. 59.144.76:
Hi there,

I'm trying to consume a web-service that is supposed to return a
collection of a custom object. The web-service was not created with C#
or VS.net. It was created with IBM VisualAge Smalltalk 6. I haven't
had problems consuming other web-services but c# seems to choke with
"Collection " return types.

If you'd like to try to see an example of this problem you can add the
following web-reference to your project:

http://216.18.68.93:9999/CollectionWsInterface.wsdl
(The browser window will say that there are no functions found, but
they are there)
After adding the web-reference and renaming it "CollectionsTes t", I
created a plain vanilla windows app and inserted the following into
the form load event:

CollectionsTest .CollectionWsIn terface ws =
new CollectionsTest .CollectionWsIn terface();

//PsmWsCollection seems to be the return object
//which is supposed to be a collection.
CollectionsTest .PsmWsCollectio n wsCollection;

wsCollection = ws.getCollectio n();

At this point, the debugger halts execution. The first lines of the
stack trace:

-------------------------------
Unhandled Exception: System.InvalidO perationExcepti on: There is an
error in XML document (16, 14). ---> System.InvalidC astException:
Cannot assign object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt to an object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt[].
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.R
ea d1_PsmWsCollect ion()
-------------------------------

Which leads me to believe that the collection is being returned as an
array itself. I'm stuck at this point, how do I cast the return type
to be an array of itself??

If I try the following:

wsCollection = (CollectionsTes t.PsmWsCollecti on[])ws.getCollecti on();

I get a "Cannot convert type" error when compiling.
I tried invoking the getCollection function using "Web Service Studio"
and it chokes on it as well!
If anyone has any clue on what I should do to correct this, I'd
appreciate it!

Thanks!

Jorge


Following up an extra bit of info:

The collection (or array) is supposed to contain three instances of a
custom object called PsmWsResult, which has two variable members: code,
and description.

Thanks!
Nov 16 '05 #2
hellrazor <jo***@anothe r-world.com> wrote in
news:Xn******** *************** **********@207. 46.248.16:
hellrazor <jo***@anothe r-world.com> wrote in
news:Xn******** *************** ***********@64. 59.144.76:
Hi there,

I'm trying to consume a web-service that is supposed to return a
collection of a custom object. The web-service was not created with C#
or VS.net. It was created with IBM VisualAge Smalltalk 6. I haven't
had problems consuming other web-services but c# seems to choke with
"Collection " return types.

If you'd like to try to see an example of this problem you can add the
following web-reference to your project:

http://216.18.68.93:9999/CollectionWsInterface.wsdl
(The browser window will say that there are no functions found, but
they are there)
After adding the web-reference and renaming it "CollectionsTes t", I
created a plain vanilla windows app and inserted the following into
the form load event:

CollectionsTest .CollectionWsIn terface ws =
new CollectionsTest .CollectionWsIn terface();

//PsmWsCollection seems to be the return object
//which is supposed to be a collection.
CollectionsTest .PsmWsCollectio n wsCollection;

wsCollection = ws.getCollectio n();

At this point, the debugger halts execution. The first lines of the
stack trace:

-------------------------------
Unhandled Exception: System.InvalidO perationExcepti on: There is an
error in XML document (16, 14). ---> System.InvalidC astException:
Cannot assign object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt to an object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt[].
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.R ea d1_PsmWsCollect ion()
-------------------------------

Which leads me to believe that the collection is being returned as an
array itself. I'm stuck at this point, how do I cast the return type
to be an array of itself??

If I try the following:

wsCollection = (CollectionsTes t.PsmWsCollecti on[])ws.getCollecti on();

I get a "Cannot convert type" error when compiling.
I tried invoking the getCollection function using "Web Service Studio"
and it chokes on it as well!
If anyone has any clue on what I should do to correct this, I'd
appreciate it!

Thanks!

Jorge


Following up an extra bit of info:

The collection (or array) is supposed to contain three instances of a
custom object called PsmWsResult, which has two variable members: code,
and description.

Thanks!


.... and furthermore yet, this is where the debugger halts:

-------------------------------
[System.Web.Serv ices.Protocols. SoapRpcMethodAt tribute
("http://www.CollectionW sInterface.com/CollectionWsInt erface-
interface/getCollectio" +
"n", RequestNamespac e="urn:Collecti onWsInterface",
ResponseNamespa ce="urn:Collect ionWsInterface" )]
[return: System.Xml.Seri alization.SoapE lementAttribute ("outMsgText ")]
public PsmWsCollection getCollection() {

//debugger breaks at the following line!

object[] results = this.Invoke("ge tCollection", new object[0]);
return ((PsmWsCollecti on)(results[0]));
}
-------------------------------
Nov 16 '05 #3
Hello hellrazor.

I have the same problem, searching in tons of references I found that there
is a bug in the implementation of the compact framework, when a web service
exposes an array ob Objets, the pocket pc just cannot get it. I downloaded
the service pack 3 for the compact framework but it didn´t work.

If you find an answer to this problem I will apreciate it, and If I finf one
i will notify you.

regards
Jorge Ayala
ja****@siga.com .mx

"hellrazor" wrote:
hellrazor <jo***@anothe r-world.com> wrote in
news:Xn******** *************** **********@207. 46.248.16:
hellrazor <jo***@anothe r-world.com> wrote in
news:Xn******** *************** ***********@64. 59.144.76:
Hi there,

I'm trying to consume a web-service that is supposed to return a
collection of a custom object. The web-service was not created with C#
or VS.net. It was created with IBM VisualAge Smalltalk 6. I haven't
had problems consuming other web-services but c# seems to choke with
"Collection " return types.

If you'd like to try to see an example of this problem you can add the
following web-reference to your project:

http://216.18.68.93:9999/CollectionWsInterface.wsdl
(The browser window will say that there are no functions found, but
they are there)
After adding the web-reference and renaming it "CollectionsTes t", I
created a plain vanilla windows app and inserted the following into
the form load event:

CollectionsTest .CollectionWsIn terface ws =
new CollectionsTest .CollectionWsIn terface();

//PsmWsCollection seems to be the return object
//which is supposed to be a collection.
CollectionsTest .PsmWsCollectio n wsCollection;

wsCollection = ws.getCollectio n();

At this point, the debugger halts execution. The first lines of the
stack trace:

-------------------------------
Unhandled Exception: System.InvalidO perationExcepti on: There is an
error in XML document (16, 14). ---> System.InvalidC astException:
Cannot assign object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt to an object of type
WindowsApplicat ion3.Collection sTest.PsmWsResu lt[].
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.R ea d1_PsmWsCollect ion()
-------------------------------

Which leads me to believe that the collection is being returned as an
array itself. I'm stuck at this point, how do I cast the return type
to be an array of itself??

If I try the following:

wsCollection = (CollectionsTes t.PsmWsCollecti on[])ws.getCollecti on();

I get a "Cannot convert type" error when compiling.
I tried invoking the getCollection function using "Web Service Studio"
and it chokes on it as well!
If anyone has any clue on what I should do to correct this, I'd
appreciate it!

Thanks!

Jorge


Following up an extra bit of info:

The collection (or array) is supposed to contain three instances of a
custom object called PsmWsResult, which has two variable members: code,
and description.

Thanks!


.... and furthermore yet, this is where the debugger halts:

-------------------------------
[System.Web.Serv ices.Protocols. SoapRpcMethodAt tribute
("http://www.CollectionW sInterface.com/CollectionWsInt erface-
interface/getCollectio" +
"n", RequestNamespac e="urn:Collecti onWsInterface",
ResponseNamespa ce="urn:Collect ionWsInterface" )]
[return: System.Xml.Seri alization.SoapE lementAttribute ("outMsgText ")]
public PsmWsCollection getCollection() {

//debugger breaks at the following line!

object[] results = this.Invoke("ge tCollection", new object[0]);
return ((PsmWsCollecti on)(results[0]));
}
-------------------------------

Nov 16 '05 #4

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

Similar topics

0
5594
by: Mike | last post by:
Sites using thumbnail preview for world wide web file navigation and searching. Below are list of sites that are either researching or providing thumbnail preview images for online web documents. Thumbnail previews are useful for web site navigation particularly in search engines and directories such as Google, Altavista and Yahoo. The...
6
4807
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms Authentication set up and it worked just fine. Then I realized that I needed to have some pages unsecure. I then created 2 directories. One named Secure and...
0
2925
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to compile. Did a few other code things to take advantage of .Net features not available in VB6. When I start the application on my PC I get the error...
25
2800
by: John Morgan | last post by:
Though I have designed and implemented a number of large reasonably well received web sites I do not consider myself a graphics designer I am now for the first time going to work with a graphics designer. I notice that in the draft design the idea will be that many 'pages' will in fact be pdf files. I suppose I exaggerate slightly but the...
8
3128
by: John Baker | last post by:
Hi: I am URGENTLY in need of some book or web site OR tool that will help me integrate a relatively simple access application into a web page or pages. This is a time recording system (by project), and I would be more than wiling to pull the updated database down from the Host using FTP on a monthly basis. Its just that I need to understand...
4
8653
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single spreadsheet attachment per message, seems to be causing som kind of corruption of the attachment, while several spreadsheets per works just fine....
16
3146
by: C. Woody Butler | last post by:
I have a strange problem with a website and a web service. They're both on the same server, running Windows server 2003. The website is set up as the default website for the server. I've got the same code running in several different environments, it just so happens this is the production server we're having problems with. Not ideal,...
2
2925
by: Lucas Fletcher | last post by:
Hello, I was wondering how I can reference assemblies from web.config files residing in subdirectories without having to create a new project for each web.config-containing subdirectory? I would like to use an HttpModule, but only for files in a particular directory, so I add a web.config file containing this: <?xml version="1.0"...
2
3369
by: Jeff | last post by:
Hey asp.net 2.0 My asp.net 2.0 project has got a assembly load problem: Some of my web.config settings: <membership defaultProvider="AH_MembershipProvider" userIsOnlineTimeWindow="15">
7
1410
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I did my MCAD sometime ago in 1.1, using the 305 manual. I've since moved up to VS 2005. I've created perhaps a half dozen Dot Net 2.0 web applications. (Click on the Create Project link within Recent Projects and Asp.Net Web Applications.) Now I find out that my co-worker has been programming in a different style. He's been using the...
0
7697
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8120
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...
0
7968
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
6283
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...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
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.