Accessing Google Spreadsheets with C# using Google Data API fails with Mono - c#

I'm trying to access my Google spreadsheets using the GData API. I have followed the example which looks like:
var service = new SpreadsheetsService("myTest");
service.setUserCredentials(username, password);
var query = new SpreadsheetQuery();
var feed = service.Query(query);
This should return a feed with a list of spreadsheets. However this fails with:
Google.GData.Client.GDataRequestException: Execution of request failed: http://spreadsheets.google.com/feeds/spreadsheets/private/full ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
When I try the above link directly in my browser I'm able to download the feed, as long as I'm logged in into my Google account.
Some further information:
I'm not behind a firewall
I have checked my username (maurits.rijk at gmail.com) and password several times
I am using Mandriva in VirtualBox on a MacBook
All my code is compiled with Mono
I tried the same functionality in Java on OS-X. That code runs as expected.

Looks like a Mono problem to me.
Could you test with fiddler to test if your call reach the server?

I found the problem and solution on Google code, Issue 88 as comment 8.
In short, using
mozroots --import --sync --quiet
solves this problem. For me it now works.

Related

.Net api access denied for Amazon QuickSight create dataset method

I'm able to create dataset in Amazon QuickSight from cli. However, when I try to create a dataset from local system Asp.Net code using Amazon SDK then I get access denied. All the read and list methods work fine though. I'm using same aws credentials that I use for cli.
CLI Code:
aws quicksight create-data-set --cli-input-json file://./create-data-set.json --profile PROFILE //This works fine in CLI
C# Code:
AmazonQuickSightClient client = new AmazonQuickSightClient(<AccessKey>, <SecretAccessKey>, <Region>); //Same credentials as I used in above CLI
//This line works
List<DataSetSummary> dsSummary = client.ListDataSetsAsync(<ListDataSetsRequest>).Result.DataSetSummaries;
//This line throws error
int result = client.CreateDataSetAsync(<CreateDataSetRequest>).Result.Status;
The errors I see in the exception are:
"User: arn:aws:iam::ACCOUNT:user/USER is not authorized to access this resource"
"AccessDeniedException"
"The remote server returned an error: (403) Forbidden."
Thank you
The datasource information was incorrect and updating that fixed this problem.
datasetBlah.PhysicalTableMap.Values.First().RelationalTable.DataSourceArn = <CORRECT_DATASOURCE_ARN>;

Scraping htmlagilitypack

I am using HtmlAgilityPack to perform Scraping in C # Asp.Net, so far I have not had problems when doing Scratch from several web, however, trying to eject the following code I get an error
Var getHtmlWeb = new HtmlWeb ();
Var home page = getHtmlWeb.Load ("https://www.corfo.cl/sites/cpp/home");
The error that appears is:
"Connection terminated: Unexpected sending error."
The only web that is giving me problems is Corfo and not how to solve this.
I appreciate your help
This site relies on cookie to work, e.g. one of the URL it requested is
https://www.corfo.cl/sites/Satellite;jsessionid=T8w78ZolfWgr3ZoEBBvE81nBiXbXIdjfF1In3bgpZiYvL_w8TF4p!1081543155!-596930586?c=Page&cid=1456408322328&pagename=CorfoPortalPublico/Page/corfoListadoOfertaInteligenteWebLayout
So, when you request www.corfo.cl, first it forward to www.corfo.cl/sites/cpp/home, then on /sites/ folder, it set cookie jsessionid=OHS_1~T8w78ZolfWgr3ZoEBBvE81nBiXbXIdjfF1In3bgpZiYvL_w8TF4p!1081543155!-596930586 etc.
With this cookie, this page build itself with all/some components related with this jsessionid.
If client code doesn't handle these logic, as above two lines, the server reset the connection as expected, because server doesn't know how to build this page without jsessionid.
The inner exception from System.Net.WebException is
{"Authentication failed because the remote party has closed the transport stream."}
Hope this helps!

C# soap call on iis7.5 gives The XML-document (1, 542) contains an error

I've got an nusoap based wsdl on Linux which I'm trying to convert to a windows host.
The host is freshly installed, so any misconfiguration can apply for the issue.
The Host is running IIS7.5
PHP 5.5.3.8
MySQL 5.0.11
The soap request gets the right data out of the mysql database, but the application gives an error message: The XML-document (1, 542) contains an error.
And also The given type is not recognized: name=Data, namespace=http://www.my-domain.com/soap/GetData, at
I'm trying to get the raw result out of IIS but can't get it to work.
I've tried many suggestions found by google-ing, but none works.
Any help is appreciated.
I've ended up making a new rest API and used that instead of the Linux solution used before.

APNS implementation in C#

I am trying to implement push notification services in windows by following this link.
Starting from MAC I am able to create SSL certificate(cer) and key (p12) files. I also installed these two files on Windows server by following this link.
Now the issue is, when I execute .Net code, I am able to send a message but in the response I'm getting an exception. When it goes into the ReadResponse it gives the error Input string was not in a correct format on this line :
payLoadIndex = ((Convert.ToInt16(payLoadId)) - 1000);
It happens because payLoadId is blank. It says that "Notification successfully sent to APNS server for Device Token" but I get no notifications. I assume if this ReadResponse worked I would be able to know what the error was.
One thing I noted in some post is that after following the above procedure they create the PKCS12 format file for the notifications to work, using OpenSSL.
If this is required, which key should I use, "p12" or "PKCS12"?

PHP SOAP Server not working

I have written a SOAP server in PHP using http://code.google.com/p/php-wsdl-creator/downloads/list
My client is in Dynamics CRM Online plugin written in C#
Everything works fine on my testing website, however when I send the SOAP server across to the clients web host, they have uploaded the files, but I'm getting the following error returned:
SoapServer::SoapServer(): 'soap_version' option must be SOAP_1_1 or SOAP_1_2
I believe this is a configuration issue on their server (they had to install a SOAP module for this) but I don't know where to look/advise to sort this out.
For reference, my C# class references the SOAP server in a web reference. I have added the following line, trying both 11 and 12 but to no avail:
soap.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap11;
When I look at the phpinfo page, my test server has the line '--enable-soap' '--with-xsl=/usr in the Configure Command section, where as the web hosts version doesn't but it does have the line /etc/php.d/soap.ini in Additional .ini files parsed - would this cause any issue? I don't know anything about configuring php servers.
I had the same problem within the php-wsdl-createor-framework.
Their patch on https://code.google.com/p/php-wsdl-creator/ was to change line 434 in class.phpwsdl.php
from
// SOAP server options
$this->SoapServerOptions=Array(
'soap_version' => SOAP_1_1|SOAP_1_2,
'encoding' => 'UTF-8',
'compression' => SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP|9
);
to
// SOAP server options
$this->SoapServerOptions=Array(
'soap_version' => (defined('SOAP_1_2'))?SOAP_1_2:SOAP_1_1,
'encoding' => 'UTF-8',
'compression' => SOAP_COMPRESSION_ACCEPT|SOAP_COMPRESSION_GZIP|9
)
Hope it helps anyone
Try setting the soap_version option in the SoapServer constructor (PHP). For example:
$server = new SoapServer("some.wsdl", array('soap_version' => SOAP_1_2));

Categories