Connecting Tech Pros Worldwide Help | Site Map

Access 2003 Web Service VBA Code to Consume Web Services

  #1  
Old September 7th, 2006, 09:22 PM
Newbie
 
Join Date: Aug 2006
Posts: 4
We developed a small test database that we are using to attempt to connect to a wsdl to consume web services. The database form contains 3 fields and a submit button on the form. At the bottom I've included the code behind the button on the form and the class module code that was generated by the Web Service Tool.

I've added a little bit of information that pertains to the Access Database and our process and expected results:

VBA for connection to wsdl has been generated using the Web Service Tool and is displayed in the Class Module called clsws_Service0
From the form the user will input Submission ID, Timestamp and Sequence.
Clicking Submit should run vba code to Call the Class Module, passing the field data values input into the form which will in turn call the wsdl document
The form field values should be cleared
The user should receive either an error message or success message
In the class module it states that we are to Dimension the class as a new Class which we have done. We have also added the fields in the form to the code. What we do not know how to do is to write the appropriate code to accomplish what we have outlined above.


We do not understand exactly what we should be putting in our Access 2003 application to make this work. Can anyone help us out with the code in VBA to do this!

From the form I click on a submit button. This is the code behind the button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Submit_Click()
  2.  
  3. Dim objNodeList As IXMLDOMNodeList
  4.  
  5. Dim SubLogTest As New clsws_Service0
  6. Dim strSubmissionID As String
  7. Dim strTimestamp As String
  8. Dim strSequence As String
  9. Dim strSeparator As String
  10. strSeparator = "<br />" + Chr$(10)
  11.  
  12. strSubmissionID = strSubmissionID
  13. strTimestamp = strTimestamp
  14. strSequence = strSequence
  15.  
  16. MsgBox ("Got this far")
  17.  
  18. Set SubLogTest = New clsws_Service0
  19.  
  20. Set objNodeList = SubLogTest.wsm_CorrectedAddressXml(txtSubmissionID, txtTimestamp, txtSequence)
  21.  
  22. End Sub
This is the code generated by using the Web Service Tool and connecting to the url given to us by our xml team

Last edited by Dormilich; March 7th, 2009 at 07:07 PM. Reason: added const keyword
  #2  
Old September 8th, 2006, 01:53 PM
Newbie
 
Join Date: Aug 2006
Posts: 4

re: Access 2003 Web Service VBA Code to Consume Web Services


In the past, I used IXMLDOMNodeList against complex data types returned from web services calls.The document is expecting XML as input and returns XML as output. I looked for documentation for sending XML as a complex data type to a web service but was unable to find any info.

For now this is the input XML format. There is an XSD for it.
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <SHSQuoteDataReadReq
  4.  
  5. xmlns="http://www.gaic.com/SHSQuoteData"    
  6. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  7. xsi:schemaLocation="http://www.gaic.com/SHSQuoteData SHSQuoteData.xsd
  8. http://www.w3.org/XML/1998/namespace xml-ns.xsd">
  9.  
  10.   <MsgStatusCd/>
  11.  
  12.   <MsgStatusDesc/>
  13.  
  14.   <SubmissionID>3632</SubmissionID>
  15.  
  16.   <QuoteKey>
  17.  
  18.     <QuoteTxnTimestamp>2006-07-06-10.22.38.957176</QuoteTxnTimestamp>
  19.  
  20.     <QuoteTxnSeq>02</QuoteTxnSeq>
  21.  
  22.   </QuoteKey>
  23.  
  24.   </SHSQuoteDataReadReq>

Last edited by Dormilich; March 7th, 2009 at 07:08 PM. Reason: added [code] tags
Reply