Cannot display data from an external data source

D

Dibs

Hi All,

I am using InfoPath client (No Forms Services). I have created a Secondary
Data Connection through the Tools --> Data Connection wizard (browser enabled
is not checked). I have bound the data source node to a repeating text box
and saved the form as a template (Template1.xsn). Now, when I try to preview
the form, it gives me an error –
‘One or more data sources required to open this form might not be available.
They may be temporarily offline or your computer might not be connected to
the Network’.
In the Details tab – the error is : ‘Infopath cannot run the specified query
- InfoPath Cannot connect to the data source – Access Denied’.
Now let me state that my InfoPath form and my Sql-Server database is in the
same server –so no issue of network problem or connectivity.
When I go for the ‘Work Offline’ mode the complete data is displayed as
desired.

I am getting the same error while trying to query data and display through
Web Service. Here the Work Offline mode does not work very naturally. My
Web-service is a file-system based web-service existing on the same server.
The web-service in itself just works fine.

Now can anyone help me with this problem. How can I sort this out…? How can
I display data from an external data source through Data Connections or Web
Service connection ? Any suggestions are welcome.
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello Dibs

Access Denied error is shown when you dont have permissions to the Db.
Check your security permissions on the Db.
 
D

David Dean

Check the following:
- Open the Security and Trust tab using Tools / Form Options... and make
sure the form template is set to Domain level trust.
- Make sure you use the Publish Form Template option to publish the form
template to the server rather than just saving the .XSN file. This embeds the
correct processing instruction in the form template so that it recognizes the
correct URL domain.
- When using the InfoPath rich client, a secondary data connection to SQL
Server is authenticated via NTLM using the user's Windows credentials. Make
sure the user belongs to a domain group that has been granted read access to
the SQL database.
- Access to a web service is authenticated based on the IIS configuration
for the virtual directory. However, if the web service accesses data on
another machine you may run into an authentication issue unless the web
service impersonates a specific user account.
 
D

Dibs

Thanks for your instant interst in my case, Mr Reddy...

I have tried your solution, but the result is same... One thing I would like
to bring to your notice is that When I preview or publish the form template
(say Template1.xsn) it gives the error - 'You are currently offline' - 'Try
to Connect or Work Offline'... Now when I click on 'Work Offline' the form is
displayed with the desired data. That means that the form could connect to
the database and fetch out the data.
This implies that I do have permissions to the db... isn't it...? Also I can
connect to the SQL-Server database through my windows authentication in the
SQl-Server Management Studio. Rectify me if I am wrong... If I am wrong
please suggest me how to grant myself permissions to the db...

Thanks again for your interest
 
D

Dibs

Hi david, Thanks for your suggestions but something else is going wrong which
I cannot figure out. Maybe there are some configuration issues, in which case
I may have to think of re-installing Forms Services.
One thing I would like to know : the web service that I am trying to connect
is a very simple web service returning a string array. But this web-service
is a file-system based web-service since I am not allowed to create an http
based ASP.net web-service in the server which hosts Sharepoint server.
Can this be a problem...?
 
D

David Dean

I'm not sure exactly what you mean by a "file-system based web-service". I
assume this statement reflects that Visual Studio won't allow you to open a
web project using the http url of a SharePoint site, so you have to open the
directory containing the web service project files using a UNC path.

Even in this scenario, the web service method would still have to be
executed via an HTTP request. Are you testing the web service in Visual
Studio using the "default web server" option that starts an ASP.NET
development server? Have you tested the web service by hitting it from a
browser on another machine?

If you want to allow other applications or machines to access the web
service, it needs to be exposed via an IIS virtual directory. This is done
differently depending on the version of SharePoint you are using.
 
D

Dibs

Hi David, You have rightly guessed the scenario. I cannot access my
web-service from other machines. The IIS hosts MOSS 2007 sharepoint server.
Now I need to create a web-service which needs to be exposed via an IIS
virtual directory.
I know i am deviating from my original problem but I still need some
suggestions or references (in terms of links) to create an ASP.Net web
service in the IIS which hosts MOSS 2007.

Thanks again...
 
D

David Dean

Here's a simple way to create a web service that runs within the SharePoint
site context:
1. In Windows Explorer, go to the folder
"Program Files\Common Files\Microsoft Shared\web server
extensions\12\TEMPLATE\LAYOUTS"
2. Create a new subfolder beneath the LAYOUTS folder and copy your web
service files into it.
3. Open IIS Manager and expand the site for your SharePoint web application
4. Expand the _layouts virtual directory
5. Right-click the new folder and select Properties...
6. Click the Create button to create an IIS application, then set the
Application pool to the same app pool used by the SharePoint web app.
7. Modify the <system.web> section of web.config in your web service folder
to include the following settings:

<!-- Turn on impersonation, turn on the ASP.NET error page, and enable full
trust -->
<authentication mode="Windows"/>
<customErrors mode="Off"/>
<identity impersonate="true"/>
<authorization>
<allow users="*"/>
<deny users="?"/>
</authorization>
<httpModules>
<!-- Revert from the SharePoint HTTP modules to the standard ASP.NET HTTP
modules -->
<clear/>
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
<add name="FormsAuthentication"
type="System.Web.Security.FormsAuthenticationModule"/>
<add name="UrlAuthorization"
type="System.Web.Security.UrlAuthorizationModule"/>
<add name="WindowsAuthentication"
type="System.Web.Security.WindowsAuthenticationModule"/>
<add name="RoleManager" type="System.Web.Security.RoleManagerModule"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
<!-- Additional modules as required -->
</httpModules>
<httpHandlers>
<!-- Revert from the SharePoint HTTP handlers to the standard ASP.NET HTTP
handlers -->
<remove verb="GET,HEAD,POST" path="*.aspx"/>
<remove verb="GET,POST" path="*.asmx"/>
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>
<add verb="POST,GET" path="*.asmx"
type="System.Web.Services.Protocols.WebServiceHandlerFactory,System.Web.Services,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false"/>
<!-- Additional handlers as required -->
</httpHandlers>
<!-- Grant full trust - for better security, you may want to comment this
out -->
<trust level="Full" originUrl=""/>
<!-- Allow remote testing of web services - comment out for production -->
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>

8. You should now be able to test your web service in Internet Explorer by
browsing to "http://server/_layouts/{web service virtual dir}/{your web
service}.asmx".
 
D

Dibs

It worked David !!! Thanks a lot...

Should I follow the same procedure while creating an ASP.Net Website which
will run within the sharepoint site context ?

Thanks again...
 
D

David Dean

This approach is best when you have subsites your ASP.NET pages need to be
accessed in the context of a specific site within the site collection. If you
have only one top-level site, you can create the ASP.NET application in a
subfolder of the web application folder.
 

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

Top