Web Services
From SDU
Revision as of 12:56, 2 April 2008 by Arunprasad.p (Talk | contribs)
Requirement: Create a request, change Order and Contact through Web Services
Scripting- VB
Step1: Create a web reference in the front end.
1.Start the front end.
2.Go to Website menu and click “Add web reference”.
3.In the URL box provide the web service URL and click go.
http://<hostname>:8080/axis/services/USD_R11_WebService?wsdl
4.We can find the methods being pulled out.
5.Add the webreference with the name “WebReference”.
Step 2: Create an Object of the web reference
Dim ws As New WebReference.USD_WebService
Step 3: Specify the Correct web service URL.
ws.Url = "http://<hostname>:8080/axis/services/USD_R11_WebService?wsdl"
Step 4: Provide the username and password to get the sid value
Dim username, password As String
Dim sid As Integer
username = "analyst1"
password = "123"
sid = ws.login(username, password)
where login is the method used to get the sid.
Step 5: Get the User Handle
Dim userhandle As String
userhandle = ws.getHandleForUserid(sid, username)
Where getHandleForUserid is the method
Step 6: Create a Request
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)
Step 7: Create a Change Order
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)
Step 8: Create a contact
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)