Hi,
I am facing the same problem since 2 days ago.
Then I take source of Spring.Net, add in my Solution to know it better.
I have found at CoreGetHandler.Invoke(this, new object[] {serviceType, context, context.Request, context.Response});
Then I have discover the base {System.SystemException " This operation requires IIS integrated pipeline mode."}
http://forums.iis.net/t/1158950.aspx
http://forums.asp.net/p/1253457/2323117.aspx
But as we are using Visual Studio and not using IIS yet . . .
I have found this:
Code:
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://model.iuni.com.br")]
[System.Xml.Serialization.XmlRootAttribute("SecurityToken", Namespace = "http://model.iuni.com.br", IsNullable = false)]
public class AuthenticationSoapHeader : SoapHeader
{
private string _devToken;
private string _user;
private string _pwd;
public AuthenticationSoapHeader()
{
}
public AuthenticationSoapHeader(string devToken)
{
this._devToken = devToken;
}
[System.Xml.Serialization.XmlTextAttribute()]
public string ClientToken
{
get { return this._devToken; }
set { this._devToken = value; }
}
[System.Xml.Serialization.XmlTextAttribute()]
public string Usuario
{
get { return this._user; }
set { this._user = value; }
}
[System.Xml.Serialization.XmlTextAttribute()]
public string Senha
{
get { return this._pwd; }
set { this._pwd = value; }
}
}
And then put this into my web.config:
Code:
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="CustomHeader" value="Namespace.AuthenticationSoapHeader" />
<customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
My Service class, that I am also using it as Fluorine Remoting inside Adobe Flex looks likes:
Code:
[RemotingService]
[XmlInclude(typeof(VO.Paises))]
public class Paises : Services.Interfaces.IPaises
{
public Repositorys.Auxil.IPaises paisesDAO;
private static readonly ILog SysLOG = LogManager.GetLogger(typeof(Paises));
public Services.AuthenticationSoapHeader AutenticaSoapHeader;
[Transaction(ReadOnly=true)]
public VO.Paises[] Lista()
{
if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Items.Contains("AutenticaSoapHeader"))
{
AutenticaSoapHeader = (Services.AuthenticationSoapHeader)System.Web.HttpContext.Current.Items["AutenticaSoapHeader"];
}
if (!Security.Check(typeof(VO.Paises), AutenticaSoapHeader, "Lista"))
{ throw new Exception("Acesso Negado!"); //Access Denied
}
else
{
List<VO.Paises> listaPaises = new List<VO.Paises>(paisesDAO.Lista());
return listaPaises.ToArray();
}
}
My Spring configuration looks like:
Code:
<object id="PaisesService" type="Spring.Web.Services.WebServiceExporter, Spring.Web">
<property name="TargetName" value="PaisesSRV" />
<property name="Namespace" value="http://www.myclientdomain.com.br/WebServices" />
<property name="Description" value="Lista de Paises Cadastrados no sistema" />
<property name="MemberAttributes">
<dictionary>
<entry key="Lista">
<list>
<object type="System.Web.Services.Protocols.SoapHeaderAttribute, System.Web.Services">
<constructor-arg name="memberName" value="AutenticaSoapHeader"/>
</object>
</list>
</entry>
</dictionary>
</property>
</object>
That works for me.
Tell me if you guys found another way to solve this problem.
Regards,
Elton Bicalho do Carmo