C# SOAP Web Services client - example that shows h

2019-07-14 19:38发布

I'm looking for a C# example showing how to access a remote SOAP Web Service, and logging (to a file, or even just to a string I can do whatever with) all complete raw SOAP requests and complete raw SOAP responses.

I found some other posts on StackOverflow with similar topics, but they seem to reference a web.config file, which my desktop application does not have. I assume this is because they are using C# in the form of a web application querying a remote SOAP web service. Mine is a desktop application.

Any takers?

3条回答
男人必须洒脱
2楼-- · 2019-07-14 20:23

You could use SOAP extensions to get the SOAP content as a string and then log it wherever.

查看更多
淡お忘
3楼-- · 2019-07-14 20:26

In the above post, that should be "app.config" and "web.config", and the better URL is the one at http://msdn.microsoft.com/en-us/library/ms730064.aspx.

查看更多
手持菜刀,她持情操
4楼-- · 2019-07-14 20:33

See this answer for info on WCF logging. You can log to a file, and there is a special viewer to make reading the logs easy.

Your windows configuration file is named app.config rather than web.config and lives in the bin folder alongside the exe file. Within Visual Studio there is a "top level" AppConfig file that VS copies to the bin folder when you compile. You may need to add the AppConfig file to your project -- it is a special file type in the Add Item dialog.

+tom

查看更多
登录 后发表回答