Johnny5
Johnny5

Reputation: 6852

Partial use of WSE2

I'm coding a .Net web service that will replace an old one. In order not to break existing clients, I must not change the interface. That means no WSE to access this web service.

The "old" web service was accessing directly to database.

The "new" one don't access database directly, it use another web service to do that. That other web service is used by a some other applications already.

So, basically, I'm writing a (public) web service in front of another (private) web service.

Let call the new public web service "Front", and the existing private web service "Back".

The problem is that "Back" requires WSE2 authentication, while "Front" needs to be reachable without WSE2.

How do I configure that in web.config? I have the microsoft.web.services2 section and and soapExtensionTypes sections like that:

<microsoft.web.services2>
  <diagnostics>
     <trace enabled="true" input="InputTrace.log" output="OutputTrace.log" />
  </diagnostics>
  <policy>
     <cache name="policyCache.config" />
  </policy>

  <webServices>
     <soapExtensionTypes>
        <add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.0.0,  [.....] />
     </soapExtensionTypes>
  </webServices>

I need those to conform to "Back", but then the clients calling "Front" need to conform to WSE2 too, witch I do not want.

Any help?

Upvotes: 0

Views: 262

Answers (1)

Johnny5
Johnny5

Reputation: 6852

Finally found the answer myselft, it's in the policy file. I had to define different endpoints for different policies. Something like that :

<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy">
     <!-- calls to this web services will use wse -->
     <endpoint uri="http://the.service.that.needs.wse2.asmx">
        <defaultOperation>
           <request policy="#Sign-Username" />
           <response policy="" />
           <fault policy="" />
        </defaultOperation>        
     </endpoint>
    <!-- no policies for other endpoints -->
    <defaultEndpoint>
      <defaultOperation>
      </defaultOperation>
    </defaultEndpoint>
  </mappings>
  <policies [...]>
    [...]
  </policies>
</policyDocument>

Now I would like to find how to dynamically configure the endpoint uri, but that will be possibly another question.

Upvotes: 2

Related Questions