0

How do i add namespace to the SearchSchemes ? The following is the soap request and
The current output is as follows .

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="CompareYourTravelInsurance.Services">
   <soapenv:Header/>
   <soapenv:Body>
      <com:SearchSchemes>
       </com:SearchSchemes>
   </soapenv:Body>
</soapenv:Envelope>

And I want the output like the following

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
       <soapenv:Header/>
       <soapenv:Body>
          <com:SearchSchemes xmlns="CompareYourTravelInsurance.Services">
           </com:SearchSchemes>
       </soapenv:Body>
    </soapenv:Envelope>

And The following is my WCF interface , where I have added namespace at the sSeerviceContract , But I couldnt add namespace to OperationContract.

[ServiceContract(Namespace = "CompareYourTravelInsurance.Services")]
public interface IMSMWcf
{
    [OperationContract(
        Action = "CompareYourTravelInsurance.Services/SearchSchemes",
        Name = "SearchSchemes",
        ReplyAction = "CompareYourTravelInsurance.Services/SearchSchemes",
        Namespace="dddd"
    ), XmlSerializerFormat]
    List<QuoteResult> SearchSchemes();

    [OperationContract(
    Action = "CompareYourTravelInsurance.Services/SaveTravellerInformation",
    Name = "SaveTravellerInformation"

    ), XmlSerializerFormat]
    void SaveTravellerInformation();


    [OperationContract(
    Action = "CompareYourTravelInsurance.Services/SendData",
    Name = "SendData",
    ReplyAction = "CompareYourTravelInsurance.Services/SendData"
    )]
    MsmData SendData(string QuoteDetailsRef);
}
user740022
  • 39
  • 1
  • 8
  • 1
    the com: prefix on your SearchSchemes object indicates the namespace. It references the xmlns:com="CompareYourTravelInsurance.Services" in your Envelope attributes. Why do you want to duplicate that? – GTG Jan 30 '13 at 16:13
  • , it is required by the client. They want the namespace added to it. – user740022 Jan 30 '13 at 16:15
  • In that case, How can I add namespace to SearchSchemes and remove the namespace from the envelope.Actually This is what I want , – user740022 Jan 30 '13 at 16:16
  • I'm not sure if you can. Also note that namespace in WSDL is usually on the form "http://somecompany.somewhere/somepath" instead of "SomeCompany.SomePath". – GTG Jan 30 '13 at 16:21
  • I don't think an XML parser would appreciate your proposed XML :-). To make it parse you would need to remove the com: prefix, because if you prefix an element with a namespace alias, that namespace alias needs to be defined. – GTG Jan 30 '13 at 16:30

0 Answers0