C# Tips, Tricks, and Quirks
There are some arguments in C# that, while optional from the perspective of our system, are required for the your code to compile properly. As you’re making calls to createUser and createCompany, you’ll notice that some of the arguments have a corresponding argument ending in Specified, for example company_id and company_idSpecified. The “specified” argument needs to be included and set to True for the code to function, so watch out for those.
Installing the Partner Client Certificates
If you are using the VerticalResponse Partner API you should have been given a certificate file that ends with a .p12 extension. Before you can perform any partner-specific functions, you will need to install that certificate on your machine.
Click on the .p12 file certificate file provided by Vertical Response.
Click “Next” on the first screen
The p12 file path should already be provided. If not, browse to it. Click Next.
Enter the certificate passphrase provided by Vertical Response.
Select “Place all certificates in the following store”. Then click
on Browse..Check the box that allows you to select the Certificate Store. Select “Trusted Root Certification Authorities” and the entry “Local Computer” beneath it and click “OK”.
Click “Finish” on the final screen.
Configuring Your App to Find the Partner Client Certificate
In order for the code to find your partner client certificates, you’ll need to update the app.config file in the solution browser.
- In the VRAPIBinding binding entry under the system.servicemodel element, change the clientCredentialType parameter of the transportelement from “None” to “Certificate”
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="VRAPIBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="Transport"> <transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security>
- In the client section, add a behaviorConfiguration parameter to the endpoint element and give it the value of clientEndpointCredential
<client> <endpoint address="https://api.verticalresponse.com/1.0/VRAPI" binding="basicHttpBinding" bindingConfiguration="VRAPIBinding" contract="VRAPI.VRAPIPortType" name="VRAPIPort" behaviorConfiguration="clientEndpointCredential" /> </client>
- Immediately after the client section, add a new behaviors element. Define the clientEndpointCredential behavior mentioned above using the following:
</client> <behaviors> <endpointBehaviors> <behavior name="clientEndpointCredential"> <clientCredentials> <clientCertificate findValue="api-services@verticalresponse.com" storeName="Root" storeLocation="LocalMachine" x509FindType="FindByIssuerName"/> </clientCredentials> </behavior> </endpointBehaviors> </behaviors>
This will seek the certificate using its issuer name. Note: If you have more than one partner client certificate stored in your environment, you will either need to remove any certificates you are not using or use a different identifier to select the correct certificate.
If you have any difficulties with installing the certificate, contact us at api-support@verticalresponse.com.