Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Send XML Messages via Wiinsock

Posted on 2003-11-02
3
Medium Priority
?
211 Views
Last Modified: 2013-11-13
Hi

I am having trouble sending xml requests using winsock to an application server running on my pc.
I am able to connect, but when i try to send a xml request the server hasn't received the message.

If anyone can see why the following code wouldn't work or any other suggestions, it would be appreciated.

    With Winsock1
        .Close
        .LocalPort = 0
        .RemoteHost = "localhost"
        .RemotePort = 7001
        .Connect
    End With

    Dim objXMLDoc As New DOMDocument40  
    objXMLDoc.async = False
    objXMLDoc.validateOnParse = False
    objXMLDoc.resolveExternals = False

    Dim root As IXMLDOMNode
    Set root = objXMLDoc.appendChild(objXMLDoc.createElement("Request_Logon"))
    Dim data As IXMLDOMNode
    Set data = root.appendChild(objXMLDoc.createElement("Data"))
    data.appendChild(objXMLDoc.createElement("UserName")).Text = "user_1"

    ' send xml request
    Winsock1.SendData objXMLDoc.xml

Thanks.
0
Comment
Question by:kattre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Expert Comment

by:_agj_
ID: 9668704
Try writing a simple winsock based server which does a

winsock1.listen at port 7001
in the winsock1_data arrival event, do a getData and see what sutff is coming in.

0
 
LVL 7

Accepted Solution

by:
_agj_ earned 500 total points
ID: 9668852
hey...i tried writing a lil server that opens this port and gets this data...

me did this in debug mode, and it got the data full n clean.

Me can only think of 1 option....as in, possilby the server takes some lil time to connect or mebbe it doesnt
directly take in the xml first hand.

for the first think, i suggest u wait a lil using the Sleep api or so.
BEtter option is to loop (and DoEvents) while winsock.state is not sckConected, and then do the sending the xml.

As to the other thing, i dunno how ur server starts teh communic.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question