我正在尝试创建带有前缀的 SOAP 消息。但是,我无法正确设置命名空间。我已经尝试了几天,并尝试了很多我在网上找到的建议,但似乎没有一个有效。我希望你们中的一些人可以帮助我。我得到的是
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Transaction xmlns="http://tempuri.org/">
<bankingTransaction>
<operation parameterOrder="string">
<fault />
<fault />
</operation>
<transactionDate>dateTime</transactionDate>
<amount>int</amount>
</bankingTransaction>
</Transaction>
</soap:Body>
</soap:Envelope>
&我真正需要的是
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<res:Transaction xmlns="res:http://tempuri.org/">
<res:bankingTransaction>
<res:operation parameterOrder="string">
<res:fault />
<res:fault />
</res:operation>
<res:transactionDate>dateTime</res:transactionDate>
<res:amount>int</res:amount>
</res:bankingTransaction>
</res:Transaction>
</soap:Body>
</soap:Envelope>
& 我的按摩联系方式是
[MessageContract]
public class BankingTransaction
{
[MessageHeader] public Operation operation;
[MessageHeader] public DateTime transactionDate;
[MessageBodyMember] private unit sourceAccount;
[MessageBodyMember] public int amount;
}
请帮我为我的 XML 元素添加前缀。谢谢