Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
1  
Sorry, per the FAQ we can only accept questions about SharePoint. It might be better suited to StackOverflow.com. If appropriate, you could perhaps re-phrase this question so that it is more obvious how this relates to SharePoint. If you do, just flag for moderator attention and we will re-open it once it meets the guidelines. Thanks. –  SPDoctor Aug 20 '12 at 16:56
1  
@SPDoctor this question is specifically about Office 365 (SharePoint Online), isn't this good enough to qualify? I am not sure how to make it more obvious... –  Christophe Aug 20 '12 at 19:55
2  
I have added more details. But again I don't see how this could not be considered a SharePoint question. –  Christophe Aug 20 '12 at 20:38
add comment

5 Answers 5

up vote 0 down vote accepted

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)
share|improve this answer
add comment

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.

share|improve this answer
    
Thx for the follow up. I was actually very interested in your comment, but I am not familiar with Silverlight. It would be great to have a wrapped solution just like the one I mentioned in my question. Also, this gave me the idea to try Flash, unfortunately Flash also has cross-domain restrictions. –  Christophe Aug 28 '12 at 17:27
1  
Silverlight has the same cross-domain restrictions as Flash. If you "couldn't persuade" USPS to allow Flash access from your web site it's unlikely you'd be luckier with Silverlight. (They both check policy XML files to permit the server call or not.) –  Ferdinand Prantl Aug 28 '12 at 19:41
add comment

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.

share|improve this answer
    
Thanks for the idea, but it won't work in my case because the xml data depends on the request (that's the point of the parameters). For example the address verification could be for any address in the US. –  Christophe Aug 27 '12 at 0:09
    
Well the idea is that you want to get the information into your system somehow since you can't really write custom code in SharePoint. –  onzur Aug 27 '12 at 14:08
    
Another option might be BCS. If there is no way of getting the data then that won't work for you... Since this isn't a huge service call I would recommend SilverLight. It allows for service calls in sandbox solutions I believe Check this link –  onzur Aug 27 '12 at 14:14
add comment

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

share|improve this answer
1  
I am pretty sure that the web part would not be able to make outbound web requests, as you already suspected –  Jaap Vossers Aug 23 '12 at 11:33
    
Well, it was a good idea right up until that point. :) –  Stuart Pegg Aug 23 '12 at 11:46
    
Thanks guys, good to know even if it doesn't work... –  Christophe Aug 23 '12 at 15:38
add comment

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).

share|improve this answer
    
thx Jaap. I'll give it a try, but - as I said in my question - the services I'm interested in don't necessarily support JSON-P. –  Christophe Aug 23 '12 at 4:33
1  
Your services don't have to, that's the point of YQL. YQL introduces JSONP support for your service by sitting in the middle. Your client code calls Yahoo servers via JSONP. Yahoo servers can call your service then using standard HTTP requests. Yahoo is your proxy, and it lives outside your SharePoint environment. –  Jaap Vossers Aug 23 '12 at 7:29
    
ok, I'll try. Unfortunately, some of the services - like USPS in my question - require a key and only allow access from the customer's site. –  Christophe Aug 23 '12 at 15:37
    
by "site" do you mean the SharePoint Online servers, or browsers on the customer network? –  Jaap Vossers Aug 23 '12 at 16:26
    
Sorry, I meant Web url, for example www.CustomerDomain.com. You need to register your url when requesting a key, and USPS will only allow requests from that specific url. –  Christophe Aug 23 '12 at 16:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.