簡體   English   中英

如何使用 C# 從 WSDL 文件中將請求結構提取為每個操作的 xml 字符串

[英]how to extract the request structure as xml string of each operation from WSDL file using C#

我已經實現了一個包含 3 個操作的 svc 服務 serTest.svc:

opePing(PingRequest PingRequest)
opeTest(測試測試)
opeTest1(測試測試1)

我從 serTest.svc 服務生成了一個 WSDL 文件。

我已經實現了一個小型控制台程序,我使用 C# ServiceDescription class 從 WSDL 文件中讀取一些信息。

我現在想要的是 C# 代碼的示例,該代碼如何從 WSDL 文件中提取請求結構作為 xml 字符串,例如 opePing:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<opePing xmlns="http://test/webservices/">
<header>
<Aktoer xmlns="">
<Domaene>Test</Domaene>
<Bruger>Test</Bruger>
</Aktoer>
<InitSystem xmlns="">
<Noegle>7c4e35ca-4f60-4aee-a1a0-7763393dad07</Noegle>
<Proces>AliverTester</Proces>
<Applikation>1100</Applikation>
<Version>8.2.0.0</Version>
<Maskine>DEV</Maskine>
<Tidsstempel>2021-04-22T15:30:43.4875383+02:00</Tidsstempel>
<Kontekst>Test</Kontekst>
</InitSystem>
<Proces xmlns="">
<CPR>000000</CPR>
</Proces>
</header>
</opePing>
</soap:Body>
</soap:Envelope>

我以另一種方式,例如 SOAPUI 正在做什么並顯示請求 xml 結構。

似乎我無法使用 C# 中的 ServiceDescription class 來執行此操作。

任何人都可以幫助我嗎?

試試這個在線工具: https://www.wsdl-analyzer.com 它似乎是免費的,並且不僅僅為來自 WSDL 的請求和響應生成 XML。

還有這個: https://www.oxygenxml.com/xml_editor/wsdl_soap_analyzer.html ,可以下載,但不是免費的。

我希望這個鏈接可以幫助你很多。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM