WSE 3.0 Sample works in Windows but not in ASP.NET app
Hi all,
The WSE 3.0 samples and quickstart comes with quick start certificates and Windows based clients and WSE enabled WebServices.
The problem I am facing is, -
I am trying to use Policy
available in "Microsoft WSE\v3.0\Samples\CS\QuickStart\Security\SecureConversation\Policy" folder.
I use the same server and WSE config. but instead of using windows client I am using ASP.NET normal application (not even forms authentication).
I did the same coding as in windows sample,
Had to modifiy client policy as per given below.
<policy name="ClientPolicy">
<mutualCertificate11Security establishSecurityContext="false" renewExpiredSecurityContext="true" requireSignatureConfirmation="true" messageProtectionOrder="SignBeforeEncrypt" requireDerivedKeys="true" ttlInSeconds="300">
<clientToken>
<x509 storeLocation="LocalMachine" storeName="My" findValue="CN=WSE2QuickStartServer" findType="FindBySubjectDistinguishedName" />
</clientToken>
<serviceToken>
<x509 storeLocation="LocalMachine" storeName="My" findValue="CN=WSE2QuickStartServer" findType="FindBySubjectDistinguishedName" />
</serviceToken>
<protection>
<request signatureOptions="IncludeAddressing, IncludeTimestamp, IncludeSoapBody" encryptBody="true" />
<response signatureOptions="IncludeAddressing, IncludeTimestamp, IncludeSoapBody" encryptBody="true" />
<fault signatureOptions="IncludeAddressing, IncludeTimestamp, IncludeSoapBody" encryptBody="false" />
</protection>
</mutualCertificate11Security>
<requireActionHeader />
</policy>
apparently it is not working. It gives security error.
Here is the complete message , -
WSE910: An error happened during the processing of a response message, and you can find the error in the inner exception. You can also find the response message in the Response property.
at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType) at Microsoft.Web.Services3.WebServicesClientProtocol.GetReaderForMessage(SoapClientMessage message, Int32 bufferSize) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at localhost.WSSecurityCertificateServiceWse.StockQuoteRequest(String[] symbols) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mywssecuritycertificatepolicyclient\0f416b4b\efd0806d\App_WebReferences.gf_sqtll.0.cs:line 60 at _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\MyWSSecurityCertificatePolicyClient\Default.aspx.cs:line 40
Security requirements are not satisfied because the security header is not present in the incoming message.
at Microsoft.Web.Services3.Security.SecureConversationClientReceiveSecurityFilter.ValidateMessageSecurity(SoapEnvelope envelope, Security security) at Microsoft.Web.Services3.Security.ReceiveSecurityFilter.ProcessMessage(SoapEnvelope envelope) at Microsoft.Web.Services3.Pipeline.ProcessInputMessage(SoapEnvelope envelope) at Microsoft.Web.Services3.Xml.SoapEnvelopeReaderWrapper..ctor(SoapClientMessage message, String messageContentType)
Here is the code I am trying. very simple testing for policy but fails.
try
{
String[] symbols = { "FABRIKAM", "CONTOSO" };
WSSecurityCertificateServiceWse serviceProxy = new WSSecurityCertificateServiceWse();
// Configure the proxy
//ConfigureProxy(serviceProxy);
serviceProxy.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Default;
// Set the ClientPolicy onto the proxy
serviceProxy.SetPolicy("ClientPolicy");
StockQuote[] quotes = serviceProxy.StockQuoteRequest(symbols);
}
catch (Exception e1)
{
this.Response.Write(e1.Message);
this.Response.Write("<br>");
this.Response.Write(e1.StackTrace);
this.Response.Write("<br>");
if (e1.InnerException != null)
{
this.Response.Write(e1.InnerException.Message);
this.Response.Write("<br>");
this.Response.Write(e1.InnerException.StackTrace);
}
}
can any one give a pointer, link, url or highlight what is wrong !
-Paresh.

