Windows 8 app development. An error occurred while receiving the HTTP response - wcf

Whats wrong with this:
1-MyServiceReference.ServiceClient client = new MyServiceReference.ServiceClient();
2-MyServiceReference.User temp = await client.VerifyUser(user_email.Text);
it gives me the following Exception at line 2:
"An error occurred while receiving the HTTP response to {Service Url}. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details".

Related

WCF SOAP Service Gzip encoding with Custom Binding

Need help in sending a request which is for WCF service. The service has Custom Binding ( The request is Binary encoded).
Initially i was getting the HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml;charset=UTF-8;action="Phase"' was not the expected type 'application/soap+msbin1+gzip'.
So I manually added a header Content-Type = 'application/soap+msbin1+gzip'. Now the previous error was gone. but now I am getting the following error: "The remote server returned an error: (400) Bad Request"
I am using HttpWebRequest.
Below images for the reference
Code image
Error line Where i got 400

Proxy Error in RoR web application

I have an RoR app and while deleting content from this app, I am encountering the following error. Although when I refresh the webpage after this error, the content is deleted in the request.
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /abc/xyz/source/23.
Reason: Error reading from remote server.
This is an Apache Web server.
Can you please help me find what could be the reason behind this ?
The invalid response from an upstream server is generated when Apache web server does not receive a valid HTTP response from the upstream server.
The reason may be because of the following things;
The application did not respond in time and the request from Apache timed out.
May be network device blocking the request.
You need to add/increase the timeout limit in httpd.conf file of your application.

Receive custom HTTP statusCode in NSURLConnection sendSynchronousRequest

I send a GET request with [NSURLConnection sendSynchronousRequest...] to our web service. The server overrides the default HTTP status codes with his one codes if an error occurred.
I will test the error handling but always become a timeout (Error Domain=NSURLErrorDomain Code=-1001 "The request timed out.") if server send a custom HTTP code. If server sends the standard HTTP code (e.g. 400) the NSURLConnection works correct and gives me this code immediately.
Has anybody used NSURLConnection with NON-Standard HTTP failure codes and can help me to get this setup working?
Thanks

HTTP Status Code: 401 in GCMDemo

Reference:http://developer.android.com/google/gcm/demo.html
Server 401 when trying to send a message to my android device.
HTTP Status 500 - HTTP Status Code: 401
type Exception report
message HTTP Status Code: 401
description The server encountered an internal error (HTTP Status Code: 401) that prevented it from fulfilling this request.
exception
com.google.android.gcm.server.InvalidRequestException: HTTP Status Code: 401
com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:177)
com.google.android.gcm.server.Sender.send(Sender.java:121)
com.google.android.gcm.demo.server.SendAllMessagesServlet.doPost(SendAllMessagesServ let.java:83)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.29 logs.
Could anybody tell me how to solve?Thank you!
You should take a look at the GCM docs where it explains the GCM response: http://developer.android.com/google/gcm/gcm.html#response and troubleshooting the 401 error code: http://developer.android.com/google/gcm/gcm.html#auth_error
Description from the docs:
Authentication Error
The sender account that you're trying to use to
send a message couldn't be authenticated. Possible causes are:
Authorization header missing or with invalid syntax.
Invalid project number sent as key.
Key valid but with GCM service disabled.
Request originated from a server not whitelisted in the Server Key IPs.
So I would check to make sure that you are setting you authorization header properly and that you Google Project number is properly setup with GCM and accepting your servers IP.

Should my WCF webservice return a 500 or 200 http code (soap fault / functional return message)

after reading the SOAP 1.1 specs, it states that a SOAP Fault should return a http 500 errorcode when communication goes over a http binding, so when a SoapException is thrown, WCF returns a http 500 error code.
Now, I'm looking for some best practices to when return a functional soap error message and when to return a SOAP Fault.
What would you guys return when a functional error occurred while processing the message because of the input message contains some functional errors, a 500 SOAP Fault or a 200 Soap response containing some error message ?
http://www.ws-i.org/Profiles/BasicProfile-1.1-2006-04-10.html#HTTP_Server_Error_Status_Codes:
3.4.7 HTTP Server Error Status Codes
HTTP uses the 5xx series of status codes to indicate failure due to a server error.
R1126: An INSTANCE MUST return a "500 Internal Server Error" HTTP status code if
the response envelope is a Fault.
UPDATE:
What would you guys return when a
functional error occurred while
processing the message because of the
input message contains some functional
errors, a 500 SOAP Fault or a 200 Soap
response containing some error message
?
If the input message is invalid and prevents your service from doing its intended job, then yes - this clearly constitutes an exception, so I would return a SOAP fault in this case (something like FaultException<InvalidInputParameters>).
And I would let WCF handle all the necessary gory details of whether or not and when to return what http error code, if necessary. WCF already does all of that for you - you just throw a SOAP fault in your service code and that's all there is for you.