Topic
  • No replies
MukeshRathod
MukeshRathod
1 Post

Pinned topic Integrating With Leads using WebService

‏2012-07-17T07:57:42Z |
In this blog we will run through an example in which we will create Product in Leads Application through WebService. Leads also provides a way in which you can test the ALI scripts without actually creating a SOAP
Client.

Step 1: Creating an ALI script :

In the script below, MSIRequestSource represents the Soap Request. This is available in Xml form. The Execution part of Script parses the Name and Code from the Soap Request and creates an Product in Leads.The Script Outputs the Product Name and Code using XmlWriter.

ALI Script to Create Product:(This script can be invoke using Soap webservices Library like Axis)

<msi>
<source>
<MSIRequestSource>
<out><port>XML_IN</port></out>
</MSIRequestSource>
</source>
<main>
<xmlparser>
<in><port>XML_IN</port></in>
<xquery>
<template>/product/name</template>
<out><port>PRODUCT_NAME</port></out>
</xquery>
<xquery>
<template>/product/code</template>
<out><port>PRODUCT_CODE</port></out>
</xquery>
</xmlparser>
<product>
<create>
<setField>
<attribute>Name</attribute>
<in><port>PRODUCT_NAME</port></in>
</setField>
<setField>
<attribute>ProductCode</attribute>
<in><port>PRODUCT_CODE</port></in>
</setField>
</create>
</product>
<xmlwriter>
<element><name>product</name></element>
<element><name>product/name</name><in><port>PRODUCT_NAME</port></in></element>
<element><name>product/code</name><in><port>PRODUCT_CODE</port></in> </element>
<out><port>XML_OUT</port></out>
</xmlwriter>
<msiresponse>
<in><port>XML_OUT</port></in>
</msiresponse>
</main>
</msi>

Step 2 : Publishing the Web service
You need drop in the newProduct-webMode.ali newProduct-webMode-server.conf files attached in leads.war\msi\installed of deployment. Theses files have the ALI Script above and its registration file.
Note : By default leads will use the admin user to start the WebService execution engine.

Step 3: Test The Web Service:
Login to leads and navigate to below link
http://host:port/leads/msi.jsp
This page will Display list of all MSI Service that available in the Leads installation.Click on the service named newProduct-webMode. Use the below sample Soap Request Snippet in Test Client.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<product>
<name>SchoolOffer</name>
Fall2007 </product>
</soapenv:Body>
</soapenv:Envelope>

Once done you see an Product SchoolOffer has been created in Leads.