I have an ASP.Net web service

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web; using System.Web.Services; namespace WebApplication1 { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld(int i) { return "Hello World"; } } } 

Now it returns such XML

 <?xml version="1.0" encoding="UTF-8"?> <string xmlns="http://tempuri.org/">Hello World</string> 

How do I make it return as a SOAP message?

  • Why do you use ASMX? Why not WCF? - Pavel Mayorov
  • How to make a call to the service? asmx should return a valid soap response. - kmv
  • I use ASMX because I need to access the URLs of the methods. (WCF was at the beginning, tried to do it as REST, but also failed to get the response in SOAP format) I call the server via a standard page or via Soap UI - Vlad B

0