Difference between revisions of "Web Services"
m |
|||
| Line 1: | Line 1: | ||
| − | |||
[[Category:Integration]] | [[Category:Integration]] | ||
{{Global Header}} | {{Global Header}} | ||
Revision as of 21:58, 2 August 2008
To discuss or ask questions about this article, select the discussion tab above.
Contents
- 1 Create a Request, Change Order and Contact through Web Services via VB
- 1.1 Step1: Create a web reference in the front end.
- 1.2 Step 2: Create an Object of the web reference
- 1.3 Step 3: Specify the Correct web service URL
- 1.4 Step 4: Provide the username and password to get the sid value
- 1.5 Step 5: Get the User Handle
- 1.6 Step 6: Create a Request
- 1.7 Step 7: Create a Change Order
- 1.8 Step 8: Create a contact
- 2 Creating Code for VB.net 2008 and R11
Create a Request, Change Order and Contact through Web Services via VB
Step1: Create a web reference in the front end.
- Start the front end.
- Go to Website menu and click “Add web reference”.
- In the URL box provide the web service URL and click go. http://<hostname>:8080/axis/services/USD_R11_WebService?wsdl'''
- We can find the methods being pulled out.
- Add the webreference with the name “WebReference”.
Step 2: Create an Object of the web reference
<source lang="javascript">Dim ws As New WebReference.USD_WebService</source>
Step 3: Specify the Correct web service URL
<source lang="text">ws.Url = "http://<hostname>:8080/axis/services/USD_R11_WebService?wsdl"</source>
Step 4: Provide the username and password to get the sid value
<source lang="javascript">Dim username, password As String Dim sid As Integer username = "analyst1" password = "123" sid = ws.login(username, password)</source> where login is the method used to get the sid.
Step 5: Get the User Handle
<source lang="javascript">Dim userhandle As String userhandle = ws.getHandleForUserid(sid, username)</source> Where getHandleForUserid is the method
Step 6: Create a Request
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String Dim requestHandle, requestNumber As String attrVal = New String() {"customer", userhandle, "category", "<category id>", "description", "Description here"} prop = New String() {""} attr = New String() {persistent_id} requestHandle = "" requestNumber = "" ws.createRequest(sid, userhandle, attrVal, prop, "", attr, requestHandle, requestNumber)</source>
Step 7: Create a Change Order
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String Dim requestHandle, requestNumber As String attrVal = New String() {"requestor", userhandle, "category", "category id", "description", "description here"} prop = New String() {""} attr = New String() {cpersistent_id} requestHandle = "" requestNumber = "" ws.createChangeOrder(sid, userhandle, attrVal, prop, "", cattr, requestHandle, requestNumber)</source>
Step 8: Create a contact
<source lang="javascript">Dim attrVal(5), attr(1), persistent_id As String Dim contactHandle, contactNumber As String attrVal = New String() {"first_name","Mike", "last_name", "Tolland", "userid", "mike.tolland", "contact_num", "<Password here>", "email_address", "mike.tolland@abc.co.in", "phone_number", "00989876723"} attr = New String() {persistent_id} ws.createObject(sid, "cnt", attrVal, attr, contactHandle, contactNumber)</source>
Creating Code for VB.net 2008 and R11
Create object / login and return basic information
<source lang="javascript">
Dim sid As String
Dim uHandle As String
Dim b As New casoap.USD_WebServiceSoapClient
sid = b.login("Administrator", "password")
Dim user As String = "devak01"
uhandle = b.getHandleForUserid(sid, user)
Dim arryVals As String() = {"first_name", "last_name", "organization", _
"organization.name", "admin_org.name", _
"group_list.length"}
Dim arryValsresults As String = b.getObjectValues(sid, uHandle, arryVals)
</source>
Create a Asset / Hardware Configuration item
<source lang="javascript">
Dim newexten As String = ""
Dim extenName As String = ""
Dim assethndle As String = ""
Dim car As String = ""
Dim chgHandle As String = ""
Dim chgNum As String = ""
Dim attrVal() As String = {"name", "hello2", "class", "grc:10000002"}
ReDim Preserve attrVal(3)
Dim persistent_id As String = "persistent_id"
Dim attr() As String = {persistent_id}
ReDim Preserve attr(0)
b.createAsset(sid, attrVal, attr, car, assethndle, newexten, extenName)
</source>
Create a Change Order
<source lang="javascript">
Dim attrVal() As String = {"requestor", uHandle, "category", "5103", "description", "hello world"}
ReDim Preserve attrVal(5)
Dim persistent_id As String = "persistent_id"
Dim attr() As String = {persistent_id}
ReDim Preserve attr(0)
Dim prop() As String = {}
ReDim Preserve prop(1)
Dim chgHandle As String = ""
Dim chgNum As String = ""
b.createChangeOrder(sid, uHandle, attrVal, prop, _
"", attr, chgHandle, chgNum)
</source>