c# - How to specify custom SoapAction without service interface exposed -
i wondering if possible have soap action not expose interface
i define service interface this
[servicecontract(namespace = "/")] public interface iservice { [operationcontract(action = "heartbeat", name = "heartbeat")] [xmlserializerformat] [webinvoke(requestformat = webmessageformat.xml, responseformat = webmessageformat.xml, uritemplate = "/heartbeat")] heartbeatresponse heartbeat(heartbeatrequest request); }
implementation:
[servicebehavior(addressfiltermode = addressfiltermode.any, namespace = "/")] public class service : iservice { public heartbeatresponse heartbeat(heartbeatrequest request) { ... } }
web.config
<behavior name="endpointbehavior"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> <bindings> <wshttpbinding> <binding name="soap12"> <security mode="none"> <transport clientcredentialtype="none" /> </security> </binding> </wshttpbinding> </bindings> <service behaviorconfiguration="endpointbehavior" name="xxxxxx.service"> <endpoint binding="wshttpbinding" bindingconfiguration="soap12" name="service" bindingnamespace="/" contract="xxxxxx.iservice" /> </service>
here response get:
<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:header> <a:action s:mustunderstand="1">/iservice/heartbeatresponse</a:action> </s:header> <s:body xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <heartbeatresponse xmlns="urn://ocpp/cs/2012/06/"> <currenttime>2013-08-07t19:59:38.5842774z</currenttime> </heartbeatresponse> </s:body> </s:envelope>
i "/heartbeatresponse" or "heartbeatresponse"
<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:header> <a:action s:mustunderstand="1">/heartbeatresponse</a:action> </s:header> <s:body xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <heartbeatresponse xmlns="urn://ocpp/cs/2012/06/"> <currenttime>2013-08-07t19:35:57.9349568z</currenttime> </heartbeatresponse> </s:body> </s:envelope>
[operationcontract(replyaction="http://microsoft.wcf.documentation/responsetoocamethod")] string samplemethod(string msg);
Comments
Post a Comment