473,498 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customer Entity from Web Service

I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me.

Nov 23 '05 #1
7 1760
Hi Lumina,

Does the web service have a reference to the class library containing the definitions for the Product Class?

-Altaf[MVP]


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me.

Nov 23 '05 #2
Yes, the Web Application and the Web Service have the same refernce to the
product class.

Product class have the <serialization> tag.

"S.M. Altaf [MVP]" wrote:
Hi Lumina,

Does the web service have a reference to the class library containing the definitions for the Product Class?

-Altaf[MVP]


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me

Nov 23 '05 #3
More datails.....

"No se puede convertir un valor de tipo '1-matriz dimensional
de Service.ProductoWSR.producto' en '1-matriz dimensional
de Common.producto' debido a que 'Service.ProductoWSR.producto'
no se deriva de 'Common.producto'."
code in Web Services
<WebMethod()> Public Function GetByCatId(ByVal nCt_id As Integer) As
Common.producto()
Code in Web page

Dim oWeb As New ProductoWSR.ProductoWS
Dim Productos As producto() = oWeb.GetByCatId(nCt_id)

"S.M. Altaf [MVP]" wrote:
Hi Lumina,

Does the web service have a reference to the class library containing the definitions for the Product Class?

-Altaf[MVP]


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me

Nov 23 '05 #4
Hi,

I think the issue you are experiencing is the following;

You have a duplkicate definition of the data classes.
- 1 definition is comming from the original assembly (the one used by
your WebSerivice server)
- 1 definition is comming from the Proxy generated for the client
based on the WSDL.

You should remove the reference 'to the assembly with dataclasses'
from the client. The generated webservice proxy class already contains
the proxy classes for the data types too.

Hope this helps,

Marvin Smit.

On Sat, 22 Oct 2005 18:04:03 -0700, Lumina <lu****@nospam.com> wrote:
More datails.....

"No se puede convertir un valor de tipo '1-matriz dimensional
de Service.ProductoWSR.producto' en '1-matriz dimensional
de Common.producto' debido a que 'Service.ProductoWSR.producto'
no se deriva de 'Common.producto'."
code in Web Services
<WebMethod()> Public Function GetByCatId(ByVal nCt_id As Integer) As
Common.producto()
Code in Web page

Dim oWeb As New ProductoWSR.ProductoWS
Dim Productos As producto() = oWeb.GetByCatId(nCt_id)

"S.M. Altaf [MVP]" wrote:
Hi Lumina,

Does the web service have a reference to the class library containing the definitions for the Product Class?

-Altaf[MVP]


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me


Nov 23 '05 #5
Thank You Marvin. I am progresing but i do not complete the task.

I Have:

Web service :
<WebMethod()> Public Function GetByCatId(ByVal nCt_id As Integer) As
producto()
.....
.....
Return productos.ToArray(GetType(producto))
End Function

ServiciosProductos Class :

Public Class ServicioProductos

Public Shared Function GetProductosPorCatWS(ByVal nCt_id As Integer) As
ProductoWSR.producto()
Dim oWeb As New ProductoWSR.ProductoWS
Dim Productos As ProductoWSR.producto() = oWeb.GetByCatId(nCt_id)
oWeb.Dispose()
oWeb = Nothing

'*1
Return Productos
End Function
End Class

Note: ProductoWSR = Producto Web Service reference

In the *1, the code works perfectly. Now.. this function is used from the
web page :

.....
.....

Me.Lista.DataSource =
Service.ServicioProductos.GetProductosPorCatWS(nCt _id)

Me.Lista.DataBind()

In the Databind see this error:

DataBinder.Eval: 'Service.ProductoWSR.producto' no contiene una propiedad
con el nombre 'nombre'

But in the point '*1' i see the property 'nombre'.
I Inspect 'Me.Lista.DataSource' and see perfectly the property 'nombre'..
but in the databing.. crash.

Thank You.

"Marvin Smit" wrote:
Hi,

I think the issue you are experiencing is the following;

You have a duplkicate definition of the data classes.
- 1 definition is comming from the original assembly (the one used by
your WebSerivice server)
- 1 definition is comming from the Proxy generated for the client
based on the WSDL.

You should remove the reference 'to the assembly with dataclasses'
from the client. The generated webservice proxy class already contains
the proxy classes for the data types too.

Hope this helps,

Marvin Smit.

On Sat, 22 Oct 2005 18:04:03 -0700, Lumina <lu****@nospam.com> wrote:
More datails.....

"No se puede convertir un valor de tipo '1-matriz dimensional
de Service.ProductoWSR.producto' en '1-matriz dimensional
de Common.producto' debido a que 'Service.ProductoWSR.producto'
no se deriva de 'Common.producto'."
code in Web Services
<WebMethod()> Public Function GetByCatId(ByVal nCt_id As Integer) As
Common.producto()
Code in Web page

Dim oWeb As New ProductoWSR.ProductoWS
Dim Productos As producto() = oWeb.GetByCatId(nCt_id)

"S.M. Altaf [MVP]" wrote:
Hi Lumina,

Does the web service have a reference to the class library containing the definitions for the Product Class?

-Altaf[MVP]


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
I have a class "product" in a Web Project with the ensamblie.
In otherside I Have a Web Service and I want to return an product class
object,
but when I want to received this object in the Web Application I have an
error saying "can't not convert product in product".

Someone can help me


Nov 23 '05 #6
Hi,

I'm glad we got the duplicate definition out of the code. I'm sorry
to say, but i must yield to someone else now. I have little experience
in using the databinding functionality.

The little info i can provide would be;

- I'm sure the de-serialization is correct because you show that souce
(with the *1) does return exactly what you expected.

But i'm sure an databinding expert on this list will be able to help
you further with this problem.

one last thing that jumped into my mind was that you might have
special characters in the naming (Italian, Spanish?)

Marvin Smit.
On Mon, 24 Oct 2005 18:49:01 -0700, Lumina <lu****@nospam.com> wrote:
Thank You Marvin. I am progresing but i do not complete the task.

I Have:

Web service :
<WebMethod()> Public Function GetByCatId(ByV b
l nCt_id As Integer) Asproducto()
....
....
Return productos.ToArray(GetType(producto))
End Function

ServiciosProductos Class :

Public Class ServicioProductos

Public Shared Function GetProductosPorCatWS(ByVal nCt_id As Integer) As
ProductoWSR.producto()
Dim oWeb As New ProductoWSR.ProductoWS
Dim Productos As ProductoWSR.producto() = oWeb.GetByCatId(nCt_id)
oWeb.Dispose()
oWeb = Nothing

'*1
Return Productos
End Function
End Class

Note: ProductoWSR = Producto Web Service reference

In the *1, the code works perfectly. Now.. this function is used from the
web page :

....
....

Me.Lista.DataSource =
Service.ServicioProductos.GetProductosPorCatWS(nC t_id)

Me.Lista.DataBind()

In the Databind see this error:

DataBinder.Eval: 'Service.ProductoWSR.producto' no contiene una propiedad
con el nombre 'nombre'

But in the point '*1' i see the property 'nombre'.
I Inspect 'Me.Lista.DataSource' and see perfectly the property 'nombre'..
but in the databing.. crash.

Thank You.

"Marvin Smit" wrote:
Hi,

I think the issue you are experiencing is the following;

You have a duplkicate definition of the data classes.
- 1 definition is comming from the original assembly (the one used by
your WebSerivice server)
- 1 definition is comming from the Proxy generated for the client
based on the WSDL.

You should remove the reference 'to the assembly with dataclasses'
from the client. The generated webservice proxy class already contains
the proxy classes for the data types too.

Hope this helps,

Marvin Smit.

