0

プレフィックスを使用して 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 要素にプレフィックスを追加するのを手伝ってください。ありがとう

4

2 に答える 2