0

I have a developed a windows service in C#. The service sends a request to a webservice and expected to receive a response. when a send the request, i receive the below response

<faultcode>wsse:InvalidSecurity</faultcode>
 <faultstring>Missing wsse:Security header in request</faultstring>

I have received the .cer file from the partner(the owners of the webservice which an invoking). How can i install this to my windows service? Alternatively how can i get the security header of the certificate then i can hardcode it to my code and send it together with my request?

Lawrence
  • 485
  • 3
  • 8
  • 22
  • Using WCF. How do you create the request? – CodeCaster Jan 06 '15 at 07:02
  • Its not a WCF, its a windows service. I constructed the xml on my code then send the request. //Create XML xml = ""; xml = xml + ""; – Lawrence Jan 06 '15 at 07:07
  • Thats just a snippet of the xml i constructed – Lawrence Jan 06 '15 at 07:08
  • How to you send the request? Do you have a code snippet? What kind of authentication does the webservice expect? – Martin Jan 06 '15 at 07:10
  • You can use WCF to consume SOAP services. Let WCF handle the creation of the message and the appropriate headers. If you don't want to use WCF, search the web for "wsse:security X.509 certificate" and figure it out yourself. – CodeCaster Jan 06 '15 at 07:10
  • @Martin i have no idea of the kind of authentication the webservice expects, just saw the above warning. How can i confirm this? – Lawrence Jan 06 '15 at 07:13
  • @Martin this is how am sending the request HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://101.168.76.69:12899/btaWebService/services/paymentReportServiceHttpSoap11Endpoint/"); – Lawrence Jan 06 '15 at 07:17
  • Constructing XML by bodging strings together is a *really* bad idea and a way to end up with really brittle code that doesn't actually properly deal with XML. Prefer to use libraries where possible (i.e. even if you're not going to use WCF, at least use `XmlDocument` or `XDocument` or similar rather than building up strings). – Damien_The_Unbeliever Jan 06 '15 at 07:29

0 Answers0