Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 07, 2012 04:18 PM by neko_zgz
0 Points
4 Posts
May 03, 2012 04:24 PM|LINK
Working with WCF, given the following operation contract that returns an "Asegurado" object. I want, in returning xml generated, show the item
<a:Asegurado>
<obtenerDatosAseguradoResult ..>
Operation:
<OperationContract()>Function obtenerDatosCliente(ByVal num As String) As Asegurado
Response:
<obtenerDatosAseguradoResponse xmlns="http://tempuri.org/"> <obtenerDatosAseguradoResult xmlns:a="http://schemas.datacontract.org/2004/07/dkv.lib.objects.citaOnline" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:apellidos>APELLIDOS</a:apellidos> <a:fechaNacimiento>1971-03-22T00:00:00</a:fechaNacimiento> <a:nif>7777777B</a:nif> ...
How can i achieve this without changing returning object in the OperationContract?
wsdl WCF
Contributor
6455 Points
1187 Posts
May 05, 2012 02:41 PM|LINK
Set the Order parameter of the DataMemberAttribute for the property in the DataContract to 0.
[DataContract] public class Asegurado { [DataMember(Order=0)] public string Asegurado {get;set;} ..... }
May 05, 2012 09:44 PM|LINK
I would not change the class members but the return is displayed as the root node, the name of the "Asegurado" and after it, each of its members.
Is it possible?
May 07, 2012 08:55 AM|LINK
Your intention is not clear to me but if you want to generate your own custom SOAP messages you should use a MessageContract instead of a DataContract:
http://msdn.microsoft.com/en-us/library/ms730255.aspx
May 07, 2012 04:18 PM|LINK
I've tried to use messagecontract but I get message error if i use:
<OperationContract()> Function obtenerDatosCliente(ByVal num As String) As Asegurado
If you want to use this operation contract I have to define:
<OperationContract()>Function obtenerDatosCliente(ByVal num As InputRequest) As Asegurado
<MessageContract()>_public class InputRequest <MessageBodyMember()>_Public num as String End Class
Can not work with simple data entry using MessageContract??
neko_zgz
0 Points
4 Posts
WCF - wsdl generation working with objects
May 03, 2012 04:24 PM|LINK
Working with WCF, given the following operation contract that returns an "Asegurado" object. I want, in returning xml generated, show the item
after the itemOperation:
Response:
How can i achieve this without changing returning object in the OperationContract?
</div>wsdl WCF
mm10
Contributor
6455 Points
1187 Posts
Re: WCF - wsdl generation working with objects
May 05, 2012 02:41 PM|LINK
Set the Order parameter of the DataMemberAttribute for the property in the DataContract to 0.
[DataContract]
public class Asegurado
{
[DataMember(Order=0)]
public string Asegurado {get;set;}
.....
}
neko_zgz
0 Points
4 Posts
Re: WCF - wsdl generation working with objects
May 05, 2012 09:44 PM|LINK
I would not change the class members but the return is displayed as the root node, the name of the "Asegurado" and after it, each of its members.
Is it possible?
mm10
Contributor
6455 Points
1187 Posts
Re: WCF - wsdl generation working with objects
May 07, 2012 08:55 AM|LINK
Your intention is not clear to me but if you want to generate your own custom SOAP messages you should use a MessageContract instead of a DataContract:
http://msdn.microsoft.com/en-us/library/ms730255.aspx
neko_zgz
0 Points
4 Posts
Re: WCF - wsdl generation working with objects
May 07, 2012 04:18 PM|LINK
I've tried to use messagecontract but I get message error if i use:
If you want to use this operation contract I have to define: