1

I am working on an SSIS package that uses a c# script task. For debugging and logging I would like to capture the soap request/response from the webservice.

Now is this something I have never had to do before and I am a bit stuck with where to go. I am using .Net's built in support for webservices and the generated proxy class.

Any help with this is greatly appreciated.

Here is my current code:

public void Main()
{
    try
    {
        DataTable dt = new DataTable();
        OleDbDataAdapter oleDa = new OleDbDataAdapter();
        ArrayList itemArray = new ArrayList();
        ArrayList orderArray = new ArrayList();

        oleDa.Fill(dt, Dts.Variables["User::ZBatch_Order_Export_ResultSet"].Value);

        int i = 0;
        foreach (DataRow row in dt.Rows)
        {
            orderArray.Add(ConstructOrderTransaction(row));
            itemArray.Add(ConstructItemTransaction(row));
            i++;
        }

        ZBatch_PublisherService.ZBatchPublisherServiceService ws = new ZBatchPublisherServiceService();
        ZBatch_PublisherService.bcfItemTransaction[] itemObjects = itemArray.ToArray() as bcfItemTransaction[];
        ZBatch_PublisherService.bcfOrderTransaction[] orderObjects = orderArray.ToArray() as bcfOrderTransaction[];
        ZBatch_PublisherService.zBatchResults results = new zBatchResults();

        results = ws.saveBatch(orderObjects, itemObjects);

        Dts.TaskResult = (int)ScriptResults.Success;
    }
    catch (Exception e)
    {
        Dts.Events.FireError(0, "ZBatch - Script Task", e.Message.ToString(), string.Empty, 0);

        // do some logging of this error message
    }
}
Yuval Itzchakov
  • 146,575
  • 32
  • 257
  • 321
Tempname
  • 565
  • 5
  • 26
  • `ZBatch_PublisherService.ZBatchPublisherServiceService`? How did you creat it? `Add Web Reference`/`Add service`? What is its base class? – L.B Oct 27 '11 at 19:15
  • Yes, ZBatch_PublisherService.ZBatchPublisherServiceService was created by using Add Reference/Add Server. The base class is System.Web.Services.Protocols.SoapHttpClientProtocol – Tempname Oct 27 '11 at 19:17
  • possible duplicate of [In C#, how would I capture the SOAP used in a web service call?](http://stackoverflow.com/questions/306852/in-c-how-would-i-capture-the-soap-used-in-a-web-service-call) – John Saunders Oct 27 '11 at 19:20
  • 1
    Did you see this answer http://stackoverflow.com/questions/7684671/soaphttpclientprotocol-log-response-xml/7685002#7685002 – L.B Oct 27 '11 at 19:23

1 Answers1

2

For debugging, you can use Fiddler2 easily to capture any web traffic, including the full xml of a SOAP request/response (and it even handles SSL easily, unlike Wireshark)

For logging... I wish I knew. Sorry.

Also, dupe of In C#, how would I capture the SOAP used in a web service call?

Community
  • 1
  • 1
Squirrelsama
  • 5,480
  • 4
  • 28
  • 38
  • You are correct, for debugging fiddler works just fine. However, trying to log the request is a whole different story. – Tempname Oct 27 '11 at 19:23