Web Services
Requirement: Create a request, change Order and Contact through Web Services
Scripting- 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>
To discuss or ask questions about this article, select the discussion tab above.