Click here to Skip to main content
15,949,686 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionProblem with Forms Authentication Provider Pin
Flum02113-Apr-12 7:39
Flum02113-Apr-12 7:39 
AnswerRe: Problem with Forms Authentication Provider Pin
Leonardo Metelis13-Apr-12 9:02
Leonardo Metelis13-Apr-12 9:02 
GeneralRe: Problem with Forms Authentication Provider Pin
Flum02113-Apr-12 23:50
Flum02113-Apr-12 23:50 
QuestionCalling public from Public Shared method Pin
byka13-Apr-12 4:21
byka13-Apr-12 4:21 
AnswerRe: Calling public from Public Shared method Pin
ekolis13-Apr-12 4:58
ekolis13-Apr-12 4:58 
GeneralRe: Calling public from Public Shared method Pin
byka13-Apr-12 5:12
byka13-Apr-12 5:12 
GeneralRe: Calling public from Public Shared method Pin
ekolis13-Apr-12 6:27
ekolis13-Apr-12 6:27 
Questionhow to add soap headers to the xml generated from webservice using c#.net 4.0 Pin
anandsurya13-Apr-12 3:38
anandsurya13-Apr-12 3:38 
XML
here is my sample code

webservice code

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(Name = "TestService", ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService {
// Add a member variable of the type deriving from SoapHeader.
public MyHeader timeStamp;

// Apply a SoapHeader attribute.
[WebMethod(Description = "A method that requires authentication")]
[SoapDocumentMethod(Binding = "TestService")]
[SoapHeader("timeStamp", Direction = SoapHeaderDirection.In)]
public string HelloWorld()
{
if (timeStamp == null)
timeStamp = new MyHeader();
timeStamp.MustUnderstand = true;
timeStamp.Expires = 60000;
timeStamp.Created = DateTime.UtcNow;

return "Hello World";
}


}


here is the client code

localhost.MyHeader header = new localhost.MyHeader();

// Populate the values of the SOAP header.
header.Expires = 60000;
header.Created = DateTime.UtcNow;

// Create a new instance of the proxy class.
localhost.WebService proxy = new localhost.WebService();

// Add the MyHeader SOAP header to the SOAP request.
proxy.MyHeaderValue = header;

// Call the method on the proxy class that communicates
// with your XML Web service method.

string results = proxy.HelloWorld();

i am getting result as "Hello World"

But i want it in format as

?xml version="1.0" encoding="utf-8"?>
<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:Header>
<MyHeader xmlns="http://tempuri.org/">
<Created>dateTime</Created>
<Expires>long</Expires>
</MyHeader>
</soap:Header>
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope >

AnswerRe: how to add soap headers to the xml generated from webservice using c#.net 4.0 Pin
jkirkerx13-Apr-12 12:49
professionaljkirkerx13-Apr-12 12:49 
QuestionReport Viewer Align Problem Pin
jasmin.sayyad13-Apr-12 0:36
jasmin.sayyad13-Apr-12 0:36 
AnswerRe: Report Viewer Align Problem Pin
ZurdoDev13-Apr-12 5:51
professionalZurdoDev13-Apr-12 5:51 
QuestionASP.Net Data Grid View Pin
fire_hawk12-Apr-12 22:57
fire_hawk12-Apr-12 22:57 
AnswerRe: ASP.Net Data Grid View Pin
SaurabhSavaliya13-Apr-12 0:00
SaurabhSavaliya13-Apr-12 0:00 
AnswerRe: ASP.Net Data Grid View Pin
Syed Zoheb Ali Sumair16-Apr-12 5:45
Syed Zoheb Ali Sumair16-Apr-12 5:45 
Questionadd url by code Pin
apadana_198912-Apr-12 12:38
apadana_198912-Apr-12 12:38 
AnswerRe: add url by code Pin
Bernhard Hiller12-Apr-12 21:27
Bernhard Hiller12-Apr-12 21:27 
QuestionRe: add url by code Pin
ZurdoDev13-Apr-12 5:52
professionalZurdoDev13-Apr-12 5:52 
QuestionTextBox in a ListView control using jquery Pin
indian14312-Apr-12 3:24
indian14312-Apr-12 3:24 
AnswerRe: TextBox in a ListView control using jquery Pin
ZurdoDev13-Apr-12 5:53
professionalZurdoDev13-Apr-12 5:53 
Questionopen a visual studio 2010 file Pin
dcof11-Apr-12 12:31
dcof11-Apr-12 12:31 
AnswerRe: open a visual studio 2010 file Pin
Wes Aday12-Apr-12 4:58
professionalWes Aday12-Apr-12 4:58 
GeneralRe: open a visual studio 2010 file Pin
dcof12-Apr-12 8:39
dcof12-Apr-12 8:39 
Questionusing iis in vs 2010 Pin
dcof11-Apr-12 4:47
dcof11-Apr-12 4:47 
AnswerRe: using iis in vs 2010 Pin
JHizzle11-Apr-12 5:18
JHizzle11-Apr-12 5:18 
AnswerRe: using iis in vs 2010 Pin
RichardGrimmer11-Apr-12 5:21
RichardGrimmer11-Apr-12 5:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.