Hello,
I do migration from ASP.NET web service to WCF. Current code is like this:
Server Side
public class MyType
{
public int x;
public string s;
}
public class MyService : WebService
{
public MyType myObj;
[WebMethod]
[SoapHeader("myObj", Direction=SoapHeaderDirection.InOut)]
public string SomeMethod() // NO Parameter!!!
{
if (myObj.x > 5)
return myObj.s;
else
return "Less than 5";
}
}
Client Side
MyService service = new MyService();
MyType m = new MyType();
m.x = 10;
m.s = "That's it!!!";
service.myObj = m;
string s = service.SomeMethod();
This works smoothly. Now I need to change this to WCF. Found many topics about how to sign soapheader with WCF, but all are about how to use [MessageContract] as an attribute of a class which will be given to the operation as a parameter. Like this:
[MessageContract]
public class MyType
{
public int x;
public string s;
}
[OperationContract]
public string SomeMethod(MyType myType)
{
//
}
But this is not what I need, my method must remain the same (with no parameter).
Please help me with this.
Thank you,
-Aram