Setting up API with https
Prerequisite
- Download and install SoapUI for testing purposes
HTTPS Setup
To run http binding we first have to create a http binding configuration in the api web.config:
<bindings>
<basicHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
Expose endpoint using the configuration from above:
<endpoint
address="referenceDocumentManagementTcp"
binding="basicHttpBinding"
bindingConfiguration="TransportSecurity"
contract="Integration.ServiceContracts.DocumentManagement.IDocumentMangement" />
Create an endpoint for each interface you want to utilize, in the example above we're using IReferenceDataManagement.
Expose a mex endpoint:
<endpoint address="mexs" binding="mexHttpsBinding" contract="IMetadataExchange"/>
Enable http and https metadata:
<behaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
Add https to IIS. Open IIS and first click the Default Web Site -> Bindings. If the https is not in this list click add and add the net.tcp to the binding:
Enable https application protocol:
Enable Windows Authentication:
The api is now setup for https use
Show Content View and browse PlatinaService.svc:
Download the wsdl file:
Open SoapUI, click Soap to create a new project and add the wsdl .xml-file:
To receive document meta data we are going to test 'GetWorkingDocument' (the file has been renamed):
The request does not need any extra Headers, but the Auth has to be setup as the Primary User:
Remove the 'optional' piece from the request and add the propID of your Platina document:
Result: