.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Soap Request pass xml to web method

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net


my web method(server) is as follows

        public bool UploadXML(string xmldoc)



and creating soap request and pass to this method while passing normal string it comes but when passing xml i get null value

please find below code which is written in my client side code

StringBuilder soap = new StringBuilder();

soap.Append(@"<?xml version=""1.0"" encoding=""utf-8""?>");
             soap.Append(@"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">");
             soap.Append(@"<m:UploadXML xmlns:m=""http://tempuri.org/\"">");

View Complete Post

More Related Resource Links

Any way to re-route soap request to different method using soap extensions?

Not sure if this is possible, but is there any way (using soap extensions) to intercept a soap message and re-route it to a different method on the web service host?  I am able to intercept and replace the method name in the xml, but it still goes to the original method.

How to Pass higher Length of Byte Array to the remoting method

Dear all,I am using a windows application and the businness logic is present in the remote server.Once particular method takes bytearray as input parameter...Whenever the method call is made the function returns value .This is limited for the particular bytearray length. (4109228 bytes).If the length of bytearray crosses 4109228 bytes.I am getting an error that "input stream is not valid binary format".How to Pass higher Length of Byte Array to the remoting method... Greater than 4 MB?I believe something is missing in web.config or app.config...?What could be the issue...? Any sugesstions are welcome....ThanksRavikumar

Capture and pass "abc\xyz" as a string into my WCF method

Hi All, I am trying to implement WCF Method where client has to pass like "abc\xyz" as a string i have to capture it and pass to my method. I am not able to do it. In our application we can split the string  and we can do what ever we can do . but string comes from client site so who do i capture into my method. I am very much new in WCF. Could u please help me. Thanks Shekhar  

sending xml inside a soap request with HttpWebRequest

Im trying to send some xml inside a soap request to a webservice using the HttpWebRequest class.  I know this isnt the best way, but my hands are tied by company policy so i have to do it this way.  My webmethod has an input parameter  "SourceXML"  so my soap request has this node<SourceXML></SourceXML>I need to insert the xml in this node but whenver I insert it and try to send it to my web method I get an error "400 bad request"Is this even possible ?  I need to insert the xml as a string literal and read it in the web methodStringBuilder sb = new StringBuilder(_soapEnv); -- soap enevlope template containing the SourceXML node sb.Insert(sb.ToString().IndexOf("</SourceXML>"), the xml I want to insert in the node); sendmessage(url, webmethod, sb.ToString()) -- send the message to the webserviceIf I put plain text in the string builderegsb.Insert(sb.ToString().IndexOf("</SourceXML>"), "this is a test");everything works ok, but as soon as i put some xml in it fails. Am I going about this in the right way ?basically my webmethod will have 2 input parameters, some xml and an object, but I just cant get it to work. Can anyone help ?

How to pass parameters from Application Main method to modules.

Hi , We created Prism WPF application.we have to pass some parameters(some information) to modules(they are instantiated by Bootstrapper) from Main method of App.xaml  Thanks in Advance.

WCF Method that receive GET AND SOAP Requests

i created a WCf service with a method that can receive GET requests using WebGET attribute, i want the same method to receive Soap calls too (that when the programmer does a Service reference to the WCF, he will be able to call the method). my interface is:   [ServiceContract] public interface IService1 { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] string GetData(int value); }   My configuration is: <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="WebBehavior"> <webHttp /> </behavior> </endpointBehaviors> </behaviors> <services> <service name="WCFTestingGetService.Service1" behaviorConfiguration="MyServiceBehavior" > <endpoint address="" binding="webHttpBinding" contract="WCFTestingGetService.IService1" behaviorConfiguration="Web

Work with SOAP requests via Raw request

I will handle SOAP requests via IHttpRequest. What best way to work with raw SOAP requests (mean how desearialize etc)?

Need help in reading Soap request and response on invoking WCF client assembly

Hi All,   I'm new to WCF and i'm using .Net 3.5. I have created a library from the proxy class generated through svcutil. I'm able to succesfully invoke service methods. I was wondering how to capture the request and response soap xmls so that i could render it on browser. If you have any code piece for this kind of problem please share it with me. Regards, Rahul

Seeing the SOAP request sent from a Web Service Client/Consumer

Hello, I am building a web service consumer in C# in VS2010.  Using the provided WSDL, I need to build appropriate headers and use certificates, SSL (user name & pass), & WS security.  I am getting an error from the webservice side, specifically processing the <wsse:Security> header. Is it possible for me to see the exact request I am sending to the Webservice? I'd like to see the values of the pieces of the header that get put in and such. Is it possible to have human readable serialization of what's being passed in right before the error? Thank You

PUT method gives error 400 "Bad Request" in WCF REST Service Application

I am trying to learn WCF REST Services through http://blogs.msdn.com/endpoint/archive/2010/01/14/updating-state-in-wcf-webhttp-services.aspx , It's a link of Part 3 of 12 part blog series. Now I am trying the same stuff given in the part 3 with my own Entities and Entity Model instead of what is given in the blog. Here is my full project I am working on .. http://cid-9e3f62c0688824b0.skydrive.live.com/self.aspx/.Public/pronerveEPMS.zip For comparision with the code shown in the Blog I am following, you can download the zip file of the project from the same link given here at starting (At the end of the blog and before comments starts). And here is the method in Program.cs file of console project in my application that raises the exception.....        private static Role UpdateRole(HttpClient hc, Role role1)        {            Console.WriteLine("Updating Role {0} : ",     role1.RoleID);            Console.WriteLine();            string updateURI = "Roles/" + role1.RoleID.ToString();            HttpContent content = HttpContentExtensions.CreateDataContract(role1);            using (HttpResponseMessage response = hc.Put(upd

Why request parameter added to client side code in each method while using svcutil.exe

Hi, I am using WCF services in my project and want to call WCF methods asynchronously. I am hosting WCF service programmatically in windows app as follows svc = New ServiceHost(GetType(Service1), New Uri("net.tcp://localhost:8806/")) Dim svcMDB As New ServiceMetadataBehavior svc.Description.Behaviors.Add(svcMDB) svc.AddServiceEndpoint(GetType(Service1), New NetTcpBinding(), "MyBusiness/MyBusinessService/") svc.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "MyBusiness/MyBusinessService/mex") svc.Open() Me.Text = "Service started...." and I am generating client side proxy using svcutil.exe as follows. svcutil /n:net.tcp://localhost:8806/MyBusiness/MyBusinessService,MyService net.tcp://localhost:8806/MyBusiness/MyBusinessService/mex /a /language:vb   The result of this command is as :   Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved.   Attempting to download metadata from 'net.tcp://localhost:8806/MyBusiness/MyBusi nessService/mex' using WS-Metadata Exchange. This URL does not support DISCO. Generating files... D:\Prabodh\New C2k\Test Projects\DataTableToArray\MyHost\bin\Debug\MyBusinessSer vice.vb D:

