CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

[VB.NET] Enveloppe SOAP

kamehameha2
kamehameha2
Niveau 7
30 mai 2014 à 16:30:10

Bonjour, je fais un projet en VB.NET, sous VS2010, framework 3, dans lequel je fais appel à un web service, je dois envoyer un fichier zip, je comprends que je dois faire une enveloppe SOAP, seulement voilà, je ne pige pas grand chose.
L'enveloppe SOAP à envoyer ressemble à cela:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/env
elope/"
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</conten
tFile>

</ser:sendBill>
</soapenv:Body>
</soapenv:Envelope>

Je me suis basé sur cet exemple: http://www.example-code.com/vbdotnet/http_soap.asp

mais mon enveloppe est incorrecte, j'obtiens cela:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/env
elope/"
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</conten
tFile>

</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>

Voici mon code:

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-2004
01-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", "20100066603MODDATOS")
soapReq.NewChild2("wsse:Password", "moddatos")
soapReq.GetRoot2()
soapReq.GetParent2()
soapReq.NewChild2("ser:SendBill", "")
soapReq.FirstChild2()
soapReq.NewChild2("FileName", "20100066603-01-F001-1.zip")
soapReq.NewChild2("contentFile", "cid:20100066603-01-F001-1.zip")
soapReq.GetRoot2()

Des idées? Merci

Sous forums
  • Aide à l'achat Mac
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment