Error: "Request does not contain required security header".

book

Article ID: 177392

calendar_today

Updated On:

Products

Security Information Manager

Issue/Introduction

I need to hook into the events Web Service for a client. I am developing in Visual Studio 2005 VB. I get a "Request does not contain required security header". How do I add the security header to the request object in code?

Resolution

You need to use WSE 3.0 and configure your project to enable Web Services Enhancement. Create new Application policy (Username). Let's call it "ClientPolicy" Then following sample code should solve this issue.

Note: The following code is provided as a convenience and reference only. SSIM technical support cannot debug or troubleshoot Web Service code.

 Dim c As EventService.EventAccessServiceWse = New EventService.EventAccessServiceWse() Dim userToken As UsernameToken = New UsernameToken("Administrator", "password", PasswordOption.SendPlainText)
c.SetClientCredential(userToken)
c.SetPolicy("ClientPolicy")

Dim r As EventService.SearchEventsRequest = New EventService.SearchEventsRequest()
r.MaxEventResult = 100

Dim t As EventService.TimeSpan = New EventService.TimeSpan()
t.start = New Date(2008, 10, 20)t.end =

New Date(2008, 10, 29)
r.TimeSpan = t
r.Expression = "product_id=3001"
c.SearchEvents(r)