I think, I have the solution:
1. The important thing is that you use special settings:
----------------------------------------------------------------
In you app.config these items must be:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="PolarionWS.SessionExtension,PolarionWS"
priority="1"
group="High" />
</soapExtensionTypes>
</webServices>
</system.web>
</configuration>
2. And there must be a special class in your addin (sub)assembly :
--------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
using System.Xml;
namespace PolarionWS
{
/// <summary>
/// Class for extending SoapExtension class
/// </summary>
public class SessionExtension : System.Web.Services.Protocols.SoapExtension
{
private const string session_ns = "
http://ws.polarion.com/session";
private const string session_name = "sessionID";
private static string sessionId;
/// <summary>
/// Overrides process message function
/// </summary>
/// <param name="message"></param>
public override void ProcessMessage(System.Web.Services.Protocols.SoapMessage message)
{
if (message.Stage == System.Web.Services.Protocols.SoapMessageStage.AfterDeserialize)
{
//if after deserialisation
foreach(SoapUnknownHeader header in message.Headers)
{
if (header.Element.LocalName == session_name && header.Element.NamespaceURI == session_ns)
{
sessionId = header.Element.InnerText;
}
}
}
else if (message.Stage == System.Web.Services.Protocols.SoapMessageStage.BeforeSerialize && sessionId != null)
{
//if before deserialisation
SoapUnknownHeader header = new SoapUnknownHeader();
XmlDocument doc = new XmlDocument();
header.Element = doc.CreateElement("session", session_name, session_ns);
header.Element.InnerText = sessionId;
message.Headers.Add(header);
}
}
/// <summary>
/// Gets session
/// </summary>
public static string session
{
get
{
return sessionId;
}
}
public override object GetInitializer(Type serviceType)
{
return null;
}
public override object GetInitializer(System.Web.Services.Protocols.LogicalMethodInfo methodInfo, System.Web.Services.Protocols.SoapExtensionAttribute attribute)
{
return null;
}
public override void Initialize(object initializer)
{
}
}
}
and 3. The application which uses this library must use these configs
-------------------------------------------------------------------------------
I have created a file EA.exe.config and filled with same content as app.config (see above) and added to installation directory of EA (d:\programme\Sparx\EA)
So the application will use these settings when using webservices