Click here to Skip to main content
15,906,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: IEnumerable - why does this code work? Pin
VJ Reddy13-Apr-12 20:45
VJ Reddy13-Apr-12 20:45 
GeneralRe: IEnumerable - why does this code work? Pin
jeramyRR13-Apr-12 20:46
jeramyRR13-Apr-12 20:46 
GeneralRe: IEnumerable - why does this code work? Pin
Abhinav S13-Apr-12 20:48
Abhinav S13-Apr-12 20:48 
QuestionHow to provide the articles in nice way Pin
Anurag Sarkar13-Apr-12 9:21
Anurag Sarkar13-Apr-12 9:21 
AnswerRe: How to provide the articles in nice way Pin
PIEBALDconsult13-Apr-12 9:28
mvePIEBALDconsult13-Apr-12 9:28 
GeneralRe: How to provide the articles in nice way Pin
Anurag Sarkar13-Apr-12 9:37
Anurag Sarkar13-Apr-12 9:37 
AnswerRe: How to provide the articles in nice way Pin
Abhinav S13-Apr-12 20:43
Abhinav S13-Apr-12 20:43 
Questionhow to add soap headers to the xml generated from webservice using c#.net 4.0 Pin
anandsurya13-Apr-12 3:39
anandsurya13-Apr-12 3:39 
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-; 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 >

AnswerCross posted Pin
Pete O'Hanlon13-Apr-12 4:06
mvePete O'Hanlon13-Apr-12 4:06 
GeneralRe: Cross posted Pin
vishal ch surve13-Apr-12 17:32
vishal ch surve13-Apr-12 17:32 
GeneralRe: Cross posted Pin
Pete O'Hanlon13-Apr-12 21:55
mvePete O'Hanlon13-Apr-12 21:55 
AnswerRe: how to add soap headers to the xml generated from webservice using c#.net 4.0 Pin
BobJanova13-Apr-12 4:08
BobJanova13-Apr-12 4:08 
Questionmove ball in c# form with timer Pin
saeedjaafari13-Apr-12 3:02
saeedjaafari13-Apr-12 3:02 
AnswerRe: move ball in c# form with timer Pin
V.13-Apr-12 3:25
professionalV.13-Apr-12 3:25 
GeneralRe: move ball in c# form with timer Pin
saeedjaafari13-Apr-12 3:29
saeedjaafari13-Apr-12 3:29 
GeneralRe: move ball in c# form with timer Pin
V.13-Apr-12 3:33
professionalV.13-Apr-12 3:33 
GeneralRe: move ball in c# form with timer Pin
saeedjaafari13-Apr-12 3:45
saeedjaafari13-Apr-12 3:45 
GeneralRe: move ball in c# form with timer Pin
V.13-Apr-12 3:47
professionalV.13-Apr-12 3:47 
GeneralRe: move ball in c# form with timer Pin
saeedjaafari13-Apr-12 3:51
saeedjaafari13-Apr-12 3:51 
GeneralRe: move ball in c# form with timer Pin
V.13-Apr-12 3:57
professionalV.13-Apr-12 3:57 
GeneralRe: move ball in c# form with timer Pin
saeedjaafari13-Apr-12 4:04
saeedjaafari13-Apr-12 4:04 
GeneralRe: move ball in c# form with timer Pin
vishal ch surve13-Apr-12 22:31
vishal ch surve13-Apr-12 22:31 
GeneralRe: move ball in c# form with timer Pin
vishal ch surve13-Apr-12 22:34
vishal ch surve13-Apr-12 22:34 
AnswerRe: move ball in c# form with timer Pin
Luc Pattyn13-Apr-12 6:19
sitebuilderLuc Pattyn13-Apr-12 6:19 
GeneralRe: move ball in c# form with timer Pin
saeedjaafari13-Apr-12 6:54
saeedjaafari13-Apr-12 6:54 

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.