0

I use a DataContract with an empty namespace

[DataContract(Namespace = "")]    
    public class crearCuentaPorCobrarRq
    {
        [DataMember(IsRequired = true, Order = 0)]
        public InfoRequest infoRequest { get; set; }
        [DataMember(IsRequired = true, Order = 1)]
        public CuentaCobrar[] cuentasCobrar { get; set; }
    }

But unfortunatelly I obtain a wsdl like this:

<b:crearCuentaPorCobrarRq>
    <infoRequest></infoRequest>
    <cuentasCobrar></cuentasCobrar>
</b:crearCuentaPorCobrarRq>

Please forget the origin of b:, the question is that [DataContract(Namespace = "")] only delete in the DataMember the namespace and I want to quit in the DataContract too, such like this:

<crearCuentaPorCobrarRq>
    <infoRequest></infoRequest>
    <cuentasCobrar></cuentasCobrar>
</crearCuentaPorCobrarRq>

crearCuentaPorCobrar is an OperationContract method that is declared in a ServiceContract called: that has a namespace "com.lsc";. The idea is that crearCuentaPorCobrar maintains the prefix com but its parameters crearCuentaPorCobrarRq in the OperationContract changes:

[ServiceContract(Namespace = "com.lsc.services.financialSystem")]
public interface IServicioCuentas
{
    [OperationContract]
    InfoResponse crearCuentaPorCobrar(crearCuentaPorCobrarRq crearCuentaPorCobrarRq);
}
dbc
  • 104,963
  • 20
  • 228
  • 340
Jorge
  • 19
  • 3
  • `[DataContract(Namespace = "")]` controls the namespace of all elements created for that contract. The namespace of the parent element (``) is controlled by the namespace of the *outer element's contract*. Can you show the entire XML including the root element? See also [Adding a DataMember to a different namespace to the DataContract](https://stackoverflow.com/questions/1705742/). – dbc Sep 28 '15 at 17:07
  • You mean, it's contained by a class implementing `MessageContract`? If so, can you include that class in your question? – dbc Sep 28 '15 at 19:20
  • crearCuentaPorCobrar is an OperationContract method that is declared in a ServiceContract called: that has a namespace "http://com.lsc". The idea is that crearCuentaPorCobrar maintains the prefix com but its parameters crearCuentaPorCobrarRq in the OperationContract changes. [ServiceContract(Namespace = "http://com.lsc.services.financialSystem")] public interface IServicioCuentas { [OperationContract] InfoResponse crearCuentaPorCobrar(crearCuentaPorCobrarRq crearCuentaPorCobrarRq); } – Jorge Sep 28 '15 at 19:32
  • crearCuentaPorCobrar is an OperationContract method that is declared in a ServiceContract called: that has a namespace "http://com.lsc". The idea is that crearCuentaPorCobrar maintains the prefix com but its parameters crearCuentaPorCobrarRq in the OperationContract changes. [ServiceContract(Namespace = "http://com.lsc.services.financialSystem")] public interface IServicioCuentas { [OperationContract] InfoResponse crearCuentaPorCobrar(crearCuentaPorCobrarRq crearCuentaPorCobrarRq); } – Jorge Sep 28 '15 at 19:35

0 Answers0