Bonjour,
Je voudrais faire cette arborescence, représentant mon enveloppe SOAP :
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.sunat.gob.pe" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <soapenv:Header> <wsse:Security> <wsse:UsernameToken> <wsse:Username>20100066603MODDATOS</wsse:Username> <wsse:Password>moddatos</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <ser:sendBill> <fileName>20100066603-01-F001-1.zip</fileName> <contentFile>cid:20100066603-01-F001-1.zip</contentFile> </ser:sendBill> </soapenv:Body> </soapenv:Envelope>
Pour cela, je me base sur l'exemple mentionné à cette adresse : http://www.example-code.com/vbdotnet/http_soap.asp
Problème: j'obtiens ce résultat:
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.sunat.gob.pe" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <soapenv:Header> <wsse:Security> <wsse:UsernameToken> <wsse:Username>20100066603MODDATOS</wsse:Username> <wsse:Password>moddatos</wsse:Password> </wsse:UsernameToken> </wsse:Security> <fileName>20100066603-01-F001-1.zip</fileName> <contentFile>cid:20100066603-01-F001-1.zip</contentFile> </soapenv:Header> <soapenv:Body/> </soapenv:Envelope>
Le code que j'ai tapé est le suivant:
Code VB : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 Dim soapReq As New Chilkat.Xml soapReq.Encoding = "utf-8" soapReq.Tag = "soapenv:Envelope" soapReq.AddAttribute("xmlns:soapenv", "http://schemas.xmlsoap.org/soap/envelope/") soapReq.AddAttribute("xmlns:ser", "http://service.sunat.gob.pe") soapReq.AddAttribute("xmlns:wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") soapReq.NewChild2("soapenv:Header", "") soapReq.NewChild2("soapenv:Body", "") soapReq.FirstChild2() soapReq.NewChild2("wsse:Security", "") soapReq.FirstChild2() soapReq.NewChild2("wsse:UsernameToken", "") soapReq.FirstChild2() soapReq.NewChild2("wsse:Username", param_ruc & param_usario) soapReq.NewChild2("wsse:Password", param_mdp) soapReq.GetRoot2() soapReq.GetParent2() soapReq.NewChild2("ser:SendBill", "") soapReq.FirstChild2() soapReq.NewChild2("FileName", param_nom_fichier & ".zip") soapReq.NewChild2("contentFile", "cid:" & param_nom_fichier & ".zip") soapReq.GetRoot2()
Auriez-vous des idées? Merci
Partager