client in 1.1, server in 3.5


D

dan

I've posted also in microsoft.public.dotnet.framework.webservices.

Hi, I have the following problem:

- the client application (asp.net website) is written in .net 1.1.
- the server is being written in 3.5

they need to communicate automatically.
so I'm using wcf as webservices.

I've added in client a ws reference to the server, the proxy was created.

now,
when I'm running/debugging the client, in watch, the properties of the proxy
instance show that "has no runtime value".
when I run the unit tests, everything is working properly.
the unit tests and the production code use the same proxy.

does anybody know why there is this anomaly?

the dev computer is xp pro sp2, .net 1.1, 2.0, 3.5, iis 5.1.

many thanks,
Dan
 
Ad

Advertisements

J

John Saunders [MVP]

dan said:
I've posted also in microsoft.public.dotnet.framework.webservices.

Hi, I have the following problem:

- the client application (asp.net website) is written in .net 1.1.
- the server is being written in 3.5

they need to communicate automatically.
so I'm using wcf as webservices.

I've added in client a ws reference to the server, the proxy was created.

now,
when I'm running/debugging the client, in watch, the properties of the
proxy
instance show that "has no runtime value".
when I run the unit tests, everything is working properly.
the unit tests and the production code use the same proxy.

does anybody know why there is this anomaly?

the dev computer is xp pro sp2, .net 1.1, 2.0, 3.5, iis 5.1.

There's no reason a .NET 1.1 client can't use a .NET 3.5 service. Consider
there's no reason that a .NET 1.1 client can't use a Java service.

Don't worry about what the debugger says about "no runtime instance". Does
something go wrong when you run the client?
 
D

dan

There's no reason a .NET 1.1 client can't use a .NET 3.5 service. Consider
there's no reason that a .NET 1.1 client can't use a Java service.

I thought so too, but the reality bit me with this project. :D
Another example is that a TIBCO client doesn't handle very well a wsdl
generated by .net deserializer. :D
I had to simplify the object model from which the schema was generated,
while the .net client consumed it w/out problems.
Don't worry about what the debugger says about "no runtime instance".
Does something go wrong when you run the client?
--

Well, when i try to send the data structures to a method of the proxy, I get
this error:

System.InvalidOperationException: There was an error generating the XML
document. ---> System.InvalidCastException: Specified cast is not valid.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write6_ProcessJob(Object[]
p)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Serialize(SoapClientMessage
message)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at MyProject.ProcessJob(MonitorJob job)


the weird part is that, while debugging the unit tests, i can see the values
for each properties.
the unit tests create the data structures 99% the same way as the client.
the only difference is that in the client, I copy the values from another
set of data structures.

Dan
 
J

John Saunders [MVP]

dan said:
There's no reason a .NET 1.1 client can't use a .NET 3.5 service.
Consider there's no reason that a .NET 1.1 client can't use a Java
service.

I thought so too, but the reality bit me with this project. :D
Another example is that a TIBCO client doesn't handle very well a wsdl
generated by .net deserializer. :D
I had to simplify the object model from which the schema was generated,
while the .net client consumed it w/out problems.
Don't worry about what the debugger says about "no runtime instance".
Does something go wrong when you run the client?
--

Well, when i try to send the data structures to a method of the proxy, I
get this error:

System.InvalidOperationException: There was an error generating the XML
document. ---> System.InvalidCastException: Specified cast is not valid.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write6_ProcessJob(Object[]
p)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter,
Object o, XmlSerializerNamespaces namespaces)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Serialize(SoapClientMessage
message)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at MyProject.ProcessJob(MonitorJob job)


the weird part is that, while debugging the unit tests, i can see the
values for each properties.
the unit tests create the data structures 99% the same way as the client.
the only difference is that in the client, I copy the values from another
set of data structures.

Right, whas I was getting at is that the absence of values in the Debugger
is meaningless. It has nothing to do with the actual problem you were
seeing, which is an invalid cast.

Unfortunately, the exception doesn't tell you which cast it's talking about!
 
D

dan

follow-up:

i ran the unit test code inside the client, sending the test data to the
proxy.
the same "invalid cast" exception occured...

so it has something to do with the environment of the client code.
now, i'm trying to call the test code from client... :D
 
Ad

Advertisements

D

dan

final story...the problem was somewhere far from the webservices...
I was creating the instances, dinamically, at runtime with this code:

1) Type IF = ISP.GetInterface( "IJobMonitor" );

2) IJobMonitor IJob = Activator.CreateInstance( ISP ) as IJobMonitor ;
3) if ( ISPg != null )
4) {
5) ISPg.Register();
6) }

the above code didn't created the instance "properly" so to say, and i
noticed this in the debugger.
some properties had no value, even though they initialized in the ctor.
also, when i instantiated the class using normal ctor, there was no problem.

so i replaced line 2 with the following:

ObjectHandle handle = Activator.CreateInstance( hostAssembly.FullName,
ISP.FullName );
IJobMonitor ISPg = handle.Unwrap() as IJobMonitor;

and now everything works :))
i think the unit tests were working because the unit test runner initialized
the classes the same "Unwrap" way.
no more "invalid cast" in the serializer... but i had to bang my head for 4
days to discover this...

Dan
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top