Groups | Blog | Home
all groups > dotnet web services enhancements > may 2006 >

dotnet web services enhancements : custom policyquestion


ksen
5/24/2006 10:01:03 AM
I have a webservice which is built on WSE 2.0.

On the client side I am using .net2.0 and WSE 3.0. I added webreference to
the above webservice.
And also I added a custom filter to add some custom header elements.

Here is my question
Why the custom filter ProcessMessage method is not getting executed when I
invoke a webmethod/
I would really appreciate you help.



Here is some of my code from the web.config

<configSections>
<section name="microsoft.web.services3"
type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</configSections>

<microsoft.web.services3>
<policy filename="wse3policyCache.config"></policy>
<diagnostics>
<trace enabled="true" input="InputTrace.webinfo"
output="OutputTrace.webinfo" />
</diagnostics>
</microsoft.web.services3>


I created a configuration policy file called "wse3policyCache.config"

policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
<extensions>
<extension name="requireActionHeader"
type="Microsoft.Web.Services3.Design.RequireActionHeaderAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
<extension name="customFilter"
type="CustomPolicy.CustomPolicyAssertion, CustomPolicy"/>
</extensions>
<policy name="ClientPolicy">
<requireActionHeader />
<customFilter />
</policy>
</policies>

I created a policy assertion class(CustomPolicyAssertion) and soapfilter
class(ClientOutputFilter )


using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using System.Xml;
using Microsoft.Web.Services3;
using Microsoft.Web.Services3.Design;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;



namespace CustomPolicy
{

public class CustomPolicyAssertion: PolicyAssertion
{
public override SoapFilter CreateClientOutputFilter(FilterCreationContext
context)
{
return new ClientOutputFilter ();
}

public override SoapFilter CreateClientInputFilter(FilterCreationContext
context)
{
return null;
}

public override SoapFilter CreateServiceOutputFilter(FilterCreationContext
context)
{
return null;
}

public override SoapFilter CreateServiceInputFilter(FilterCreationContext
context)
{
return null;
}
}
}


using Microsoft.Win32;
using System;
using System.Xml;
using Microsoft.Web.Services3;
using System.Diagnostics;

namespace CustomPolicy
{
public class ClientOutputFilter : SoapFilter
{
public ClientOutputFilter()
{
}

public override SoapFilterResult ProcessMessage(SoapEnvelope envelope)

{
EventLog.WriteEntry("OutputFilter", "Processmessage");

//write code here to modify

return SoapFilterResult.Continue;
}
}
}
ksen
5/24/2006 1:30:01 PM
Hi Pablo,
Thanks for the quick response. I did not add clientpolicy to the proxy, But
now i do. Still not executing the ProcessMessage method

Here is the code
[Microsoft.Web.Services3.Policy("clientpolicy ")]
public partial class ServiceProxyWse :
Microsoft.Web.Services3.WebServicesClientProtocol. And also i don not see a
setpolicy method in my web proxy class.

Thanks
Senthil

[quoted text, click to view]
Pablo Cibraro
5/24/2006 2:17:09 PM
Hi Ken,

Did you set the "ClientPolicy" policy in the web service proxy ?. By the
way, WSE 2.0 and WSE 3.0 are not interoperable, you are going to need a lot
of plumbing code to make them work together.

Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax

[quoted text, click to view]

ksen
5/24/2006 6:13:02 PM
Hi Pablo

I got it to work. When i added a webreference on the client it created two
classes one with WSE at the end. On the client code I was using a proxy class
without WSE.
I changed the client code to use class with wse. Everything works now.

Thanks
Loyola stalin
5/30/2006 4:13:02 AM
Hi ksen,

I have the same problem,
Can u Just tell me, the client side server side policy details..

I have applied Encryption and Signature policy in both Client as well as
server side, it doe’s work.

Please tell me, What policy u have applied



Thanks and Regards
Loyola

[quoted text, click to view]
AddThis Social Bookmark Button