How do I stop d4p1 being a required namespace prefix within my WCF service SOAP request XML -


i've built first ever wcf service designed receive http post requests have message body in strict format have no influence over. here example:

<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">   <s:body>     <acquirepackagingdata xmlns="mydomain.com">       <account xmlns="http://schemas.microsoft.com/v1.0">         <assetidentifier>ergegdgsdyeryegd</assetidentifier>       </account>     </acquirepackagingdata>   </s:body> </s:envelope> 

the bit change each request value of assetidentifier.

my wcf service contract follows:

to given myself maximum control on xml, have opted use xmlserializer instead of datacontractserializer using [xmlserializerformat] .

the account class simple to: [xmlroot(namespace = "http://schemas.microsoft.com/v1.0")] [serializable] public class account {

    private string m_assetidentifier;      [xmlelement]     public string assetidentifier     {         { return m_assetidentifier; }         set { m_assetidentifier = value; }     }   } 

the problem occurs when make request service. when use wcf test client can see has made following request:

<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">   <s:header>     <action s:mustunderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://schemas.microsoft.com/drm/2007/03/protocols/ilgicontentprotection/acquirepackagingdata</action>   </s:header>   <s:body>     <acquirepackagingdata xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="http://schemas.microsoft.com/drm/2007/03/protocols">       <challenge xmlns:d4p1="http://schemas.microsoft.com/drm/2007/03/protocols/acquirepackagingdata/v1.0">         <d4p1:assetidentifier>ergegdgsdyeryegd</d4p1:assetidentifier>       </challenge>     </acquirepackagingdata>   </s:body> </s:envelope> 

note presence of d4p1 namespace aliases have been introduced. if request service request xml not include these aliases request fails null pointer on account object received acquirepackagingdata method.

i tried using datacontractserializer had same problem. hoped i'd different result using xmlserializer. read elsewhere on forum maybe use following approach made no difference:

[system.serializableattribute()] [system.xml.serialization.xmltypeattribute(anonymoustype = true, namespace = "http://schemas.microsoft.com/v1.0")] [system.xml.serialization.xmlrootattribute(namespace = "http://schemas.microsoft.com/v1.0", isnullable = false)]  public class account { .... } 

please can let me know how can modify service request xml includes namespace not pesky d4p1 aliases?

thanks


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -