Most likely, it happens bacause it is impossible to "Create a Web Part that interacts with a Web service or a Windows Communication Foundation (WCF) service." in sandboxed solutions.
As a workaround you can create full-trust proxy.
Some links which could be usefull:
- Walkthrough: Creating and Calling a Full-Trust Proxy Operation
- SharePoint 2010 Sandboxed soulutions: Full Trust Proxies
Hope it helps. If so, please press upvote and mark as answer :-).
Regards, Michael