Stuck up with passing parameters into the service

Topics: General Discussion Forum, Service Factory Modeling Edition Forum
Apr 8, 2008 at 2:52 PM
Hi,
I have created a WCF service Using WSSF December-2006 release,
In this you know i have created an Operation Contract,

public UserResponse RegisterUser(UserRequest request)-----------> UserRequest is of the Type DataContract
{
IUser adapterRegister = new UserAdapter();

return adapterRegister.RegisterUser(request);
}

here, i am stuck up when calling the Method from the Client application.

I am calling this method using the Proxy class, which i have ceated.

Proxy.RegisterUser(--------------------); --------------------------> what to fill here ?

i wanna pass the username as the parameter which is there in the TextBox1.Text, but when i am giving something like this,

Proxy.RegisterUser(TextBox1.Text.ToString());

its showing an error, Error 192 Argument '1': cannot convert from 'string' to 'Employee.datacontracts.2008.02.UserDC'

But how can i give DataContract in this, i really need a help with this,,

Hopefull that someone will help me regarding this,
Nimi


Apr 8, 2008 at 3:59 PM

Hi,

First you have to create a instance for the DataContract, then using that instance u can call the Username Property which was delcared in the DC.

DC obj new DC();

obj.UserName=TextBox1.Text.ToString()

Proxy.RegisterUser(obj);


You have to fill the DC and then pass the DCobject as Parameter.

Reagrds,

Kumar.






Nimi wrote:
Hi,
I have created a WCF service Using WSSF December-2006 release,
In this you know i have created an Operation Contract,

public UserResponse RegisterUser(UserRequest request)-----------> UserRequest is of the Type DataContract
{
IUser adapterRegister = new UserAdapter();

return adapterRegister.RegisterUser(request);
}

here, i am stuck up when calling the Method from the Client application.

I am calling this method using the Proxy class, which i have ceated.

Proxy.RegisterUser(--------------------); --------------------------> what to fill here ?

i wanna pass the username as the parameter which is there in the TextBox1.Text, but when i am giving something like this,

Proxy.RegisterUser(TextBox1.Text.ToString());

its showing an error, Error 192 Argument '1': cannot convert from 'string' to 'Employee.datacontracts.2008.02.UserDC'

But how can i give DataContract in this, i really need a help with this,,

Hopefull that someone will help me regarding this,
Nimi




Apr 8, 2008 at 4:47 PM
Edited Apr 8, 2008 at 4:58 PM
Hi......

Thanks a lot for quick response,
you know i am a not able to fine anything as such,
Name of My DC is UserDC. but in the Client application i am not able to type, while typing its not coming in the Intellisense.
But after completion of typing UserDC, i am able to add the namespace.

Is this way of doing is correct or not ?

Hopefully, at the earliest.....
Thsnks in advance,
nimi
Developer
Apr 8, 2008 at 5:05 PM
Hi Nimi,

Yes, those DCs are being created (replicated from your service definition that was obtained from the WSDL when your proxy types were genrated) so you should be able to use it while passing these parameters to your operation call.
Apr 8, 2008 at 5:21 PM
Thanks a lot my dear friend......

This is wot i was expecting.. thanks a lot once again....


Nimi