Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2006

Tip: Looking for answers? Try searching our database.

custom policyquestion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ksen - 24 May 2006 18:01 GMT
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;
        }
    }
}
Pablo Cibraro - 24 May 2006 19:17 GMT
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

>I have a webservice which is built on WSE 2.0.
>
[quoted text clipped - 110 lines]
> }
> }
ksen - 24 May 2006 21:30 GMT
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

> Hi Ken,
>
[quoted text clipped - 120 lines]
> > }
> > }
ksen - 25 May 2006 02:13 GMT
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
ksen
Loyola stalin - 30 May 2006 12:13 GMT
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

> Hi Pablo
>
[quoted text clipped - 5 lines]
> Thanks
> ksen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.