user1121956
user1121956

Reputation: 1961

Removing additional namespace definition in WCF SOAP message

I've got this WSDL(the service is not mine): http://soaptest.webapi-beta.gratka.pl/dom.html?wsdl

When I use WCF generated proxy the method tag in request soap message gets additional namespace definition like:

<q1:zaloguj xmlns:q1="http://soaptest.webapi-beta.gratka.pl/dom.html">

When I use PHP or proxy generated by wsdl.exe this doesn't happen.

I would like to ask, why does WCF do so, and is there possibility to change this behaviour (without using hand-made message modification in BeforeSendRequest)

Below I paste messages generated by PHP and WCF:

PHP one:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soaptest.webapi-beta.gratka.pl/dom.html" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:zaloguj>
            <login xsi:type="xsd:string">login</login>
            <haslo xsi:type="xsd:string">password</haslo>
            <klucz_webapi xsi:type="xsd:string">key</klucz_webapi>
            <id_kategoria xsi:type="xsd:int">382a</id_kategoria>
            <wersja_webapi xsi:type="xsd:int">2</wersja_webapi>
        </ns1:zaloguj>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WCF one:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <q1:zaloguj xmlns:q1="http://soaptest.webapi-beta.gratka.pl/dom.html">
            <login xsi:type="xsd:string">login</login>
            <haslo xsi:type="xsd:string">password</haslo>
            <klucz_webapi xsi:type="xsd:string">key</klucz_webapi>
            <id_kategoria xsi:type="xsd:int">382</id_kategoria>
            <wersja_webapi xsi:type="xsd:int">2</wersja_webapi>
        </q1:zaloguj>
    </s:Body>
</s:Envelope> 

Upvotes: 0

Views: 1186

Answers (1)

VinayC
VinayC

Reputation: 49225

Are you facing any issues? As far as xml is concerned, both are equivalent. PHP code is declaring the namespace (xmlns:ns1="http://soaptest.webapi-beta.gratka.pl/dom.html") at the root element while WCF is declaring at the point where it is needed - I would believe that this is what WSDL's implementation would be - does not seem to be anything wrong in it.

Upvotes: 2

Related Questions