Hello all. I am embarking on a work project to try to make everyone in my office a little bit happier. Right now we need travel rates between 2 zip codes, we have to go to a website, enter a csv file with all details (origin, destination, date, etc.) and it will return the same csv file with a rate amended. The problem with this method is that it is not efficient for large volumes of inquiries.
I did some digging and discovered in the user manual that it is possible for users to develop an interface to the service. The manual includes a WSDL address, that I can't link to here for confidentiality reasons, and also gives the base XML behind most of the web methods.
Right now I am trying to get the simplest of the methods to work. The system
performs authentication for every service request received. This requires the service consumer to pass an authentication token within the SOAP Header. I am not sure how to use this, but here is the XML behind it.
The first thing that I am trying to get to work is a method named isReady that takes in no arguments and returns a boolean. This service is used to determine if the web service is accepting rating requests.Code:<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.***.com"> <soapenv:Header> <web:AuthenticationToken> <web:licenseKey>licensekey</web:licenseKey> <web:password>password</web:password> <web:username>username</web:username> </web:AuthenticationToken> </soapenv:Header> <soapenv:Body> </soapenv:Body> </soapenv:Envelope>
XML for the input:
XML for the output:Code:<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.***.com"> <soapenv:Header> <web:AuthenticationToken> <web:licenseKey> string </web:licenseKey> <web:password> string </web:password> <web:username> string </web:username> </web:AuthenticationToken> </soapenv:Header> <soapenv:Body> <web:isReady/> </soapenv:Body> </soapenv:Envelope>
This is what i tried to use in Access's VBA.Code:<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <ns1:isReadyResponse xmlns:ns1="http://webservices.***.com"> <ns1:out> boolean </ns1:out> </ns1:isReadyResponse> </soap:Body> </soap:Envelope>
Whenever I try that, I end up with an error that says:Code:Public Sub GetXML() Dim objSClient As MSSOAPLib.SoapClient Dim oXML As MSXML2.DOMDocument40 Dim rst As New ADODB.Recordset Dim str As New ADODB.Stream Set objSClient = New SoapClient Set oXML = New DOMDocument40 objSClient.mssoapinit "http://applications.***.com/AdminManager/services/**********?wsdl" oXML.loadXML (objSClient.isReady()) str.Open oXML.Save str str.Position = 0 rst.Open str Set oXML = Nothing Set objSClient = Nothing Set rst = Nothing Set Stream = Nothing End Sub
Run Time error '-2147467259 (80004005)':
Request must include a custom header and a AuthenticationToken.
Please see your user's guide for details: <soapenv:Header>
<web:AuthenticationToken><web:lisenceKey>??????</web:lisenceKey> <web:username>??????</web:username></web:AuthenticationToken>
</soapenv:Header>
Can anyone out there please point me in the right direction?




Reply With Quote