This post regards the last hurdle in completing my task of communicating with a Cisco router via the Web Services Management Agent (WSMA), as described here and here. You will not have to read those posts to understand my current question, though.
The problem is this: I have build service and message contracts to match the router's web services, and configured a basicHttpBinding and an endpoint. And using a channel factory, I am now almost, but not quite, communicating successfully with the router.
I keep getting a SOAP fault in return, stating that "An expected XML tag or sequence is missing". Using WCF tracing, fiddler and debugging on the router, and manually posting messages over HTTP, I have finally figured out what's going on.
The WSMA agent on the router expects the SOAP message payload in the HTTP request to include an XML declaration. And WCF isn't sending one. As simple as that.
So my question is: How can I make WCF, using a basicHttpBinding, include an XML declaration in the message?
For reference, my binding configuration looks like this:
<basicHttpBinding>
<binding name="BasicHttpBinding_IWsmaService" messageEncoding="Text" textEncoding="UTF-8" allowCookies="false">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" proxyCredentialType="None" realm="level_15" />
</security>
</binding>
</basicHttpBinding>
(in case you wonder - yes, I am aware that I'm sending clear-text credentials over an unencrypted transport)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…