Using WCF service for windows mobile and server communication? - json

I am using this code for Windows phone and server communication using WCF for sending my data from phone to server and get response. But I am getting error "The remote server returned an error: NotFound."
How this URI is created:
string ServiceUri = "http://localhost:30576/Service1.svc/Rest/add/"
+ Number1 + "/" + Number2;
I did not understand from where /Rest/add/ came from. I may be getting error due to this.

Look at the web.config, at the "RESTEndPoint" section. His base address for the endpoint is "rest". So you have to use what ever is there in your web.config endpoint address.

Related

Set up https server on google-app-engine express . . how to get certificates

We try to move node.js restful api to GCP. MySql is running normally as SQL instance. I have successfully deployed node.js app as App Engine service. I can see it works ok as GET request is comming through ok, with status 200. However, I am unable to connect to MySQL from this app, as I can see that when I try to init mysql-password-store (I am using passwordless.js library for authentication), I am not able to come through. Error is this:
Error: Server does not support secure connection at /workspace/node_modules/passwordless/lib/passwordless/passwordless.js:445:10
I believe the reason is in fact that I am running http server, as opposed to https server in my express (node.js) app.
I was able to get to work custom domain, thinking this will solve SSL issues, however the problem I believe lies in somewhere between eypress and mysql.
Can someone please explain how can I run https server on AppEngine. I don't understand how or where to get certificates to pass into part for creating https server:
const httpsOptions = {
key: fs.readFileSync(process.env.PATH_PRIVKEY),
cert: fs.readFileSync(process.env.PATH_FULLCHAIN)
};
https.createServer(httpsOptions, app).listen(port, err => {
if (err) {
throw err;
}
winston.info(
`********** App running on port: ${port} - https *** in mode:${process.env.NODE_ENV} on host:${process.env.NODE_HOST} ********** `
);
});
I am able to run app as http server from localhost and connect to GCP SQL MySql instance. . .
In case someone hits similar problem, I'll briefly decribe how we got it solved. We moved node.js (REST api with express) to Cloud Run service, and hit same problem . . Routes that were calling stored procedures in our DB (MySql instance in Cloud SQL) could not communicate until we did following:
Cloud Run - Service - Service Details - Edit and deploy - Connection - - here the connection to db instance needs to be inserted into Cloud SQL Connection
In our node app . . connection to mysql (via knex) should be made with socketPath (unix way) . . instead of classic IP,PORT way. We are still using public IP at MySql.
in node.js (express) we set up http server and not https. Seems to me that gs takes care of the cerificates.
Maybe someone find this helpful.

What causes this very unusual SMTP error?

Sending SMTP mail via an Office 365 mail server, using .NET System.Net.Mail.SmtpClient I'm getting the following error:
The server response was: 4.3.21 Mailbox server busy; mail intentionally delayed
I can't find any reference to this specific code anywhere - the closest thing I can find is 4.3.2 mailbox busy
It seems to be a transient error, but I'm getting a lot of them.
Any idea what the code means?

Office (JS) Outlook addin and Exchange token authentication

My Office add-in (which runs in Outlook) uses the OfficeJS library to get a callback token for authentication against Exchange:
Office.context.mailbox.getCallbackTokenAsync(...);
The token is sent to our server together with some message/attachment IDs and the server will attempt to connect to Exchange to retrieve said mail attachment. I use the EWS java API library for this. I am getting an Unauthorized 401 HTTP error back from Exchange when trying to bind to an EmailMessage:
ExchangeService exchangeService = new ExchangeService();
exchangeService.getHttpHeaders().put("Authorization", "Bearer " + callbackToken);
exchangeService.setUrl(new URI(ewsUrl));
EmailMessage mailMessage = EmailMessage.bind(exchangeService, new ItemId(mailMessageId));
When tested against Office 365 it all works flawlessly. However, when running this at a client I get the HTTP 401 response. The client runs Exchange 2013 on-premise. Does Exchange 2013 on-premise even support token authentication? Is there anything that needs to be done to enable this on that version of Exchange?

ejabberd JSON parsing error?

Situation:
backend windows application <--> ejabberd server <--> android chat client side
Client side sends a custom iq query in JSON format via ejabberd server to backend windows app and it parses it correctly. When the backend windows app sends back a response to the client the single quotes in the JSON response are converted to &quot.
Configuration:
backend app - windows app (.net based application)
backend - Azure SQL
xmpp server - ejabberd 15.07
ejabberd server OS - Ubuntu Trusty
client side - android app using "asmack"
I am not sure what can be causing the error. Any help is appreciated.
Thanks.
This is standard XML escape sequence, you pretty much expect to have any of this characters &<>" to be replaced by one of special entities. Your xml parsing library should replace those automatically, maybe you are not using correct method to not get raw values? It may also be problem on producing end, where it escapes values twice (' -> " -> ") which after unescaping will give you " string, you would need to check what is actually send in network packet to be able to determine this.

wcf restful service with my windows app

We have used WCF restful service end point for Windows phone 8 App, Using HTTP request its running but sometime it throws error by showing "REMOTE SERVER RETURNED ERROR:NOT FOUND". And this error is coming very commonly with "https:" with only "http:" also this error coming but not frequently