how to add a parameter to soap body in wcf

363 views Asked by At

Our clients want to use the following soap message to call my WCF Service:

<soapenv:Envelope .....>
<soapenv:Header />
<soapenv:Body>
  <st:myExtraParam>str ex</st:myExtraParam>
  <st:MyMethod>
    <st:myfuncParam>func str</st:myfuncParam> 
  </st:MyMethod>
  ....
  ....
</soapenv:Body>
</soapenv:Envelope>

I created my service contract like the following:

[ServiceContract]
public interface IMyService
{
   [OperationContractAttribute]
   public ResponseObj MyMethod(string myfuncParam)
}

Now, how can I enable <st:myExtraParam>param str</st:myExtraParam> parameter above the function tag?

1

There are 1 answers

1
PeteAC On

My first instinct was to say that one can't have more than one direct child element of the SOAP Body element. But the SOAP specification says that it's fine to do so.

I don't think that WCF, based on [ServiceContract], can do it, though.