The Generic Service Brokers
The generic “Endpoints” service brokers are used to expose non-specific APIs and services as SmartObjects. In other words, they are not written for a specific technology or product, but are rather generically used if a product or technology exposes an API or service of one of the supported types. The following generic brokers are available at time of writing:
Because the target technology may expose complex types, you may have to use serialization/deserialization to work with complex objects. K2 will attempt to expose first-level complex types as SmartObjects, but this is possible if the object only has primitive type properties (e.g. strings, numbers, dates). If the object contains other objects, then you will have to use serialization/deserialization because K2 cannot convert a complex type into a simple property. Basically, it means you use additional methods to serialize and deserialize the complex types in the SmartObject. The next topic describes serialization and deserialization in more detail.
While these Service Brokers are generic and can integrate potentially with many systems that expose one of the supported APIs or services, you may not get the exact behavior you are expecting, or the broker may interpret entities, methods or properties in the underlying service incorrectly. If you want a broker to behave in a specific way for a specific technology, you may have to code a custom Service Broker for that technology.
Working with Certificates
You may need an authentication certificate to call an endpoint. In this case, you can configure K2 to use the certificate.
- Install the certificate that is going to be used to authenticate on the K2 Server (Local Machine > Personal and Trusted Root)
- Get the Thumbprint of the Certificate
- Give Service Account rights to access the certificate
- Add the following sections to the K2HostServer.exe.config file:
- Under <wsHttpBinding> add:
<binding name="WSHttpBinding_CertificateService" closeTimeout="00:30:00" openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="296960" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="296960" maxArrayLength="296960" maxBytesPerRead="296960" maxNameTableCharCount="296960" />
<reliableSession ordered="true" inactivityTimeout="00:30:00" enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="Certificate" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="false" />
</security>
</binding>
- After <bindings/> add:
<behaviors>
<endpointBehaviors>
<behavior name="ClientCertificateBehavior">
<clientCredentials>
<clientCertificate findValue="PutThumbprintOfCertificateHere" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="PutEndpointAddressOfServiceHere" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_CertificateService" contract="CertificateServiceContract" name="WSHttpBinding_CertificateService" behaviorConfiguration="ClientCertificateBehavior" />
</client>