![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? |
#3
| |||
| |||
|
|
I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? |
#4
| |||
| |||
|
|
I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? |
#5
| |||
| |||
|
|
"Rahul" <rahuls (AT) rediff (DOT) com> wrote in message news:uiWE9asVIHA.4740 (AT) TK2MSFTNGP02 (DOT) phx.gbl... I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? This is expected. The classes on the client side are proxy classes only - they are not meant to be the same as the server-side classes. Their only purpose is to make it easier for you to call the web methods exposed by the server. In fact, if you ever get a situation with ASMX web services where you have the same class on the client and the server, then you've almost certainly made a very serious mistake. -- -------------------------------------------------------------------------------- John Saunders | MVP - Windows Server System - Connected System Developer |
#6
| |||
| |||
|
|
"Rahul" <rahuls (AT) rediff (DOT) com> wrote in message news:uiWE9asVIHA.4740 (AT) TK2MSFTNGP02 (DOT) phx.gbl... I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? This is expected. The classes on the client side are proxy classes only - they are not meant to be the same as the server-side classes. Their only purpose is to make it easier for you to call the web methods exposed by the server. In fact, if you ever get a situation with ASMX web services where you have the same class on the client and the server, then you've almost certainly made a very serious mistake. -- -------------------------------------------------------------------------------- John Saunders | MVP - Windows Server System - Connected System Developer |
#7
| |||
| |||
|
|
"Rahul" <rahuls (AT) rediff (DOT) com> wrote in message news:uiWE9asVIHA.4740 (AT) TK2MSFTNGP02 (DOT) phx.gbl... I am getting following error: 1) For a xml file "Request.xml" we created a schema "Request.xsd". 2) With the help of xsd.exe we got the C# file Request.cs. 3) We tried to send the object of Request.cs to a webservice method SaveRequest(Request req). 4) Scenario is like same Request.cs is referenced by both server and client. 5)When we are trying to pass the req object of type Request we are getting unable to cast error. Is this expected? If so, are there any workarounds? This is expected. The classes on the client side are proxy classes only - they are not meant to be the same as the server-side classes. Their only purpose is to make it easier for you to call the web methods exposed by the server. In fact, if you ever get a situation with ASMX web services where you have the same class on the client and the server, then you've almost certainly made a very serious mistake. -- -------------------------------------------------------------------------------- John Saunders | MVP - Windows Server System - Connected System Developer |
#8
| |||
| |||
|
|
Hi John, I've went through similar steps as Rahul, which is that I created a class by using xsd.exe, I have a web service which return this serialized class. I declared a variable as this class, and assign the return value of my web service to the variable, I got compiling error "Cannot implicitly convert type MyWebServiceTest.MyService.GetUserInfoResponseGetU serInfoResult to User". How can I get result from my web service? |
#9
| |||
| |||
|
|
Hi John, I've went through similar steps as Rahul, which is that I created a class by using xsd.exe, I have a web service which return this serialized class. I declared a variable as this class, and assign the return value of my web service to the variable, I got compiling error "Cannot implicitly convert type MyWebServiceTest.MyService.GetUserInfoResponseGetU serInfoResult to User". How can I get result from my web service? |
#10
| |||
| |||
|
|
Hi John, I've went through similar steps as Rahul, which is that I created a class by using xsd.exe, I have a web service which return this serialized class. I declared a variable as this class, and assign the return value of my web service to the variable, I got compiling error "Cannot implicitly convert type MyWebServiceTest.MyService.GetUserInfoResponseGetU serInfoResult to User". How can I get result from my web service? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |