Question

I am working on an Office 365 (SharePoint Online) website, and I am looking for a way to retrieve data (xml, json) from remote sites that don't necessarily support JSON-P or CORS.

I could use an XML Web Part if the remote address was static, but in my case it includes parameters. For example I need to use the USPS address verification service, where the address is passed as a parameter.

I found on the Web a couple solutions (for example from John Chapman for SharePoint 2010) that implement a proxy page. However these examples require server side installation.

Is there a way to obtain a similar result on Office 365? If not, any other suggestion on how to retrieve remote xml or json?

Was it helpful?

Solution 5

I think I found an answer to my question: I was able to access the USPS Web service from an Office 365 site by creating a datasource of type "REST service connection" and displaying it on the page via a Data View Web Part. The datasource accepts external parameters that can for example be provided by a Web Part connection or a Querystring parameter.

Thanks to those who have replied. There's a large choice of options to connect to external services, but the solution I found was the only one to work in my cases. Other options I considered:

  • JSON-P (requires that the provider supports JSON-P or accepts access from a third party like yql)
  • Flash or Silverlight (require that the provider accepts cross-domain requests)
  • CORS (requires that the provider supports CORS)
  • xml Web Part (parameters need to be hard-coded)
  • BCS? (not tested, I would expect limitations on the types of services that can be accessed)

OTHER TIPS

Have a look at http://blog.jsonpify.com/

or, as suggested on the blog above, have a look at http://developer.yahoo.com/yql/

YQL can be called from client script using JSONP, allowing you to pass a SQL-ish query against an "Open Data Table". An Open Data Table is an abstraction layer similar to a BCS model in SharePoint. An Open Data Table abstracts web services, turning them into virtual database tables to interact with. YQL has many Open Data Tables available to interact with and you can also build your own by "describing" the web service you want to abstract (again similar to a BCS model).

Another possible line of enquiry might be to reproduce/convert John's page into a sandboxable web part, then calling a web part page containing the web part in a similar way.

More details on this process can be found on Wictor's blog:

Wictor Wilén: Custom application pages in the SharePoint 2010 Sandbox

Unfortunately it seems John's only uploaded the WSP file (not the source code) to CodePlex, so I can't vet it for sandboxability, and it will be more difficult to reproduce/convert.

It's also entirely possible that the sandbox restrictions would prevent this kind of functionality, as one of the permissions denied by the CAS policy is WebPermission:

Restrictions on Sandboxed Solutions in SharePoint 2010

I always enjoy a good brain teaser haha.

Not sure if this would meet your requirement because its a asyncrounous, but throwing it out there nonetheless :)

If your offering of SharePoint Office 365 has webservices enabled you can write a console app or windows job which gets the xml data and inserts the necessary values into a list on the site. Note the console app will be hosted on a server outside SharePoint 365 so you have no restrictions on your code.

Then you can use the javascript api to read the values from that list. This propably isn't a good idea if you need up to the second data, however if your data doesn't get updated very frequently it'll propably work. You can run the job every 30 mins or an hour if you'd like. Depends on what your systems can handle.

To reiterate you will have 3 seperate systems.:

1)XML Data from a service 2)Server job which gets the necessary data and dumps it into SharePoint 3)SharePoint Office 365 and your sandbox web part

Hope that makes sense. Best of luck.

Office 365 and clients

Link on 365 webservices authentication

Best of luck.

Christoph, I haven't heard anything back on your comment so I'm assuming you didn't see it. I'm adding this as another answer here. This seems to not be a heavy call. Have you checked SilverLight? You can read more about it here. If you already wrote another webpart, maybe you can use webpart connections and call a validate method of the sliverlight webpart.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top