Solved

Send XML Messages via Wiinsock

Posted on 2003-11-02
3
197 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_
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Choosing the right language for new project 8 58
array6 challenfge 6 62
Using "ScreenUpdating" 6 45
Problem to open Excel file 15 37
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now