Hi,
I have created web enable Form template in Infopath.
I am submitting data in SQL table using webservice in this form template.
I have set Full Trust for this form template.
In Infopath its working perfectly.
Now when I try to get this published form template on webpage using XMLFormView control its returning error. Means its not working after getting it on web page.
My code:
Mypage.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="InfoandWS.aspx.vb" Inherits="CustomPage_InfoandWS" EnableSessionState="True" %>
<%@ Register Assembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Namespace="Microsoft.Office.InfoPath.Server.Controls" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link href="../CustomPage/SPSheet.css" rel="stylesheet" type="text/css" />
<title>Infopath and Webservice Integration in .NET</title>
</head>
<body>
<center>
<form id="form1" runat="server">
<div>
<table style="width: 300px;" class="dataentry" cellspacing="5">
<tr>
<td colspan="2">
<div class="datatitle">
Pay Roll Data<br />
</div>
</td>
</tr>
<tr>
<td align="left">
Name:
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Name cannot be empty.">*</asp:RequiredFieldValidator>
</td>
<td align="left">
<asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="FirstName" MaxLength="50"></asp:TextBox>
</td>
</tr>
<tr>
<td style="height: 26px" align="left">
Salary:
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2"
ErrorMessage="Salary cannot be less than 0." MaximumValue="1000000000" MinimumValue="0">*</asp:RangeValidator>
</td>
<td style="height: 26px" align="left">
<asp:TextBox ID="TextBox2" runat="server" Width="64px"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" align="left">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" Font-Size="10pt" />
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<asp:Button ID="Button1" runat="server" Text="Pass Data to Infopath" />
</td>
</tr>
</table>
</div>
<asp:Button ID="Button2" runat="server" Text="Button" /><br />
<cc1:XmlFormView ID="XmlFormView1" runat="server" EditingStatus="Editing" Height="250px"
Width="100%" XsnLocation="http://sarkshare:23755/Info%20Temp/forms/template.xsn" OnInitialize="XmlFormView1_OnInitialize" ShowFooter="False" ShowHeader="False" />
</form>
</center>
</body>
</html>
MyPage.aspx.vb
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Xml
Imports System.Xml.XPath
Imports Microsoft.Office.InfoPath
Imports System.Net
Partial Class CustomPage_InfoandWS
Inherits System.Web.UI.Page
Protected Sub XmlFormView1_OnInitialize(ByVal sender As Object, ByVal e As Microsoft.Office.InfoPath.Server.Controls.InitializeEventArgs) Handles XmlFormView1.Initialize
'Alternate method to pass Network Credentials
''Create an instance of the CredentialCache class.
'Dim cache As CredentialCache = New CredentialCache()
''Add a NetworkCredential instance to CredentialCache.
''Negotiate for NTLM or Kerberos authentication.
'cache.Add(New Uri(xWebService.Url), "Negotiate", New NetworkCredential("Administrator", "ganesh", "SARKACME"))
''Assign CredentialCache to the Web service Client Proxy(myProxy) Credetials property.
'xWebService.Credentials = cache
Dim xNavMain As XPathNavigator = XmlFormView1.XmlForm.MainDataSource.CreateNavigator()
Dim xNameSpace As XmlNamespaceManager = New XmlNamespaceManager(New NameTable())
xNameSpace.AddNamespace("tns", "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution")
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
XmlFormView1.EditingStatus = Microsoft.Office.InfoPath.Server.Controls.XmlFormView.EditingState.Editing
End Sub
End Class
Error message I receive is
Solution you are trying to open is not present.
What should be the problem?
any guess?