am trying to create WCF client to consume the service, which contains messages.
So far I am trying to communicate with by messages, that are made of an header (DateTime) and the body which is an object called User.
I have imported the app.config and the Proxy by using svcutil.
But, I get few errors.
Code:
{
RegistryServiceClient client = new RegistryServiceClient("WSHttpBinding_IRegistryService");
UserMessage message = new UserMessage();
message.time = DateTime.Now;
message.user.id = "1";
message.user.firstname = "John";
message.user.lastname = "Smith";
client.RegisterUser(message.time, message);
}
Errors:
Error 2 Argument 1 must be passed with the ‘ref’ keyword
Error 3 Argument 2: cannot convert from ‘UserMessage’ to ‘ref http://www.domain.co.uk.User.user’
Error 1 The best overloaded method match for ‘RegistryServiceClient.RegisterUser(ref System.DateTime, ref http://www.domain.co.uk.User.user)’ has some invalid arguments
The RegisterUser method signature specifies a different type than your UserMessage, specifically a type called http://www.domain.co.uk.User.user. I don’t know the specifics of the UserMessage class, but I’m going to go out on a limb and guess that the user property is of type http://www.domain.co.uk.User.user. So try:
and see what happens.