Solved

Send XML Messages via Wiinsock

Posted on 2003-11-02
3
204 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

751 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