On Sat, 22 Oct 2005 18:04:03 -0700, Lumina <lu****@nospam.com> wrote:
>More datails.....
>
>"No se puede convertir un valor de tipo '1-matriz dimensional
>de Service.ProductoWSR.producto' en '1-matriz dimensional
>de Common.producto' debido a que 'Service.ProductoWSR.producto'
>no se deriva de 'Common.producto'."
>
>
>code in Web Services
> <WebMethod()> Public Function GetByCatId(ByVal nCt_id As Integer) As
>Common.producto()
>
>
>Code in Web page
>
>Dim oWeb As New ProductoWSR.ProductoWS
>Dim Productos As producto() = oWeb.GetByCatId(nCt_id)
>
>
>
>
>
>"S.M. Altaf [MVP]" wrote:
>
>> Hi Lumina,
>>
>> Does the web service have a reference to the class library containing the definitions for the Product Class?
>>
>> -Altaf[MVP]
>>
>>
>>
>>
>> --------------------------------------------------------------------------------
>> All that glitters has a high refractive index.
>> www.mendhak.com
>> "Lumina" <lu****@nospam.com> wrote in message news:F8**********************************@microsof t.com...
>> I have a class "product" in a Web Project with the ensamblie.
>> In otherside I Have a Web Service and I want to return an product class
>> object,
>> but when I want to received this object in the Web Application I have an
>> error saying "can't not convert product in product".
>>
>> Someone can help me


Nov 23 '05 #7
> Me.Lista.DataSource =
Service.ServicioProductos.GetProductosPorCatWS(nCt _id)

Me.Lista.DataBind()

In the Databind see this error:

DataBinder.Eval: 'Service.ProductoWSR.producto' no contiene una propiedad
con el nombre 'nombre'


If I'm not mistaken, in order for an object to act as a DataSource for a
control, it needs to have property accessors. The generated code for the web
service, the Product class, only generates public field accessors, therefore
cannot be databound

Your Product class may look like this:

[Serializable]
public class Product
{
private int productId;
public int ProductId{ get{ return productId; } set{ productId =
value; }}
}

The proxy generated class will look like this:

public class Product
{
public int ProductId
}

So, on the client side you'll need to do some transformation to map the
proxy Product class to a domain Product class so that you can databind.
Alternatively, I believe the XsdObjectGen utility will generate proxy
classes with property accessors. Google for XsdObjectGen.

Ron
Nov 23 '05 #8

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

Similar topics

2
1437
by: Mike Treadway | last post by:
This may seem like a stupid question, but for some reason I'm having trouble finding an answer. I have a service that is running with a system account on a Windows 2000 machine at a customer...
9
5437
by: lkrubner | last post by:
Can't get this RSS feed clean: http://www.whatisliberalism.com/pdsFiles/page2533.xml Why is it dying? Some users write posts in Microsoft Word, then copy and paste their post to the web...
0
848
by: RYoung | last post by:
Hello all, Say I have a Windows application that manages a Catalog of Product(s). There is no need to serialize these objects or expose them to other applications in the present or future. Any...
2
6988
by: Pablo | last post by:
We are calling a web service running in IIS 6.0 (Windows 2003 Server) When we call a web service method to send a large xml document (2Mb) obtain an http error 413 (entity too large) We have...
18
2724
by: R. P. | last post by:
I wonder how to indicate in a stylesheet that character entities in an element are not to be transformed as would be the case in XML-to-XML transforms. I want to keep those &amp; &quot; and other character...
1
8292
by: Steve Wofford | last post by:
I am recieving the following. This happens when I moved it from my development system to our production SBS 2003 w/ latest .net frameworks and service packs . I developed under XPSP2 and VS2008. ...
5
3393
by: John | last post by:
Hi I have installed vs2008/.net3.5 SP1 (details below) but I still can't see ADO.Net Entity Framework under 'New Item' in my WinForm vb.net solution. What am I doing wrong? Thanks Regards
3
2441
by: Andy B | last post by:
I have about 12 services that will be used on the website I am working on. A few of them are News, Events, Venues (that work directly with Events), Mailing lists and some others. Each one of these...
0
3437
by: zman77 | last post by:
Hi. My solution (working in VS 2008) has a C# console app, and a C# web service. The service has an entity data model. It has numerous stored procedures. For one of the stored procs, which just...
0
7124
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,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
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,...
1
4904
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...
0
4586
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...
0
3090
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...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.