Solved

Send XML Messages via Wiinsock

Posted on 2003-11-02
3
200 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
  • 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 125 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 124
Excel - Save a copy of work book 13 89
How does CurrentUser work? 10 38
VB6 ListBox Question 4 48
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

840 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