i logging outgoing wcf soap requests application, , discovered discrepancy between i'm logging , goes out server via wire.
here i'm logging:
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:header> <action s:mustunderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/myinterface</action> </s:header> <s:body> <myinterface xmlns="http://tempuri.org/"> ... here goes out (captured wireshark):
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:body> <myinterface xmlns="http://tempuri.org/"> ... you'll notice wireshark capture not have header or action elements.
i noticed because tried pushing logged request out through soapui.
i'm using code log request:
public class inspectorbehavior : iendpointbehavior { public void applyclientbehavior(serviceendpoint endpoint, clientruntime clientruntime) { clientruntime.messageinspectors.add(new wcfmessageinspector()); } and:
public class wcfmessageinspector : iclientmessageinspector { public object beforesendrequest(ref system.servicemodel.channels.message request, iclientchannel channel) { log(request.tostring()); return null; } and:
client.endpoint.address = new system.servicemodel.endpointaddress(address); client.endpoint.behaviors.add(new inspectorbehavior()); does know if there's way capture going out (verbatim), without post-processing shown above?
you can configure wcf message logging in app.config log messages @ transport level.
this should capture message late possible:
for outgoing messages, logging happens after message leaves user code , before message goes on wire.
<system.diagnostics> <sources> <source name="system.servicemodel.messagelogging"> <listeners> <add name="messages" type="system.diagnostics.xmlwritertracelistener" initializedata="c:\logs\messages.svclog" /> </listeners> </source> </sources> </system.diagnostics> <system.servicemodel> <diagnostics> <messagelogging logentiremessage="true" logmalformedmessages="true" logmessagesatservicelevel="false" logmessagesattransportlevel="true" maxmessagestolog="1000" maxsizeofmessagetolog="1000000"/> </diagnostics> </system.servicemodel>
Comments
Post a Comment