Monday, March 26, 2012

Html encoding SOAP response

Is there anyway I can make my xml webservice not htmlencode the response
from a call to an API?

I have:
public int PerformOperation(string operation, out string result)

The content of result is html encoded, but since it contains valid xml,
I should get away with not htmlencoding it, or not?

<soap:Body
<PerformOperationResponse xmlns="http://tempuri.org/"
<PerformOperationResult
0

</PerformOperationResult
<result
<RetrieveTreeResponse id="123"
<Node id="1"
title="TopLevelNode1"
<Node id="2"
title="2LevelNode1" /
<Node id="3"
title="2LevelNode2" /
</Node
<Node id="4"
title="TopLevelNode2" /
</RetrieveTreeResponse
</result
</PerformOperationResponse
</soap:Body
Casper Hornstrup wrote:

> Is there anyway I can make my xml webservice not htmlencode the response
> from a call to an API?
> I have:
> public int PerformOperation(string operation, out string result)
> The content of result is html encoded, but since it contains valid xml,
> I should get away with not htmlencoding it, or not?

Try to use a parameter of type XmlNode instead of a string.

> <soap:Body>
> <PerformOperationResponse xmlns="http://tempuri.org/">
> <PerformOperationResult>
> 0
> </PerformOperationResult>
> <result>
> <RetrieveTreeResponse id="123">
> <Node id="1"
> title="TopLevelNode1">
> <Node id="2"
> title="2LevelNode1" />
> <Node id="3"
> title="2LevelNode2" />
> </Node>
> <Node id="4"
> title="TopLevelNode2" />
> </RetrieveTreeResponse>
> </result>
> </PerformOperationResponse>
> </soap:Body>
>

--

Martin Honnen
http://JavaScript.FAQTs.com/

No comments:

Post a Comment