从网络服务捕获肥皂请求/响应

发布于 2024-12-12 10:15:14 字数 1439 浏览 0 评论 0原文

我正在开发一个使用 ac# 脚本任务的 SSIS 包。为了调试和日志记录,我想捕获来自网络服务的肥皂请求/响应。

现在这是我以前从未做过的事情,我有点不知道该去哪里。 我正在使用 .Net 对 Web 服务和生成的代理类的内置支持。

非常感谢任何对此的帮助。

这是我当前的代码:

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
    }
}

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
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

緦唸λ蓇 2024-12-19 10:15:15

对于调试,您可以使用 Fiddler2 轻松捕获任何 Web 流量,包括 SOAP 请求/响应的完整 xml(它甚至可以轻松处理 SSL,与 Wireshark 不同)

对于日志记录...我希望我知道。对不起。

另外,欺骗 在 C# 中,如何捕获 Web 服务调用中使用的 SOAP?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文