Method from Proxy class which I am calling.
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("initiate", OneWay = true,
Use = System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
public void initiate([XmlElement(Namespace = "http://xmlns.xxxx.com/whatever",
IsNullable=false)] XmlDocument Candidates1)
{
this.Invoke("initiate", new object[] { Candidates1 });
}
SOAP message format from fiddler :
<soap:Envolope>
<soap:Header>
.....
</soap:Header>
<soap:Body>
<Candidates1 xmlns="http://xmlns.xxxx.com/whatever">
<Candidate xmlns="">
-- XML Document nodes --
</Candidate>
</Candidates1>
</soap:Body>
</soap:Envelope>
The problem is the <Candidates1> element. .NET is just converting the input parameter name to a xml root element in the final soap message. If I rename it to candidate2 then the xml element would be <candidate2>
According to this msdn article here:
http://msdn.microsoft.com/en-us/library/2b4bx2t6(VS.80,loband).aspx
we can specify that parameters directly follow the Body element. By applying the xmlelement
attribute to the input parameter and setting ParameterStyle to Bare, along with setting the parameter formatting style to Literal.
But even after appying these changes(as above), I am unable to remove the <Candidates1> element.
Any suggestions are welcome on how to specify that parameters directly follow the body element. In my case the <Candidate> should follow the <soap:Body> element.
Thanks.