[AccessD] Vba with SOAP experiences

MartyConnelly martyconnelly at shaw.ca
Tue Dec 28 12:18:52 CST 2004


Since MS is downgrading (or whatever metaphor is in vogue today, for no 
support) their soap toolkits, they are  trying to force everything to 
dotNet web services.
You could download Web Service References Tool 2.0 from MS and run with 
Access 2003. Not sure if it runs with lower versions.
You could run with 2003 generate the classes then put them in say Access 
XP or 2000

If using MS, I might go with Simon Fell's Pocket Soap toolkit, he had 
his version out a year before Microsoft's tollkit appeared. It works for 
Java and Pocket Pc's
http://www.pocketsoap.com
If it is a simple web service say just credit card verification against 
an asmx or wsdl file, you might get away with just building your own 
soap mesage and envelope  in xml and sending via xmlhttp then parsing 
the response. Needs a lot of xml and soap basic knowledege to handle errors.
You build your Soap envelope and message by looking at the wsdl file. 
easier if they have Disco (Discovery) service.

PS a lot of vendors describe their web service as SOAP but it isn't even 
close to standard.
I looked at Amazon 18 months ago and they were way off.

This will work with Access 97 if web service still up.

Dim objStyle  As MSXML2.DOMDocument
Dim objXMLDOM As MSXML2.DOMDocument
Const checked As Boolean = True


Function BuildSoapEnvelopeSmall(strAddress As String, _
           strCity As String, strState As String) As String
'Function builds the SOAP Envelope
 Dim SOAPEnvelope As String
 Dim xmlInit As String

'   POST /zipcoderesolver/zipcoderesolver.asmx HTTP/1.1
'Host: webservices.eraserver.net
'Content-Type: text/xml; charset=utf-8
'Content -length: length
'SOAPAction: "http://webservices.eraserver.net/FullZipCode"
'<?xml version="1.0" encoding="utf-8"?>

 'strAddress = "Microsoft"
 'strCity = "Redmond"
 'strState = "WA"
 'strAddress = "1151 Marina Village"
 'strCity = "Alameda"
 'strState = "CA"

'Build SOAPEnvelope
     SOAPEnvelope = "<soap:Envelope " & _
     "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " & _
     "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" " & _
     "xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""> " & _
     " <soap:Body>" & _
     " <FullZipCode xmlns=""http://webservices.eraserver.net/"">" & _
     " <accessCode>" & "9999" & "</accessCode>" & _
     " <address>" & strAddress & "</address>" & _
     " <city>" & strCity & "</city>" & _
     " <state>" & strState & "</state>" & _
     " </FullZipCode>" & _
     " </soap:Body>" & _
     " </soap:Envelope>"
     xmlInit = "<?xml version=""1.0"" encoding=""utf-8""?>"
     SOAPEnvelope = xmlInit & SOAPEnvelope
    BuildSoapEnvelopeSmall = SOAPEnvelope
Debug.Print BuildSoapEnvelopeSmall
End Function

Function SubmitFormSmall(strAddress As String, _
           strCity As String, strState As String) As String
'returns Address Zip Code
'Submit Soap Envelope to ASMX net Server Page
'sample call
'?SubmitFormSmall ("1151 Marina Village","Alameda", "CA")
'? SubmitFormSmall("Microsoft", "Redmond", "WA")
Dim objXMLHTTP As New MSXML2.XMLHTTP
Dim HTMLResponse As String
Dim SoapResponse As String
Dim SoapRequest As String
Dim objXMLDOM As MSXML2.DOMDocument
  Set objStyle = New DOMDocument
  Set objXMLDOM = New DOMDocument

    objXMLDOM.async = False

    'Send SOAP Request
    Set objXMLHTTP = New MSXML2.XMLHTTP

 ' objXMLHTTP.setRequestHeader "Content-Type", "text/xml"


objXMLHTTP.Open "POST", 
"http://webservices.eraserver.net/zipcoderesolver/zi" & _
"pcoderesolver.asmx", False

objXMLHTTP.setRequestHeader "SOAPAction", 
"http://webservices.eraserver.net/" & _
"FullZipCode "
    objXMLHTTP.setRequestHeader "Content-Type", "text/xml"
    'On Error Resume Next
    objXMLHTTP.send BuildSoapEnvelopeSmall(strAddress, _
                                           strCity, strState)

    MsgBox "XML Status=" & objXMLHTTP.status
    If (objXMLHTTP.status <> 200) Then
        'SoapResponse.innerHTML = objXMLHTTP.responseText
           Debug.Print "Error=" & objXMLHTTP.responseText
     Else
    'Show SOAP Response
    MsgBox "returned=" & objXMLHTTP.responseXML.xml
     Debug.Print "returned=" & objXMLHTTP.responseXML.xml
        objXMLDOM.loadXML (objXMLHTTP.responseXML.xml)

    'Translate SOAP Response from xml and show response
    Dim strLoginResult As String
     strLoginResult = objXMLDOM.selectSingleNode("soap:Envelope").xml
    Debug.Print "xml=" & strLoginResult
    strLoginResult = objXMLDOM.selectSingleNode _
("soap:Envelope/soap:Body/FullZipCodeResponse/FullZipCodeResult").xml
       Debug.Print "text=" & strLoginResult
    strLoginResult = objXMLDOM.selectSingleNode _
("soap:Envelope/soap:Body/FullZipCodeResponse/FullZipCodeResult").nodeTypedValue
       Debug.Print "Zip code value=" & strLoginResult
   'If the zip + 4 code all zeroes address not found
    End If
    SubmitFormSmall = strLoginResult

End Function

MastercafeCTV wrote:

>Hi group, we are searching information about SOAP to include on an
>application for POS (Point of sale). We are trying to put a service to
>credit card for pay the bill.
>
>Thank you very much
>
>Juan
>
> 
>===========================================
>MASTERCAFE S.L.  NIF - B 82.617.614
>Juan Menéndez Crespo
>Plaza Puerta de Europa 2, 1-D (33011 Oviedo)
>www.mastercafe.com
>info at mastercafe.com
>===========================================
>El contenido del presente correo es privado. Todos los archivos adjuntos han
>sido revisados y escaneados con McAfee VirusScan 8. Solo serán válidos
>aquellos archivos que estén identificados en el cuerpo del correo y que se
>describa su composición y contenido del mismo.
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list