UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Sending An Xml String In Ie    
 
   
genemacd
post Oct 15 2012, 04:54 PM
Post#1



Posts: 21
Joined: 12-March 09



I could really use some help with this. I'm attempting to send XML to a Web Services API to send a fax. They have examples of how to do it for everything except vb. I have an Access Application that I want to send the information from. I'm using the "Microsoft Internet Controls" control in MS Access to create the fax. I've managed to connect to the fax server with the following response so I know my HTTP address is correct and my headers are correct. The API instructions are attached. I really only need help in sending the xml and possibly how to read the reply.
lt;?xml version="1.0" encoding="UTF-8" ?>
- <response>
<message>Success</message>
</response>
Does the XML text go in the Post argument of the navigate? I tried it and it doesn't work. I may just have to experiment more but I don't want to waste anymore time on it.
My code is as follows. It runs in a form with the MS internet active x control (very basic)
Private Sub Form_Load()
Dim FSO As New FileSystemObject
Dim txtstrm As TextStream
Dim vPost As Variant
Dim vHeaders As Variant
Dim vFlags As Variant
' this reads a text file with my xml info and puts it in vPost
Set txtstrm = FSO.OpenTextFile("C:\Collections\FaxXML_Info.txt", ForReading)
vPost = txtstrm.ReadAll
txtstrm.Close
Dim vTarget As Variant
vHeaders = "content-type: application/xml" & Chr(10) + Chr(13) & "authorization: Basic YWRtaW46YWRtaW4=" & Chr(10) & Chr(13) ' this appears to be OK
Set WV = Me!WebBrowser0.Object ' set my web control object
WV.Navigate "http://192.168.1.13/ffws/v1/ofax" & Chr(10) + Chr(13), vFlags, vTarget, vPost, vHeaders 'navigates to server
End Sub
Attached File(s)
Attached File  Post_Info.txt ( 2.89K )Number of downloads: 4
 
Go to the top of the page
 
jleach
post Oct 16 2012, 04:22 AM
Post#2


UtterAccess Editor
Posts: 9,815
Joined: 7-December 09
From: Staten Island, NY, USA


I'm not sure if this is all the problem - haven't digested much yet - but take a look at your XML... before the first repsonse tag, see that hyphen on the left? That needs to go. For whatever reason, IE puts those in there to "help us" see where the tags are opened, but they are put in as an actual part of the xml instead of part of the view, and this completely breaks the xml.
IF and Chrome will view XML fine, or a regular text editor (actually I prefer Notepad++ for pretty much all text-base files, especially xml).
Ohadn't sorted out anything else - not sure when I can - but that's one thing if you weren't already handling it accordingly.
Cheers
Go to the top of the page
 
genemacd
post Oct 17 2012, 08:20 PM
Post#3



Posts: 21
Joined: 12-March 09



Thanks for the reply.
think I figured it out.
Oneeded to dim a byte array
Dim PostData() as Byte
Then I needed to convert the xml to the byte array
PostData = StrConv(vPost, vbFromUnicode)
then post the PostData in the navigate call
I'll have some more work to do on it but this got the server to send the fax
Go to the top of the page
 
jleach
post Oct 18 2012, 06:12 AM
Post#4


UtterAccess Editor
Posts: 9,815
Joined: 7-December 09
From: Staten Island, NY, USA


Glad you got it figured out, I looked at it briefly but was at a bit of a loss and didn't have the time to really dig into it.
Thanks for posting back.
Cheers,
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 07:49 AM