By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,780 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,780 IT Pros & Developers. It's quick & easy.

problem in "Calling a Dotnet Created WebService in VB Client"

P: 1
I am facing a problem while reading the result which is loaded in DOMDocument.
In which I am sending a request to web service and getting a record of Single Order.
This is my VB Code which is i am using....
........................
Dim Connector As SoapConnector30 ' To connect to webservice
Dim Serializer As SoapSerializer30 ' To serialize the XML data
Dim Reader As SoapReader30 ' To read the Webservice response data

Dim domResult As New MSXML2.DOMDocument
Dim ResultElm As IXMLDOMElement ' To store the Webservice response in DOM
Dim FaultElm As IXMLDOMElement ' for Error handling

Dim END_POINT_URL As String ' URL of the Webservice to call
Dim SoapAction As String
Dim CALC_NS As String

Dim objNodeList As IXMLDOMNodeList

END_POINT_URL = "http://localhost/webservicesserver/UsingDataSet.asmx"
'SoapAction = "UsingDataSetNameSpace/GetCustomerByArray"
SoapAction = "UsingDataSetNameSpace/GetRecord"
CALC_NS = "UsingDataSetNameSpace"

'To Connect webservice
Set Connector = New HttpConnector30
Connector.Property("EndPointURL") = END_POINT_URL
Connector.Connect


' binding/operation/soapoperation
Connector.Property("SoapAction") = SoapAction '& Method
Connector.BeginMessage

'Preapare the SOAP Request
Set Serializer = New SoapSerializer30
Serializer.Init Connector.InputStream

Serializer.StartEnvelope
Serializer.StartBody
Serializer.StartElement Method, CALC_NS ' Setting Method name

Serializer.EndElement

Serializer.EndBody
Serializer.EndEnvelope

Connector.EndMessage ' This statement actually send the data to webservice

'Reading Webservice Response
Set Reader = New SoapReader30
Reader.Load Connector.OutputStream

If Not Reader.Fault Is Nothing Then
MsgBox Reader.FaultString.Text, vbExclamation ' In case of Error
Else
Set ResultElm = Reader.RpcResult ' Response come as XML document
Set domResult = Reader.Dom
End If

'MsgBox domResult.xml

'MsgBox ResultElm.xml

MsgBox domResult.getElementsByTagName("GetRecordResult"). length

Dim i As Integer
For i = 0 To domResult.getElementsByTagName("GetRecordResult"). length - 1
MsgBox domResult.getElementsByTagName("GetRecordResult"). Item(0).nodeName
Next

End Sub
........................................

My Request in xml format to Web Services is....

<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAPSDK4:GetRecord xmlns:SOAPSDK4="http://localhost/webservicesserver/UsingDataSetNameSpace/GetRecord"/></SOAP-ENV:Body></SOAP-ENV:Envelope>

My Web Service Response is...

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetRecordResponse
xmlns="http://localhost/webservicesserver/UsingDataSetNameSpace"><GetRecordResult orderId="60823"
productCd="MBFX" carrierCd="CONC" statusCd="ACTV"
/></GetRecordResponse></soap:Body></soap:Envelope>


I am unable to read DOMDocument by getElementsByTagName or by xpath.

Thanks in advance for your Reply....
Nov 2 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.