Migration from ASP.NET web service with SOAP Header and Mtom, WSE-3 to WCF -


i need migration asp.net web service wcf. current code 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 5";             }     } </code> 

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. need change wcf. found many topics how sign soap header wcf, how use messagecontract attribute of class given operation parameter. this:

<code>     [messagecontract]     public class mytype     {        public int x;        public string s;     }      [operationcontract]     public string somemethod(mytype mytype)     {      } </code> 

but not need, method must remain same (with no parameter).

few blogs talks using wcfextra lib or implement client dispatcher interface add soap header every outgoing request. again, want migration of web service wcf shouldn't affect client, , not required code changes, should able consume web service .asmx extension. also, current web service uses mtom , wse-3. there easy way.

please me this.

i have read following articles, none of them talk how handle soap header, wse-3:

http://megakemp.com/2008/11/27/migrating-aspnet-web-services-to-wcf/ http://megakemp.com/2008/11/27/migrating-aspnet-web-services-to-wcf/ http://vikasbhardwaj15.blogspot.in/2012/05/convert-asmx-web-services-to-wcf.html http://blogs.msdn.com/b/trobbins/archive/2006/12/02/integrating-wcf-with-your-existing-asmx-services.aspx http://blogs.msdn.com/b/kaevans/archive/2006/10/05/phased-migration-from-asmx-to-wcf.aspx http://www.manas.com.ar/waj/2007/05/31/asmx-to-wcf-migration/ 

in past extract wsdl asmx. i'll run against svcutil argument /mc, generates service , message contracts. i'll refactor code behave same. part works, there gotchas.

from code posted, want encapsulate "myobj" header in request , response message, similar following:

[datacontract] public class mytype {     [datamember]     public int x;      [datamember]     public string s; }  [messagecontract] public class somemethodrequestmessage {     [messageheader] public mytype myobj; }  [messagecontract] public class somemethodresponsemessage {     [messageheader] public mytype myobj;     [messagebodymember] public string result; }  // inside service contract  [operationcontract] public somemethodresponsemessage somemethod(somemethodrequestmessage message) {    // stuff } 

see using message contracts.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -