What is causing this error message? The remote server returned an error: (422) Non-Process Organization
I am trying to send a request to a REST API using WCF; here's what i did:
namespace Sample
{
[ServiceContract]
[XmlSerializerFormat]
public interface ISampleApi
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "users.xml", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
User CreateUser(User user);
}
}
And this is my User
class:
namespace Sample.Entity
{
[XmlRoot("user")]
public class User
{
[XmlElement("company")]
public string Company { get; set; }
[XmlElement("country-code")]
public string ContryCode { get; set; }
[XmlElement("created-at")]
public DateTime CreatedAt { get; set; }
[XmlElement("email")]
public string Email { get; set; }
[XmlElement("external-identifier")]
public string ExternalIdentifier { get; set; }
[XmlElement("id")]
public int Id { get; set; }
[XmlElement("measurement-system")]
public string MeasurmentSystem { get; set; }
[XmlElement("profile")]
public string Profile { get; set; }
[XmlElement("url")]
public string Url { get; set; }
[XmlElement("username")]
public string Username { get; set; }
[XmlElement("account-type")]
public string AccountType { get; set; }
}
}
But when I call the CreateUser method and pass a User object to it, I get this error message:
The remote server returned an error: (422) Non-Process Organization.
Any idea what is causing this?
a source to share
This exception means that the web server responded with an error code, namely 422. You will need to check with the administrator of the remote site as to why this might be the case. (Or look at the body of the response, if it was returned, it may contain some hints).
Here is an explanation for error code 422: http://tools.ietf.org/html/rfc4918#section-11.2
The request being sent to the server is most likely invalid. The exact error might not be possible without knowing which request you are sending to which system.
a source to share