...
Code Block |
---|
|
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
...
<behaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<service behaviorConfiguration="MailUp.WS.Host.Web.MailUpServiceBehavior" name="MailUp.WS.Service.MailUpService">
<endpoint address="rest" binding="webHttpBinding" contract="MailUp.WS.Contract.IMailUpService" behaviorConfiguration="restBehavior"/> |
Example
Code Block |
---|
title | AuthenticationLogin with REST (Request) |
---|
|
Call http://services.mailupnet.it/1.0/MailUpService.svc/rest/AuthenticationLogin
passing the following XML as parameter in HTTP POST:
<LoginRequest>
<Username>xxxx</Username>
<Password>yyyy</Password>
<IdConsole>10001</IdConsole>
</LoginRequest> |
Code Block |
---|
title | AuthenticationLogin using REST (Response) |
---|
|
XML response when request is successful ("Token" is the returned Access key):
<LoginResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Token>A973Amr5FJZzsZukgfdBkjblveNL8TKnqc5iLjDyixLDF9VdTx0M9N9z4Hiw=</Token>
</LoginResponse>
Unsuccessful response:
HTTP 400 Bad Request |
Per configurare REST è sufficiente aggiungere le seguenti configurazioni nel web.config:
...