Working with Cisco WSMA from .NET (Part Two)

First look at my other question ( part 1 ). It talks about how I want to call web services on a Cisco router (Web Services Management Agent - WSMA) from .NET 4 using WCF.

I applied the Ladislav technique and got it very far. However, I am now at a stage where I am sure that I am sending well-formed SOAP requests, but the router does not accept it.

There are several examples of valid SOAP requests in the Cisco documentation , such as:

<?xml version="1.0" encoding="UTF-8"?> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP:Body> <request xmlns="urn:cisco:wsma-config" correlator="4.1"> <configApply details="all"> <config-data> <cli-config-data> <cmd>no cns config partial mixy</cmd> <cmd>no stupid</cmd> <cmd>no cns exec 80 </cmd> </cli-config-data> </config-data> </configApply> </request> </SOAP:Body> </SOAP:Envelope>]]>]]> 

Using WCF tracing, I verify that the request being sent looks like this:

 <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <request correlator="1" xmlns="urn:cisco:wsma-config"> <configApply action-on-fail="rollback" details="all"> <config-data> <cli-config-data> <cmd xsi:type="xsd:string">hostname Gunnar</cmd> </cli-config-data> </config-data> </configApply> </request> </s:Body> </s:Envelope> 

For me it looks damn right. Yes, the xsd and xsi namespaces are declared on the body of the soap, not in the envelope, but that doesn't matter. The action-on-fail attribute is optional and is present in other examples. Type xs: should be fine too. Otherwise, it is completely equivalent. Or?

However, I always get the answer:

 <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xml="http://www.w3.org/XML/1998/namespace"> <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header> <SOAP:Body> <SOAP:Fault> <faultcode xmlns="">SOAP:Client</faultcode> <faultstring xmlns="">An expected XML tag or sequence is missing</faultstring> <detail xmlns=""> <WSMA-ERR:error xmlns:WSMA-ERR="urn:cisco:wsma-errors"> <WSMA-ERR:tag>xml</WSMA-ERR:tag> <WSMA-ERR:details>XML_ERROR_MISSING_ELEMENT</WSMA-ERR:details> </WSMA-ERR:error> </detail> </SOAP:Fault> </SOAP:Body> </SOAP:Envelope> 

I do not see that any element is missing.

Aren't you suggesting that iOS requires the namespace prefix to be SOAP (not s)? That would be completely stupid, but my options are running out (who knows, maybe they don’t deserialize the XML, but rather parse it by text). Does anyone know how I can specify the namespace prefix that WCF will use for the SOAP envelope?

0
source share
1 answer

Yes.

Using WCF tracing, violinist and debugging on the router, and manually sending messages over HTTP, I finally figured out what was going on.

Turns off the WSMA agent on the router, expects that the SOAP message payload in the HTTP request will include an XML declaration. And WCF is not sending it.

I posted a new question on how to get the WCF client to send an XML declaration with SOAP requests.

0
source

All Articles