Re: Importing XML through .NET Web Service with VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




For those who may find it useful, I have figured it out. Here is the
algorithm:


Code:
--------------------
Public Sub GetXML()

Dim objSClient As MSSOAPLib30.SoapClient30 ' soap object to access and expose web service interface
Dim oXML As MSXML2.DOMDocument40 ' xml document object
Dim rst As New ADODB.Recordset ' ADODB recordset
Dim str As New ADODB.Stream ' ADODB stream

' create new soap client
Set objSClient = New SoapClient30

'create new empty XML document
Set oXML = New DOMDocument40

' Point the SOAP API to the web service that we want to call...
' the wsdl file contains the scheme for the webservice
Call objSClient.mssoapinit(par_WSDLFile:="http://localhost/WebService.wsdl";)

' Call the web service and load requested XML document in to MSXML DOM document structure
Call oXML.LoadXml(objSClient.GetXMLString())

' open sream
str.Open

' save xml document from web service to stream
oXML.Save str

' set starting position to beginning of stream
str.Position = 0

' open recordset from stream
rst.Open str

' copy recordset to range of cells
Range("A1").CopyFromRecordset rst

Set oXML = Nothing
Set objSClient = Nothing
Set rst = Nothing
Set stream = Nothing

End Sub
--------------------


My next step is to figure out how to get the field names from the XML
file.


--
brazilnut
------------------------------------------------------------------------
brazilnut's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29411
View this thread: http://www.excelforum.com/showthread.php?threadid=491228

.



Relevant Pages

  • Getting soap configuration to work
    ... ' Define a SOAP Extension that traces the SOAP request and SOAP response ... Private oldStream As Stream ... Public Overrides Function ChainStreamAs ... ByVal attribute As SoapExtensionAttribute) As Object ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Inserting a SOAP Header in a client request
    ... Every Soap based ... So all you need to do is write to the chained stream using an xml writer. ... custom SoapHeader and modify the ws client proxy by hand to ... > SoapMessage before adding the soap header but that would be ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Exchanging information
    ... The problem with serialised objects is both ends have to be running ... compress the stream, you get a quite compact binary stream. ... You must be able to recreate them after source code changes. ... SOAP helps you waste bandwidth if you have invested in companies like ...
    (comp.lang.java.help)
  • Re: Error on web service: "Server returned internal error 500"
    ... Why dont you use microsoft soap toolkit for intercepting the ... going on when web services correspond with each other (or other ... Stream sendStream = httpReq.GetRequestStream; ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: SOAP with Attachment
    ... I need to exchange XML document. ... It seems that soap with attachment is the best choice. ... not support automatic code generation for soap with attachment. ... MyEclipse have a good support for XFire webservices. ...
    (comp.lang.java.programmer)