Hi,

I have to send 2 xml files to a server with post.
Actualy is a Wap Push message (PAP & SI)

I must use multipart/related (to send both xml files with one post)

I have read about boundary. I try that

VB Code:
  1. Set oHttp = New XMLHTTP
  2. boundary = "asdlfkjiurwghasf"
  3. oHttp.open "POST", "http://someserver.com/", False ', "login", "passwd"
  4.  
  5. oHttp.setRequestHeader "Content-Type", "multipart/related; type=application/xml; boundary=" & boundary
  6. strBody = ""
  7.  
  8. 'PAP
  9. strBody = "--" & boundary & vbCrLf
  10. strBody = strBody & "Content-Type: application/xml" & vbCrLf & vbCrLf
  11.  
  12. strBody = strBody & "<?xml version=##1.0##?>" & vbCrLf
  13. strBody = strBody & "<!DOCTYPE pap PUBLIC ##-//WAPFORUM//DTD PAP 1.0//EN## ##http://www.wapforum.org/DTD/pap_1.0.dtd##>" & vbCrLf
  14. strBody = strBody & "<pap>" & vbCrLf
  15. strBody = strBody & "<push-message push-id=##[email protected]## deliver-before-timestamp=##2020-12-20T16:54:45Z## deliver-after-timestamp=##2001-01-22T16:57:32Z##>" & vbCrLf
  16. strBody = strBody & "<address address-value=##w*****h=3069955441122/[email protected]## />" & vbCrLf
  17. strBody = strBody & "<quality-of-service priority=##medium## delivery-method=##unconfirmed## bearer=##SMS##/>"
  18. strBody = strBody & "</push-message>" & vbCrLf
  19. strBody = strBody & "</pap>" & vbCrLf & vbCrLf
  20. strBody = strBody & "--" & boundary & vbCrLf
  21.  
  22. 'SI
  23. 'strBody = strBody & "Content-Type: application/xml" & vbCrLf & vbCrLf
  24. strBody = strBody & "Content-Type: text/vnd.wap.si; charset=ISO-8859-7" & vbCrLf & vbCrLf
  25. strBody = strBody & "<?xml version=##1.0##?>" & vbCrLf
  26. strBody = strBody & "<!DOCTYPE si PUBLIC ##-//WAPFORUM//DTD SI 1.0//EN## ##http://www.wapforum.org/DTD/si.dtd##>" & vbCrLf
  27. strBody = strBody & "<si>" & vbCrLf
  28. strBody = strBody & "<indication href=##[url]http://someserver.com/videos/sample.3gp##[/url] si-id=##[email protected]## created=##2002-10-30T20:18:43Z## si-expires=##2020-12-20T16:54:45Z## action=##signal-high##>" & vbCrLf
  29. strBody = strBody & "New video" & vbCrLf
  30. strBody = strBody & "</indication>" & vbCrLf
  31. strBody = strBody & "</si>" & vbCrLf & vbCrLf
  32. strBody = strBody & "--" & boundary & "--" & vbCrLf
  33. strBody = Replace$(strBody, "##", Chr$(34))
  34. aPostData = StrConv(strBody, vbFromUnicode)
  35. oHttp.send aPostData
  36. MsgBox oHttp.responseText

Is that the correct way to built a multipart post?

thanks in advance