Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
While calling the API I am getting the response as below

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">ABC</string>


How Can It Be removed while creating WCF service???
Posted
Updated 23-Jul-18 1:10am
Comments
Rajat_RJT 3-Apr-15 5:27am    
can you show us your interface and web.config?
mayank.bhuvnesh 3-Apr-15 5:30am    
Check below link for ny code


http://www.codeproject.com/Questions/890817/How-to-call-WCF-URL?arn=0
Rajat_RJT 3-Apr-15 8:16am    
then how you want your response should look like?
mayank.bhuvnesh 3-Apr-15 8:38am    
The response in this case should be only ABC. Why it is enclosed in string tags???????

You can try setting BodyStyle to bare:
C#
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare)]
public string GetString()
{
    return "ABC";
}
 
Share this answer
 
Comments
mayank.bhuvnesh 3-Apr-15 4:21am    
BodyStyle.Bare is by default.
I have checked the same by setting it to Bare but the response is same means there is no change in the response.
public String cleanOUTPUT(String OUTPUT) {
OUTPUT = OUTPUT.replaceAll("","");
OUTPUT = OUTPUT.replaceAll("", "");
return OUTPUT;
}
 
Share this answer
 
Comments
Richard Deeming 23-Jul-18 11:23am    
THREE YEARS too late, and a with solution that does nothing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900