Difference between revisions of "Web Services"

From SDU
Jump to: navigation, search
m
m
Line 4: Line 4:
  
 
'''Step1: Create a web reference in the front end.'''
 
'''Step1: Create a web reference in the front end.'''
 
 
#Start the front end.
 
#Start the front end.
 
#Go to Website menu and click “Add web reference”.
 
#Go to Website menu and click “Add web reference”.
Line 10: Line 9:
 
#We can find the methods being pulled out.
 
#We can find the methods being pulled out.
 
#Add the webreference with the name “WebReference”.
 
#Add the webreference with the name “WebReference”.
 +
  
 
'''Step 2: Create an Object of the web reference'''
 
'''Step 2: Create an Object of the web reference'''
     
 
 
<source lang="javascript">Dim ws As New WebReference.USD_WebService</source>
 
<source lang="javascript">Dim ws As New WebReference.USD_WebService</source>
  
'''Step 3: Specify the Correct web service URL.'''
 
  
 +
'''Step 3: Specify the Correct web service URL.'''
 
<source lang="text">ws.Url = "http://<hostname>:8080/axis/services/USD_R11_WebService?wsdl"</source>
 
<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'''
 
'''Step 4: Provide the username and password to get the sid value'''
 
 
 
<source lang="javascript">Dim username, password As String
 
<source lang="javascript">Dim username, password As String
 
Dim sid As Integer
 
Dim sid As Integer
Line 27: Line 25:
 
password = "123"
 
password = "123"
 
sid = ws.login(username, password)</source>
 
sid = ws.login(username, password)</source>
 
 
where login is the method used to get the sid.
 
where login is the method used to get the sid.
 +
  
 
'''Step 5: Get the User Handle'''
 
'''Step 5: Get the User Handle'''
 
 
 
<source lang="javascript">Dim userhandle As String
 
<source lang="javascript">Dim userhandle As String
 
userhandle = ws.getHandleForUserid(sid, username)</source>
 
userhandle = ws.getHandleForUserid(sid, username)</source>
 
Where getHandleForUserid is the method
 
Where getHandleForUserid is the method
 +
  
 
'''Step 6: Create a Request'''
 
'''Step 6: Create a Request'''
 
 
 
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String
 
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String
 
Dim requestHandle, requestNumber As String
 
Dim requestHandle, requestNumber As String
Line 48: Line 43:
 
requestNumber = ""
 
requestNumber = ""
 
ws.createRequest(sid, userhandle, attrVal, prop, "", attr, requestHandle, requestNumber)</source>
 
ws.createRequest(sid, userhandle, attrVal, prop, "", attr, requestHandle, requestNumber)</source>
 +
  
 
'''Step 7: Create a Change Order'''
 
'''Step 7: Create a Change Order'''
 
 
 
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String
 
<source lang="javascript">Dim attrVal(5), attr(1), prop(1), persistent_id As String
 
Dim requestHandle, requestNumber As String
 
Dim requestHandle, requestNumber As String
Line 63: Line 57:
  
 
'''Step 8: Create a contact'''
 
'''Step 8: Create a contact'''
 
 
<source lang="javascript">Dim attrVal(5), attr(1), persistent_id As String
 
<source lang="javascript">Dim attrVal(5), attr(1), persistent_id As String
 
Dim contactHandle, contactNumber As String
 
Dim contactHandle, contactNumber As String

Revision as of 01:31, 3 April 2008

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 <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 make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.