How to Capture SOAP messages in.NET Visual Studio

608 views
Skip to first unread message

Vandita Chhabaria

unread,
Sep 17, 2014, 5:25:23 AM9/17/14
to adwor...@googlegroups.com
Hello,

This is my 2nd question in Forum.

I am writing code to access Adwords API via test account. But I have read on the Page of Test Account that - 
" The clientCustomerId SOAP header value must be set to the test account CID in order to make a request against that test account. If you don't specify the clientCustomerId, then you may receive an INCOMPLETE_SIGNUP error."

I have read the page how to Configure App.Config file by which I have made changes in following Parameters :
 <add key="UserAgent" value="abcdefghijklmnop" />
    <add key="DeveloperToken" value="22characterlongToken" />   
    <add key="ClientCustomerId" value="myTestAccountCID" />

    <!-- Settings specific to use OAuth2 as authentication mechanism. You could
         run Common\Util\OAuth2TokenGenerator.cs to generate this section of the
         config file.
    -->

    <add key='AuthorizationMethod' value='OAuth2' />
    <add key='OAuth2ClientId' value='somethingsomethingl.apps.googleusercontent.com' />
    <add key='OAuth2ClientSecret' value='generatedbyTokenGenerator' />
    <add key='OAuth2RefreshToken' value='generatedbyTokenGenerator' />

Are there any other changes required ??
How to see SOAP xml files of my Application ?

Please guide me !
 

Danial Klimkin

unread,
Sep 17, 2014, 8:11:44 AM9/17/14
to adwor...@googlegroups.com
Hello Vandita,


No, the client library will set the correct headers for you. Just specify the test account CID in the configuration here:

  <add key="ClientCustomerId" value="myTestAccountCID" />

For DotNet log collection, please see this guide:



-Danial, AdWords API Team.

Vandita Chhabaria

unread,
Sep 18, 2014, 1:57:40 AM9/18/14
to adwor...@googlegroups.com
Hi Danial,

All seems good when I am using Test Account and Examples.CSharp.v201406.
I am able to get Campaigns, Add a campaign.

But my Requirement is all related to download various Reports using ReportDefinition Service or ReportDefinition.

I am using Examples.CSharp.v201406.DownloadCriteriaReport to learn How to download reports !

But I always end up in getting Error :
{Google.Api.Ads.AdWords.Util.Reports.ReportDownloadError[1]} 
Inner Exception :
{"Report download errors occurred, see errors field for more details."}

I have also attached the screenshot of the Exception!

Please help me out.

As you said, I also tried to capture SOAP messages for my Application. For that I have downloaded Fiddler but I am not able to configure Fiddler settings in my App.config file and basically how to use that tool to capture SOAPs. I know this problem does not come under Adwords APi, but it will be really a big help for me !

Thanks !
ReportException.PNG

Mariusz

unread,
Sep 18, 2014, 6:22:12 AM9/18/14
to adwor...@googlegroups.com
Hi Vandita,

   Unfortunately, it is impossible to say what the problem is from attached screenshot. Details are burried in Errors property which you haven't expanded. Can you post information from Errors collection?

   If you want to trace SOAP communication, you can use Option 1: Use SOAP logs. You only need to change log level from Off to Information, so your app.config will be:

  <system.diagnostics>
    <sources>
      <source name="AdsClientLibs.SoapXmlLogs"
        switchName="AdsClientLibs.SoapXmlLogs"
        switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <!-- Modify the initializeData attribute below to control the
              path to the SOAP XML log file. -->
          <add name="soapXmlLogListener"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="C:\Logs\soap_xml.log" />
          <remove name="Default" />
        </listeners>
      </source>
      <source name="AdsClientLibs.RequestInfoLogs"
        switchName="AdsClientLibs.RequestInfoLogs"
        switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <!-- Modify the initializeData attribute below to control the
              path to the request info log file. -->
          <add name="requestInfoLogListener"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="C:\Logs\request_info.log" />
          <remove name="Default" />
        </listeners>
      </source>
    </sources>
    <switches>
      <!-- Use this trace switch to control the SOAP XML logs written by Ads*
        .NET libraries. The default level is set to Off. Logs are generated at
        both the Error and Information levels. -->
      <add name="AdsClientLibs.SoapXmlLogs" value="Information"/>
      <!-- Use this trace switch to control the Request Info logs written by
        Ads* .NET libraries. The default level is set to Off. Logs are
        generated at both the Error and Information levels. -->
      <add name="AdsClientLibs.RequestInfoLogs" value="Information"/>
    </switches>
  </system.diagnostics>


Cheers,

Mariusz

Vandita Chhabaria

unread,
Sep 18, 2014, 7:05:15 AM9/18/14
to adwor...@googlegroups.com
Ok...And where will be my SOAP xml file ? 

Mariusz

unread,
Sep 18, 2014, 8:50:12 AM9/18/14
to adwor...@googlegroups.com
You can configure it. In the snipped I passed in, the log files are configured to be: 

C:\Logs\soap_xml.log
C:\Logs\request_info.log


Cheers,

Mariusz

Anash P. Oommen (AdWords API Team)

unread,
Sep 22, 2014, 11:42:46 AM9/22/14
to adwor...@googlegroups.com
Hi Mariusz,

I think the report logs are not written to SOAP logs right now. You'd have to look at either the Errors field, or use Fiddler to capture the response. I've opened an enhancement request at https://github.com/googleads/googleads-dotnet-lib/issues/26 to make sure this is addressed in an upcoming release.

Cheers,
Anash P. Oommen,
AdWords API Advisor.
Reply all
Reply to author
Forward
0 new messages