Security Exeption when calling Webservice with .NET Code in Infopath Document - opend over Sharepoin

B

Benjamin Kremer

Hello Everybody,

my project seems to be going to an end. But there is one little Problem :

I made al little Infopath- document which gets it´s data from .Net Code, the
date is pasted to the DOM with the XMLDocument.AppendChild() or
..insertBefore Method.

The .Net Code get´s it´s data from a XML Webservice, which gives it´s
results via a DataSet. The .Net- Code splits the dataset into XMLNodes and
adds them to the Document- DOM.

Everything works fine when I open the Form locally. But when I publish this
form to a Sharepoint Document Libary, I´ll get the following error by
calling the .Net Code in the form (Sorry, German):

Anforderung des Berechtigungstyps System.Net.WebPermission, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ist
fehlgeschlagen.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at billy.Service1.GetWMIData(String strServername, String strUsername,
String strPassword, String strClass, String strProperty)
at CPP_Win_Server.CPP_Win_Server.FillServerData()
at CPP_Win_Server.CPP_Win_Server.btnGetData_OnClick(DocActionEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent
pEvent)

Due to the line "at billy.Service1.GetWMIData(String strServername, String
strUsername, String strPassword, String strClass, String strProperty)
", it seemd that the Webservice- Call fails. But I´ve no idea why ...

Thanks for Support !

Benjamin
 
M

Michelle

The error message indicates that you need to fully trust your form. Try
making your form fully trusted.
 
M

Matthew Blain \(Serriform\)

You should also be able to do it with a specific .NET policy, though I don't
know which one off the top of my head.

Michelle said:
The error message indicates that you need to fully trust your form. Try
making your form fully trusted.

Benjamin Kremer said:
Hello Everybody,

my project seems to be going to an end. But there is one little Problem :

I made al little Infopath- document which gets it´s data from .Net Code, the
date is pasted to the DOM with the XMLDocument.AppendChild() or
..insertBefore Method.

The .Net Code get´s it´s data from a XML Webservice, which gives it´s
results via a DataSet. The .Net- Code splits the dataset into XMLNodes and
adds them to the Document- DOM.

Everything works fine when I open the Form locally. But when I publish this
form to a Sharepoint Document Libary, I´ll get the following error by
calling the .Net Code in the form (Sorry, German):

Anforderung des Berechtigungstyps System.Net.WebPermission, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ist
fehlgeschlagen.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at billy.Service1.GetWMIData(String strServername, String strUsername,
String strPassword, String strClass, String strProperty)
at CPP_Win_Server.CPP_Win_Server.FillServerData()
at CPP_Win_Server.CPP_Win_Server.btnGetData_OnClick(DocActionEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnCl
ick(DocActionEvent
pEvent)

Due to the line "at billy.Service1.GetWMIData(String strServername, String
strUsername, String strPassword, String strClass, String strProperty)
", it seemd that the Webservice- Call fails. But I´ve no idea why ...

Thanks for Support !

Benjamin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top