ASMX to WCF Soap request

I have a .asmx service that I need to convert to WCF. The service receives xml requests via the request input stream,  parses xml and sends clients back a response also in xml. The clients are sending SOAP requests. I have to make this change transparent to the clients. I'm somewhat new to WCF so i'm wondering what would be the best solution. REST looks good but I need to support SOAP. Is it possible to use basicHTTPBinding for my needs?

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

How to pass response or fault soap message to other end point using WCF?


I have changed the ReplyTo and FaultTo of SOAP Message Headers in WCF ,

and I d like  the response message can be sent to other service endpoint,

I tested it,But Response Message could not be sent to other service.

How can I make it?

Thanks in advance.


Frank Xu Lei--????,????
Focus on Distributed Applications Development and EAI based on .NET




Sign outgoing client request SOAP body with WSE 3.0



We currently have the code in WCF to sign the outgoing client requests' SOAP Body, however we need the same code for use with WSE 3.0.  I can't find any examples of this.  

Is it possible?  If so, does anyone have an example?

Thank you,

view soap request message


I am consuming a .net 2.0 webservice from a class library and calling this class from a web page form . When a user inputs and saves the data in the form it will call the class and inturn send the user inputted data over webservice. I want to view the Soap messages like request and response going from my dll to the webservice. I tried fiddler but with no luck. So I created a class mentioned here: http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension(v=VS.90).aspx

and added the in the dll.config file like this and it was also of no help. By the way the end webservice is https not http.




        <add type="SoapTrace.TraceExtension" priority="2" group="High" />





Any pointers are greatly appreciated, thanks in advance

Simple ASP.NET SOAP request to return string



I have a requirement to build a simple ASP.NET web page which sends some parameters to a web service, and then displays the string which was returned.

I'm a complete .NET newby and the only examples I can find seem really really complex.  I just need something mega simple, but which an handle parameters being sent to the web service.  Can anyone point me in the direction of a simple bit of C# which will do this with no frills or fuss?

Any help much appreciated, thanks!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend