webcrm API Getting Started



Similar documents
How to consume a Domino Web Services from Visual Studio under Security

Authentication and Single Sign On

How To Use Saml 2.0 Single Sign On With Qualysguard

Visual Basic Programming. An Introduction

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

PerfectForms SharePoint Integration

Unleash the Power of e-learning

Building and Using Web Services With JDeveloper 11g

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

T320 E-business technologies: foundations and practice

Fairsail REST API: Guide for Developers

Integration of Hotel Property Management Systems (HPMS) with Global Internet Reservation Systems

17 March 2013 NIEM Web Services API Version 1.0 URI:

Ambientes de Desenvolvimento Avançados

CRM Setup Factory Installer V 3.0 Developers Guide

Twinfield Single Sign On

Address Phone & Fax Internet

Click Studios. Passwordstate. High Availability Installation Instructions

Creating XML Report Web Services

A SharePoint Developer Introduction. Hands-On Lab. Lab Manual SPCHOL306 Using Silverlight with the Client Object Model VB

- SAP BusinessObjects and Xcelsius articles, links and ressources

Introduction to Computer and Information Science CIS 110, Fall 2015

Exchange Outlook Profile/POP/IMAP/SMTP Setup Guide

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

Enrollment Process for Android Devices

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

Outlook Synchronisation guide

Usage of Evaluate Client Certificate with SSL support in Mediator and CentraSite

Integrating ConnectWise Service Desk Ticketing with the Cisco OnPlus Portal

ADFS Integration Guidelines

Java Access to Oracle CRM On Demand. By: Joerg Wallmueller Melbourne, Australia

Developer Guide to Authentication and Authorisation Web Services Secure and Public

How To Set Up A Scopdial On A Pc Or Macbook Or Ipod (For A Pc) With A Cell Phone (For Macbook) With An Ipod Or Ipo (For An Ipo) With Your Cell Phone Or

Generating Automated Test Scripts for AltioLive using QF Test

OnTime Web Services User Guide

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

Integrating Autotask Service Desk Ticketing with the Cisco OnPlus Portal

TABLE OF CONTENTS. avaya.com

RSA SecurID Token User Guide February 12, 2015

Electronic Questionnaires for Investigations Processing (e-qip)

GetLibraryUserOrderList

BackupAgent LabTech Integration Installation and Usage

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

Migration Manual (For Outlook 2010)

Protection! A d m i n i s t r a t o r G u i d e. v 1. O. S a l e s F o r c e C o n n e c t o r. Protect your investments with Protection!

Prestashop Ship2MyId Module. Configuration Process

Setup Guide for Magento and BlueSnap

Accessing the Media General SSL VPN

Client configuration and migration Guide Setting up Thunderbird 3.1

Using Voltage Secur

SQL Server 2005: Web Services

Ipswitch Client Installation Guide

Cox Managed CPE Services. RADIUS Authentication for AnyConnect VPN Version 1.3 [Draft]

ClientAce WPF Project Example

R i o L i n x s u p p o r r i o l i n x. c o m 1 / 3 0 /

Sage 100 ERP. ebusiness Web Services Installation and Reference Guide

Using ilove SharePoint Web Services Workflow Action

Web Services API Developer Guide

Training module 2 Installing VMware View

How to Configure Web Authentication on a ProCurve Switch

JobScheduler Web Services Executing JobScheduler commands

TrueEdit Remote Connection Brief

INTRODUCTION TO ATRIUM... 2 SYSTEM REQUIREMENTS... 2 TECHNICAL DETAILS... 2 LOGGING INTO ATRIUM... 3 SETTINGS... 4 NAVIGATION PANEL...

Secure Transfers. Contents. SSL-Based Services: HTTPS and FTPS 2. Generating A Certificate 2. Creating A Self-Signed Certificate 3

Q Lately I've been hearing a lot about WS-Security. What is it, and how is it different from other security standards?

ResPAK Internet Module

Using IBM dashdb With IBM Embeddable Reporting Service

Integrating Siebel CRM with Microsoft SharePoint Server

Onset Computer Corporation

MicrosoftDynam ics GP TenantServices Installation and Adm inistration Guide

Workflow Conductor Widgets

4. SSL-VPN Connection

Sending an Message from a Process

Sentral servers provide a wide range of services to school networks.

MapRoad - Pavement Management System (PMS) Local Government Management Agency (LGMA)

A Sample OFBiz application implementing remote access via RMI and SOAP Table of contents

ObserveIT Ticketing Integration Guide

CICS Web Service Security. Anthony Papageorgiou IBM CICS Development March 13, 2012 Session: 10282

Pervasive Data Integrator. Oracle CRM On Demand Connector Guide

Capturx for SharePoint 2.0: Notification Workflows

Zanibal Plug-in For Microsoft Outlook Installation & User Guide Version 1.1

HireDesk API V1.0 Developer s Guide

Marcum LLP MFT Guide

PHP Integration Kit. Version User Guide

Windows Intune Walkthrough: Windows Phone 8 Management

How to Make a Working Contact Form for your Website in Dreamweaver CS3

Installation and Configuration Guide

Connecting Custom Services to the YAWL Engine. Beta 7 Release

OPENID AUTHENTICATION SECURITY

INFORMATION SYSTEMS SERVICE NETWORKS AND TELECOMMUNICATIONS SECTOR. User Guide for the RightFax Fax Service. Web Utility

This document summarizes the steps of deploying ActiveVOS on the IBM WebSphere Platform.

Sop U. SOAP over JMS with. Configuring soapui to test TIBCO SOAP over JMS. - Seshasai Kotipalli

How to set up Outlook Anywhere on your home system

SharePoint Integration Framework Developers Cookbook

Iowa Immunization Registry Information System (IRIS) Web Services Data Exchange Setup. Version 1.1 Last Updated: April 14, 2014

Opacus Outlook Addin v3.x User Guide

Configuring Thunderbird for Flinders Mail at home.

Introduction to Building Windows Store Apps with Windows Azure Mobile Services

WebLogic Server 6.1: How to configure SSL for PeopleSoft Application

Transcription:

webcrm API Getting Started 17.09.2012 / 08.12.2015 TS Contents.NET Application with autogenerated proxy class... 2.NET Application sending SOAP messages directly... 10

.NET Application with auto generated proxy class The following example describes how to add a Web Service link to the webcrm API, get an auto generated proxy class and use it to manipulate webcrm data. The description is based on Visual Studio 2010, but the same can be done with small differences also under Visual Studio 2005 and all later versions. Step 1. Go to webcrm and the webcrm API URL - see the below screenshot.

Step 2. It makes sense to check if the URL is workable. For example, it could be forbidden according to some network security rules. If you open the URL with any Internet browser you should get something like this.

Step 3. Open Visual Studio and create a new project.

Step 4. Add a Service Reference

Step 5. Copy the URL stored at the Step #1 into the Address field.

Step 6. Click the Go button to make the framework analyze the URL and discover the service. If you get a security warning then just confirm that the URL is trusted. After pressing OK you should see the new reference added under Service References folder. Together with the reference you will get an endpoint specification in the config file. It will be similar to the below: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.servicemodel> <client> <endpoint address="https://webcrmapi.b2bsys.net/apicrm1/webcrmapi.asmx" binding="basichttpbinding" bindingconfiguration="webcrmapisoap" contract="servicereference1.webcrmapisoap" name="webcrmapisoap" /> </client> </system.servicemodel> </configuration>

Step 7. Now we ve got a couple of classes generated automatically based on the web-service URL. These classes enable working with the web-service in a simple and intuitive way. You do not need bothering about SOAP requirement neither of encoding formats. The below is a code snippet based on the generated classes. Imports System.Net Imports System.Net.Security Imports System.Security.Cryptography.X509Certificates Imports ConsoleApplication1.ServiceReference1 Module Module1 Sub Main() ' Add handler for SSL validation ServicePointManager.ServerCertificateValidationCallback = AddressOf AcceptAllCertifications ' Instantiate proxy class Dim proxy As New WebCrmApiSoapClient() ' Authenticate Dim dbncode As String = "crmaccount" Dim username As String = "username" Dim password As String = "password" Dim errorstatus As ErrorStatus = Nothing Dim ticket As TicketHeader = proxy.authenticate( dbncode, username, password, errorstatus) ' Do something useful, for example, add new organisation Dim data As New WebCrmData With {.Pairs = New KeyValuePair() { New KeyValuePair With {.Key = "1_Name",.Value = "Wates Construction АБВ"}, New KeyValuePair With {.Key = "1_Division_name",.Value = "Sharston æøåæø"}, New KeyValuePair With {.Key = "1_Telephone",.Value = "0161 946 8800"}, New KeyValuePair With {.Key = "1_Fax",.Value = "0161 946 8800"}, New KeyValuePair With {.Key = "1_Post_code",.Value = "M22 4BJ"} }} ' Note that text values can directly contain Danish, Cyrillic ' or other characters as shown above ' Request data of the added organisation back Dim result As WriteToWebCrmResult = proxy.writetowebcrm(ticket, DataEntityType.Organisations, 0, 0, data) Dim organisationid As Long = result.id

Dim collection As WebCrmDataCollection = proxy.readfromwebcrmbyid(ticket, DataEntityType.Organisations, organisationid, organisationid) ' Close session errorstatus = proxy.endsession(ticket) ticket = Nothing End Sub ''' <summary> ''' Encapsulates SSL certificate validation. ''' Add here your own logic or just let it return <c>true</c> in all cases. ''' </summary> Public Function AcceptAllCertifications( ByVal sender As Object, ByVal certification As X509Certificate, ByVal chain As X509Chain, ByVal sslpolicyerrors As SslPolicyErrors) As Boolean Return True End Function End Module

.NET Application sending SOAP messages directly If you cannot simplify your work by using auto-generated classes the following notes can be useful. 1. Go to webcrm and take URL to webcrm API service.

2. Get WSDL schema using the URL (+?wsdl parameter). The schema should be applied when you build your SOAP messages.

3. If it s too complicated to understand WSDL schema it can be helpful to visit the test page of webcrm API to see how specific requests should look.

4. The Test page helps you build the SOAP messages. You only have to select the service method and enter parameter values. Click the Generate Request button to generate the SOAP message and the Send Request button to send it to webcrm API.

5. Note that there is some encoding logic that you should be aware of. SOAP does not enable characters &, <, >, and. Instead they should be replaced with &, <, >, " and &apos; correspondingly. If you use the Test page to generate SOAP message then this will be handled automatically. The SOAP messages should be always sent with UTF-8 encoding. Below is a code example: Imports System.Net Imports System.Text Imports System.Net.Security Imports System.Security.Cryptography.X509Certificates Module Module1 Sub Main() Dim command1 As String = "<?xml version=""1.0"" encoding=""utf-8""?>" _ & "<soap12:envelope " _ & " xmlns:xsi=""http://www.w3.org/2001/xmlschema-instance"" " _ & " xmlns:xsd=""http://www.w3.org/2001/xmlschema"" " _ & " xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" _ & " <soap12:body>" _ & " <Authenticate xmlns=""http://www.webcrm.com/"">" _ & " <dbncode>account</dbncode>" _ & " <username>username</username>" _ & " <password>password</password>" _ & " </Authenticate>" _ & " </soap12:body>" _ & "</soap12:envelope>" Dim command2 As String = "<?xml version=""1.0"" encoding=""utf-8""?>" _ & "<soap12:envelope " _ & " xmlns:xsi=""http://www.w3.org/2001/xmlschema-instance""" _ & " xmlns:xsd=""http://www.w3.org/2001/xmlschema""" _ & " xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" _ & " <soap12:header>" _ & " <TicketHeader xmlns=""http://www.webcrm.com/"">" _ & " <Guid>{0}</Guid>" _ & " </TicketHeader>" _ & " </soap12:header>" _ & " <soap12:body>" _ & " <WriteToWebcrm xmlns=""http://www.webcrm.com/"">" _ & " <entitytype>organisations</entitytype>" _ & " <organisationid>0</organisationid>" _ & " <recordid>0</recordid>" _ & " <data>" _ & " <ErrorStatus>" _ & " <Message></Message>" _ & " <Code>0</Code>" _ & " </ErrorStatus>" _

& " <Pairs>" _ & " <KeyValuePair><Key>1_Name</Key>" _ & " <Value>Wates Construction АБВ</Value></KeyValuePair>" _ & " <KeyValuePair><Key>1_Division_name</Key>" _ & " <Value>Sharston æøåæø</value></keyvaluepair>" _ & " <KeyValuePair><Key>1_Telephone</Key>" _ & " <Value>0161 946 8800</Value></KeyValuePair>" _ & " <KeyValuePair><Key>1_Fax</Key>" _ & " <Value>0161 946 8800</Value></KeyValuePair>" _ & " <KeyValuePair><Key>1_Post_code</Key>" _ & " <Value>M22 4BJ</Value></KeyValuePair>" _ & " </Pairs>" _ & " </data>" _ & " </WriteToWebcrm>" _ & " </soap12:body>" _ & "</soap12:envelope>" Dim command3 As String = "<?xml version=""1.0"" encoding=""utf-8""?>" _ & "<soap12:envelope " _ & " xmlns:xsi=""http://www.w3.org/2001/xmlschema-instance""" _ & " xmlns:xsd=""http://www.w3.org/2001/xmlschema""" _ & " xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" _ & " <soap12:header>" _ & " <TicketHeader xmlns=""http://www.webcrm.com/"">" _ & " <Guid>{0}</Guid>" _ & " </TicketHeader>" _ & " </soap12:header>" _ & " <soap12:body>" _ & " <ReadFromWebcrmById xmlns=""http://www.webcrm.com/"">" _ & " <entitytype>organisations</entitytype>" _ & " <organisationid>{1}</organisationid>" _ & " <recordid>{1}</recordid>" _ & " </ReadFromWebcrmById>" _ & " </soap12:body>" _ & "</soap12:envelope>" ' Add handler for SSL validation ServicePointManager.ServerCertificateValidationCallback = AddressOf AcceptAllCertifications ' Submit authenticate SOAP message Dim uri As String = "https://webcrmapi.b2bsys.net/apicrm1/webcrmapi.asmx" Dim result1 As String = SubmitRequest(uri, command1) Dim ticketguid As String = GetTicketGuid(result1) ' Submit SOAP message to add one new organisation Dim result2 As String = SubmitRequest(uri, String.Format(command2, ticketguid)) Dim organisationid As String = GetOrganisationId(result2) ' Submit SOAP message to get the added organization back from webcrm Dim result3 As String = SubmitRequest(uri, String.Format(command3, ticketguid, organisationid))

End Sub Private Function SubmitRequest(ByVal uri As String, ByVal data As String) As String Dim client As New WebClient() client.encoding = Encoding.UTF8 client.headers.add("content-type", "text/xml; charset=utf-8") Return client.uploadstring(uri, data) End Function Private Function GetTicketGuid(ByVal response As String) As String Dim guid As String = String.Empty Dim data As String = response.tolower() If (data.indexof("</ticketheader>") > -1) Then data = data.substring(0, data.indexof("</ticketheader>")) If (data.indexof("</guid>") > -1) Then data = data.substring(0, data.indexof("</guid>")) data = data.substring(data.length - 36) guid = data End If End If Return guid End Function Private Function GetOrganisationId(ByVal response As String) As String Dim id As String = String.Empty Dim data As String = response.tolower() If (data.indexof("</id>") > -1) Then data = data.substring(0, data.indexof("</id>")) data = data.substring(data.lastindexof(">") + 1) id = data End If Return id End Function ''' <summary> ''' Encapsulates SSL certificate validation. ''' Add here your own logic or just let it return <c>true</c> in all cases. ''' </summary> Public Function AcceptAllCertifications( ByVal sender As Object, ByVal certification As X509Certificate, ByVal chain As X509Chain, ByVal sslpolicyerrors As SslPolicyErrors) As Boolean Return True End Function

End Module