473,396 Members | 1,893 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,396 software developers and data experts.

Problem with Nusoap & c#

Hi,

I have a small web service written in PHP with NuSOAP which describes a
type "Categorie" and a function "GetCategories()".

I'm trying to access it with a C# application.

Here is the generated code where the error occurs:
-------------------------------------------------------------------
public Categorie[] GetCategories() {
object[] results = this.Invoke("GetCategories", new object[0]); //OK
return ((Categorie[])(results[0])); //ERR
}
-------------------------------------------------------------------
I get an error at runtime:
"System.InvalidCastException", can't cast an object of type "Categorie"
to an object of type "Categorie" !!

The invoke method works fine, all the data is in the results array.

Thanks for your help.
Feb 26 '08 #1
2 2191
Hi Bob,

For the cast to succeed both array must have the same number of dimensions
ant there must be an implicit or explicit conversion from the source element
type to the target element type.
You could use just one of the overloaded Array.Copy() methods. Looking at
you code I see
"return ((Categorie[])(results[0]));". Are you sure that you have array of
Categorie in first array - result[0] element?
Daniel

"BOB Le Bricoleur" <bo*@bob.bobwrote in message
news:mn***********************@bob.bob...
Hi,

I have a small web service written in PHP with NuSOAP which describes a
type "Categorie" and a function "GetCategories()".

I'm trying to access it with a C# application.

Here is the generated code where the error occurs:
-------------------------------------------------------------------
public Categorie[] GetCategories() {
object[] results = this.Invoke("GetCategories", new object[0]); //OK
return ((Categorie[])(results[0])); //ERR
}
-------------------------------------------------------------------
I get an error at runtime:
"System.InvalidCastException", can't cast an object of type "Categorie" to
an object of type "Categorie" !!

The invoke method works fine, all the data is in the results array.

Thanks for your help.

Feb 26 '08 #2
Daniel Cigic a exposé le 26/02/2008 :
Hi Bob,

For the cast to succeed both array must have the same number of dimensions
ant there must be an implicit or explicit conversion from the source element
type to the target element type.
You could use just one of the overloaded Array.Copy() methods. Looking at you
code I see
I get the same error messages with Array.Copy()

"return ((Categorie[])(results[0]));". Are you sure that you have array of
Categorie in first array - result[0] element?
I am pretty sure; here is what the debugger gives for "results[0]":

results[0]:{Dimensions:[3]}
[0]:{ModuleAstuces.localhost.Categorie}
[1]:{ModuleAstuces.localhost.Categorie}
[2]:{ModuleAstuces.localhost.Categorie}
The code was generated by visual studio 2005, it should work without
modifying it. This is weird..
Feb 26 '08 #3

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

Similar topics

0
by: Eric Dennison | last post by:
I've been playing around with NuSOAP as a PHP based SOAP server and client. Works great! Now I'm trying to write (using gSOAP) a simple C/C++ based client to test against my simple SOAP server....
2
by: Larry Sankey | last post by:
Hello. I am having what is probably the simplest problem there is with Nusoap. I have to admit I'm new to this stuff, but I have some programming experience and what I'm doing *shouldn't* be hard....
0
by: Ward G | last post by:
Hi, Below is a basic webservice using the NuSOAP class. When I run the code to register the service, I get the nice html page generated by nusoap, offering a link to view the WSDL for my...
3
by: James Kennedy | last post by:
Hi, I've downloaded the NuSoap class files. I've put them onto my localhost/ where I run my php scripts, just put the nusoap.php file in there. I've got loads of different scripts to try out...
2
by: Johnny | last post by:
Searched on google for any info relating to this before posting here but found none. I set up a web service using nusoap on apache php 4.3.8 on windows with error_reporting = E_ALL and had that...
0
by: eva.m.tse | last post by:
I am thinking of building a website prototype. I would like to use PHP to implement the web components and use Python to implement the backend server components. Based on my analysis of what is...
2
by: Stewart | last post by:
Hi, I'm hoping that someone will be able to help out with a problem we are having. We have a web service built in .Net 1.1. We are trying to call it from PHP4 using the NuSOAP add on. It...
2
by: Gary Townsend | last post by:
I am writing an app in vb .net that will use an XML webservice written in PHP NuSoap. I want to have the NuSoap server send a dataset to my VB .NET application i am trying to find any documentation...
0
by: devthx | last post by:
Hi! I code php with nusoap for my web services and would like to consume it with c# soap client. Everything seem to be fine until I try to send data in Thai characters and recieved a garbage. Does...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...

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.