ASP.Net Web Services and incoming XML request with Namespace Prefixes RRS feed

  • Question

  • Should be simple but not finding it to be:

    I have written a Service that returns a string value, the request contains two incoming parameters. An existing client is trying to call my service with an XML body that contains namespace prefixes for the top level return object - the string return.  When I publish, there are no prefixes in the XML example, and my service cannot extract the two parameters from the body.

    Here is what the existing client is sending -

    <?xml version="1.0" encoding="UTF-8"?>

    <soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">


    <ns1:login soapenv:encodingStyle="" xmlns:ns1="">

    <a_sDMSUserName xsi:type="xsd:string">BRIINT0248/1</a_sDMSUserName>#

    <a_sDMSUserPassword xsi:type="xsd:string">xxxx</a_sDMSUserPassword></ns1:login>



    But the WSDL on publish states that the body should be -

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
        <login xmlns="">

    How do I make the WSDL enforce the "ns1" prefix for the method:

    public string login(string a_sDMSUSername, string a_sDMSUserPassword")


    Wednesday, May 7, 2014 9:31 AM


  • Hi,

    >>How do I make the WSDL enforce the "ns1" prefix for the method:

    For your scenario, you can try to use the MessageFormatter or the MessageEncoder, but it will recommand to use the MessageFormatter, and the following article has explained very well about how to implement your scenario, please try to check it:

    #Customize WCF Envelope and Namespace Prefix: .

    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 8, 2014 9:33 AM