What should you do?

A Web service returns a Node object X that references Node object Y.
Node object Y also references Node object X.
When the Web service method is called in a way that returns Node object X, the following exception is thrown.

System.InvalidOperationException: A circular reference was detected while serializing an object of type Node.

You need to ensure that the Web service method runs without generating the exception.
Your code must preserve the circular reference between the Node objects.

What should you do?

A Web service returns a Node object X that references Node object Y.
Node object Y also references Node object X.
When the Web service method is called in a way that returns Node object X, the following exception is thrown.

System.InvalidOperationException: A circular reference was detected while serializing an object of type Node.

You need to ensure that the Web service method runs without generating the exception.
Your code must preserve the circular reference between the Node objects.

What should you do?

A.
Add the following attribute to the Web service method.
[SoapRpcMethod(Use=SoapBindingUse.Literal)]

B.
Add the following attribute to the Web service method.
[SoapRpcMethod(Binding = “Encoded”)]

C.
Add the following attribute to the Web service method.
[SoapRpcMethod(Use=SoapBindingUse.Encoded)]

D.
Add the following attribute to the Web service method.
[SoapRpcMethod(Binding = “Literal”)]



Leave a Reply 0

Your email address will not be published. Required fields are marked *