0
votes

I need some help Calling a wsdl web service function. The WSDL have one function named "Bye" that is waiting for 1 parameter of a type String. Then it gives back a type of string text. How can is make the call under VBA

I can call it with a prebuilded XML that i send, but it gives me an XML in return. There has to be a simpler way for this.

Dim URL As String
URL = "httx://webpage:8080/something/services/ByeService"

Dim requestDoc As New MSXML2.DOMDocument60


Dim root
Set root = requestDoc.createNode(1, "Envelope", "http://schemas.xmlsoap.org/soap/envelope/")
requestDoc.appendChild root

Dim nodeBody
Set nodeBody = requestDoc.createNode(1, "Body", "http://schemas.xmlsoap.org/soap/envelope/")
root.appendChild nodeBody

'Dim nodeOp
Set nodeOp = requestDoc.createNode(1, "Bye", "urn:MatrixService")
nodeBody.appendChild nodeOp

Dim nodeRequest
Set nodeRequest = requestDoc.createNode(1, "Bye", "urn:MatrixService")
'content of the request will vary depending on the WCF Service.'
' This one takes just a string. '
nodeRequest.Text = "This is a string to say goodbye"

nodeOp.appendChild nodeRequest

Set nodeRequest = Nothing
Set nodeOp = Nothing
Set nodeBody = Nothing
Set root = Nothing

'Here i can call it with the XML and get an XML Dim XMLHTTP As New MSXML2.XMLHTTP XMLHTTP.Open "POST", "httx://webpage:8080/something/services/ByeService", False XMLHTTP.setRequestHeader "Content-Type", "text/xml" XMLHTTP.setRequestHeader "SOAPAction", "urn:MatrixService" XMLHTTP.send requestDoc MsgBox XMLHTTP.responseText

1

1 Answers

0
votes

you could try :

Set objXML = CreateObject("MSXML2.XMLHTTP")
strURL = "httx://webpage:8080/something/services/ByeService"
objXML.Open "POST", strURL, False
objXML.setRequestHeader "content-type", "text/xml"
objXML.setRequestHeader "SOAPAction", "urn:MatrixService"
objXML.Send "Bye" 

strResult = objXML.ResponseText