[asp/xml] Required white space was missing.

Pagina: 1
Acties:
  • 205 views sinds 30-01-2008
  • Reageer

  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Hey,

ik probeer via ASP een stuk XML op een server te posten (ja, Bibit :)) maar ik krijg de melding 'Required white space was missing'.

Toen ik op Google zocht kwam ik iemand tegen die hetzelfde probleem had, er een oplossing voor vond, maar die niet even postte :|.

Kunnen jullie me misschien uitleggen waardoor zo'n fout wordt veroorzaakt?

Als het nodig is kan ik de code ook wel posten...

  • hammerhead
  • Registratie: April 2000
  • Laatst online: 17:23
Ik ben sinds kort ook bezig met XML en vriend van me die veel met XML werkt heeft me verteld dat in elk boek over XML er minimaal een hoofdstuk besteed wordt aan whitespace.... Schijnt iets te zijn waar je goed op moet letten bij XML :-)

Zonder iets van code kan ik ook niet zien wat het probleem is.. Zou dus idd makkelijker zijn als je iets van code laat zien.....

Aviation is proof that given the will, we have the capacity to achieve the impossible.
--Eddie Rickenbacker


  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Required whitespace... over het algemeen is whitespace juist niet required ;) .

Laat je XML eens zien, zo is het nogal lastig helpen :) .

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment


  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Ok, met ASP wordt dit stuk XML aangemaakt:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function makeXMLorder(orderid)
        xml = "<?xml version='1.0'?>"  & vbcrlf 
        xml = xml & "<!DOCTYPE paymentService PUBLIC '-//Bibit/DTD Bibit PaymentService v1//EN' 'http://dtd.bibit.com/paymentService_v1.dtd'>"  & vbCRLF        
        xml = xml & "<paymentService version='1.0' merchantCode='shopnaam'>"  & vbcrlf
        xml = xml & "<submit>"  & vbcrlf
        xml = xml & "<order orderCode='23'>"  & vbCRLF
        xml = xml & "<description>arf</description>"  & vbCRLF
        xml = xml & "<amount exponent='2' currencyCode='NLG' value='232323'/>"  & vbCRLF
        xml = xml & "<orderContent>sdfsdf</orderContent>"  & vbCRLF
        xml = xml & "<paymentMethodMask><include code='ALL'/></paymentMethodMask>"  & vbCRLF 
        xml = xml & "</order>"  & vbCRLF 
        xml = xml & "</submit>"   & vbCRLF
        xml = xml & "</paymentService>"
    makeXMLorder = xml 
end function

  • mbravenboer
  • Registratie: Januari 2000
  • Laatst online: 06-11-2025
Hier zou het niet aan mogen liggen:
code:
1
2
martin@linux:~/tmp > xml-validate -file bibit.xml
Input is valid.

Gevalideerd tegen de opgegeven DTD door Apache's Xerces XML parser...

Blog, Stratego/XT: Program Transformation, SDF: Syntax Definition, Nix: Software Deployment


  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Hmm minder.
Het hele script ziet er zo uit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<%
sUser   = "xxxxxxx"
sPass   = "xxxxxxx"
sURL    = "https://secure-test.bibit.com/jsp/merchant/xml/paymentService.jsp"
sXML     = makeXMLorder("37482")        ' 37482 is the orderID in the database
call XML2Bibit(sXML)

sub XML2Bibit(sXML)

    Set xmlhttp =  Server.CreateObject("Msxml2.ServerXMLHTTP")      
    xmlhttp.Open "POST",sURL, false, sUser, sPass
    xmlhttp.setRequestHeader "Content-Type", "text/xml"

    on error resume next
    xmlhttp.Send(sXML)

    if err then
        Response.Write "Err = " & err.description & "<BR>"
        Response.Write "Send Status : " & xmlhttp.status & "<BR>"
        Response.End
    end if
        
    Response.Write "Send Status (200 = OK) : " & xmlhttp.status & "<BR>Response : <BR>" ' Display the Response
    'Response.write "Headers :" & "<BR>" & xmlhttp.getAllResponseHeaders
    
    sUrl = ParseResponse(xmlhttp.responseText)
    if instr(sUrl,"ERROR") then 
        Response.Write sURL
    else
        Response.Write "<BR>Redirect URL : <A HREF=" & sUrl & ">" & sUrl & "</A>" 
        'Response.redirect url ' go to BIBIT payment selection page 
    end if  
        
end sub

function ParseResponse(sXML)
    Set xmldoc = CreateObject("msxml2.domdocument")
    xmldoc.async = False : xmldoc.validateOnParse = true
    xmldoc.setProperty "ServerHTTPRequest", true 

    If Not xmldoc.loadxml(sXML) Then
        tmp = "ERROR - XML load failed ! <BR>" 
        tmp = tmp & "errorcode : " & xmldoc.parseError.errorcode & ", " & xmldoc.parseError.reason & "<BR>"
        tmp = tmp & "srctext : " & xmldoc.parseError.srctext & "<BR>"
        tmp = tmp & "url : " &xmldoc.parseError.url & "<BR><BR>"
        tmp = tmp & "XML received : " & Server.HTMLEncode(sXML)
        ParseResponse = tmp
    else
        Set oCurrNode = xmldoc.documentElement.selectSingleNode("/paymentService/reply/orderStatus/reference")
        if oCurrNode is nothing then
            ParseResponse = "ERROR - no URL found"
        else
            ParseResponse = oCurrNode.text
        end if
    end if
end function

function makeXMLorder(orderid)
        xml = "<?xml version='1.0'?>"  & vbcrlf 
        xml = xml & "<!DOCTYPE paymentService PUBLIC '-//Bibit/DTD Bibit PaymentService v1//EN' 'http://dtd.bibit.com/paymentService_v1.dtd'>"  & vbCRLF        
        xml = xml & "<paymentService version='1.0' merchantCode='RECESS'>"  & vbcrlf
        xml = xml & "<submit>"  & vbcrlf
        xml = xml & "<order orderCode='2323'>"  & vbCRLF
        xml = xml & "<description>arf</description>"  & vbCRLF
        xml = xml & "<amount exponent='2' currencyCode='NLG' value='232323'/>"  & vbCRLF
        xml = xml & "<orderContent>sdfsdf</orderContent>"  & vbCRLF
        xml = xml & "<paymentMethodMask><include code='ALL'/></paymentMethodMask>"  & vbCRLF 
        xml = xml & "</order>"  & vbCRLF 
        xml = xml & "</submit>"   & vbCRLF
        xml = xml & "</paymentService>"
    makeXMLorder = xml 
end function 
%>

Het originele Bibit voorbeeld vind je hier.

  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Hmmm, het zou ook kunnen zijn dat die fout niet in het stuk XML zit dat ik verstuurd, maar in het geen dat ik terug krijg van Bibit bedenk ik me ineens...

Complete foutmelding vind je hier:

http://www.recess.nl/ricktest/testorder.asp

  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 16:17

Basszje

Reisvaap!]

<H1>Authorization Required</H1> ? krijg ik ?

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Tjakka...het werkt.
M'n pass was verlopen oid, heb 'm gewijzigd...dat was het enige dat mis ging!

Woohoo :)

  • Alarmnummer
  • Registratie: Juli 2001
  • Laatst online: 09-07-2024

Alarmnummer

-= Tja =-

Het probleem zit hem in je character set. Ik ben er zelf ook al een paar keer tegen aan gelopen. Ik gebruik soms ultraedit om mijn character set naar utf-8 te krijgen. Ik vind dit echt heeeel vaag. En nadat ik heb geconverteerd loopt het als een treintje..
Pagina: 1