从网络服务捕获肥皂请求/响应
我正在开发一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于调试,您可以使用 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?