asp.net mvc 4 - Converting WCF SOAP Service Library to REST Service library for MVC -
problem statement:
we have built mvc 4 application using wcf service library (not wcf service application svc file). of mvc crud operations doing through wcf soap service library.everything working fine.now client has changed requirement , asking convert wcf soap rest.
i went through many url's converting wcf soap rest.in url's have mentioned converting wcf soap service application wcf rest not wcf soap service library wcf rest.
my question can convert wcf service library in soap rest.??is conversion same both wcf service library , wcf service application.??if possible impact much,in changing existing code??
it great if can suggest better way of converting wcf soap rest in mvc url's , explanation.
not sure if helps, have done wcf library exposed soap , rest @ same time. rest exposes xml/json , return type depends on input request. can configured via config file, mine looked this:
<behaviors> <servicebehaviors> <behavior name="behaviourservice"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="behaviourendpoint"></behavior> <behavior name="behaviourwebhttp"> <webhttp defaultbodystyle="wrapped" faultexceptionenabled="true" automaticformatselectionenabled="true"/> </behavior> </endpointbehaviors> </behaviors> <services> <service name="namespace.myclass" behaviorconfiguration="behaviourservice" > <!--soapui--> <endpoint name="name" address ="soap" binding="basichttpbinding" contract="namespace.imyclass"></endpoint> <!--rest--> <endpoint name="name" address="" binding="webhttpbinding" behaviorconfiguration="behaviourwebhttp" contract="namespace.imyclass" ></endpoint> <!--mex--> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange"/> <host> <baseaddresses> <add baseaddress="http://localhost:89/myaddress"/> </baseaddresses> </host> </service> </services>
and service like:
[servicecontract(namespace = "http://www.mycompany.com", name = "myname")] [datacontractformat] public interface imyclass { [operationcontract] [webinvoke(bodystyle = webmessagebodystyle.wrapped, uritemplate = "mymethod", method = "post")] bool mymethod(); }
Comments
Post a Comment