473,789 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Require help with myHTTP please =)

90 New Member
Expand|Select|Wrap|Line Numbers
  1. Sub test()
  2. Dim myHTTP As MSXML2.xmlhttp                     
  3. Dim myDom As MSXML2.DOMDocument                  
  4. Dim orderno, errormsg, lineerr, lineerrmsg As MSXML2.IXMLDOMNode      
  5. Dim myxml As String
  6.  
  7. boundary = "-----------------------------29772313742745"
  8.  
  9.  
  10. myxml = "--" & boundary & vbCrLf &  _
  11. "<?xml version=""1.0"" encoding=""UTF-8""?>" & _
  12. "<OnlineCheck>" & _
  13. "<Header>" & _
  14. "<BuyerAccountId></BuyerAccountId>" & _
  15. "<AuthCode></AuthCode>" & _
  16. "<Type>Full</Type>" & _
  17. "</Header>" & _
  18. "<Item line=""1"">" & _
  19. "<ManufacturerItemIdentifier/>" & _
  20. "<DistributorItemIdentifier>1088963</DistributorItemIdentifier>" & _
  21. "<Quantity>1</Quantity>" & _
  22. "</Item>" & _
  23. "</OnlineCheck>" & vbCrLf & vbCrLf & boundary & "--"
  24.  
  25. Set myHTTP = CreateObject("msxml2.xmlhttp")
  26. Set myDom = CreateObject("MSXML2.DOMDocument")
  27. myDom.async = False
  28. myDom.Load (myxml)
  29. myHTTP.Open "POST", "", False
  30. myHTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & boundary
  31. myHTTP.setRequestHeader "Content-Disposition", "form-data; name=""xmlmsg"""
  32. myHTTP.setRequestHeader "Content-Length", Len(myxml)
  33.  
  34. myHTTP.send (myDom.xml)
  35.  
  36. MsgBox myHTTP.responseText
  37.  
  38. End Sub
Can anyone spot anything obviously wrong with this code?

M'kay.
I have to send the xml (myxml) to a website via POST.
It has to be multipart/form-data, and has to have a name of 'xmlmsg'.
Don't ask me why, it's the way they've set it up.

I have the exact same code working for another of our suppliers; with the one difference being the setRequestHeade r lines. None of our other suppliers require these; which leads me to think that's the problem.

When I ommit all the headers, I get a message saying basically 'wrong format, form name must be xmlmsg'. When I add the content-type header, this changes to <error>-3</error>.
I know, helpful right?
The company doesn't know what the error means, and haven't got an error code list. I don't know what's happened to whoever set the system up for them.

We use Access2003 and I'd prefer not to have to make a webpage to do this.

Thanks for any help/guidance you can give =)

Mandi
Sep 19 '08 #1
3 2349
mandanarchi
90 New Member
I've tried the code without the boundarys in 'myxml'.
I've tried it with the headers declared in the posted data rather than using setRequestHeade rs.
I've tried everything I can think of and I swear I'm just going backwards.


I think I just need to set the name to xmlmsg, but I can't figure out how.
I know in html it would be <form name="xmlmsg"> but in vba....

I've tried
Expand|Select|Wrap|Line Numbers
  1. SetRequestHeader="Content-Disposition", "form-data: name=""xmlmsg"""
  2. SetRequestHeader="Content-Disposition", "name=""xmlmsg"""
  3. SetRequestHeader="Content-Disposition", "name='xmlmsg'"
  4. SetRequestHeader="Content-Disposition", "name=xmlmsg"
  5. SetRequestHeader="ContentDisposition", "name=""xmlmsg"""
  6. SetRequestHeader="name", "xmlmsg"
(Not all at once though, obviously)

Nothing seems to work.

Does anyone know how to set that?

Thanks
Mandi
Sep 29 '08 #2
Stewart Ross
2,545 Recognized Expert Moderator Specialist
I suspect you are trying the wrong property here; I think CONTENT-TYPE would be more appropriate, since it is this standard header that can be used to specify that the content is a multi-part form. However, this is not my specialist area at all (or the Access forum's). Would you prefer your post to be moved to the HTML forum for a more considered view?

In the meantime you may wish to look up the following references to the standard headers and their meanings:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html (look up CONTENT-TYPE)
http://www.w3.org/Protocols/rfc2616/...c3.html#sec3.7 (look up Multipart Types)
http://www.ietf.org/rfc/rfc1867.txt

-Stewart
Sep 29 '08 #3
mandanarchi
90 New Member
I suspect you are trying the wrong property here; I think CONTENT-TYPE would be more appropriate,
-Stewart
Thanks for the reply.
I'm using content type too; and I know that one works as when I don't use it I get an error about using the wrong type. When I do use it, I just get -3.

Because I didn't get a reply in over a week, I started a similar thread in the HTML forums in case they knew anything more. But to be quite honest, I'm not sure who I should be asking about this.

I'm getting frustrated by this so I think I'll let it lie for a while and do something else. Knowing my luck it'll end up being something really obvious that I've over looked because I've been overthinking it.

Mandi
Sep 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2292
by: Andy Jacobs | last post by:
Hi All I've tried as many combinations as I can think of but I'm not getting any where. This is what I have: <? $menu = 'menus/' . $HTTP_GET_VARS . '.inc'; echo $menu; ?>
9
3549
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my python scripts as I can with MySQLdb. But I cannot even connect to the access database (see below). Could anyone explain it to me as simple as possible please. I'm using Windows XP, ActivePython 2.3.2 build 230 and Microsoft access(XP?)
2
1935
by: Darren | last post by:
I'm trying to bound a custom object to a combobox using DataSource property. The code works correctly however when the user selects a different value I get a runtime error of NullReferenceException - Object reference not set to an instance of an object. I've posted a snippet of the code below: I think it maybe something to do with CopyTo or SyncRoot as I don't understand what these are. Any please will be appreciated. Thanks, Darren.
3
2025
by: Aaron Fude | last post by:
I have this <img src="a.jpg" onClick=this.src="b.jpg\""> and it works. But I like obeying rules so I change it to <img src="a.jpg" onClick="this.src=\"b.jpg\""> and it no longer works.
4
1540
by: kirill_uk | last post by:
Help with extracting please folks.! Hi. I have this: a variable like: <a href="http://www.some_html.com/text.html" >some text</a><br> I heed to extract the "http://www.some_html.com/text.html " and put it in var "link" And extract "some text" and put it var "text",. So basically extract all between <a href=" and " >
0
2418
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
5
1734
by: sandyw | last post by:
I need help in two areas: Both are at the bottom of my program where a client has two choice to make, 1. When the client enter "Y" it takes him to the begin of the program. I would like to know what this is done ie maybe at the part where it ask you do you want to enter a new product. 2. If the client enters the wrong value or then "Y" or "N" then they are prompted with "error - Please try again" for some reason my no matter what I enter I...
2
1075
by: =?Utf-8?B?RW1tYSBIb3Bl?= | last post by:
Hi All, I have VB & SQL 2005 Express but i'm afraid i am a newbie, my background is in MS Access so please if you can give me any advice, please take my inexperience into consideration. I have two tables, i won't detail all the fields but just those that are relevant. Table 1
0
9506
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.