Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove ActivityId from WCF Request

I'm having an interesting compatibility issue between a WCF client and a Java web service. In short I've found that the way the header is generated is causing the problem - the ActivityId and Action elements in the header as well as what WCF is doing with the namespace of the custom header is causing issues. I've successfully consumed the WSDL with wsdl.exe, but WCF seems to be manipulating the header in a way that the Java web service doesn't like. Is there any way I can set up the bindings for the WCF client to not send the ActivityId and Action elements?

like image 635
CodeMonkey1313 Avatar asked Jan 25 '12 14:01

CodeMonkey1313


2 Answers

Do you have tracing turned on in the client? I think that is what is adding the activity ID as its trying to flow the tracing activity to the service for end to end tracing. Turn off the activity tracing flag and it should go - see my comment for the action header

like image 68
Richard Blewett Avatar answered Oct 03 '22 04:10

Richard Blewett


This issue commonly occurs when a WCF client attempts to connect to a non-WCF server, e.g. JAX-WS, Websphere etc.

Just to add to Richard's lifesaver answer and address @irperez's comment, the actual settings which need to be disabled to prevent WCF diagnostics from adding ActivityId during WCF Diagnostic Tracing are to remove:

  • Remove ActivityTracing from switchvalue
  • Set propagateActivity to false

i.e. Change

<system.diagnostics>
  <sources>
    <source name="System.ServiceModel" switchValue="Information, ActivityTracing"
            propagateActivity="true">
    <listeners>
      <add name="xml"/>
    </listeners>
  </source>
...

To:

<source name="System.ServiceModel" switchValue="Information" 
        propagateActivity="false">
  <listeners>
    <add name="xml"/>
  </listeners>

If the ActivityId is enabled, it injects the below into the SOAP headers, which can break unsuspecting servers:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <ActivityId CorrelationId="5de75017-da08-4ac2-84f2-5374953cc2a1" 
         xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">
      9f076849-e76e-4675-84c1-5026b1c2eb1a
    </ActivityId>
  </s:Header>
like image 29
StuartLC Avatar answered Oct 03 '22 04:10

StuartLC