login about faq

Hello everyone, I call a webservice to send a zip file and I need to send a soap envelope, as I ignore how to make an envelope, I used this code. The envelope i've to generate looks like this one:

<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>

I've tried to generate it like this:

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", "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()

but it's a fail. How shall I proceed? Thanks

asked May 29 '14 at 18:05

romulus001's gravatar image

romulus001
16113

edited May 30 '14 at 09:03


This call sequence makes no sense:

    soapReq.GetRoot2()
    soapReq.GetParent2()
Once you've moved to the root node in the XML document, it has no parent (because it's the root) and therefore the call to GetParent2 does nothing.

It seems you were trying to navigate to the "soapenv:Body" node, so that the code that follows can construct that part of the document. To navigate to "soapenv::Body", you would:

    soapReq.GetRoot2()
    soapReq.FindChild2("soapenv::Body")

link

answered Jun 06 '14 at 08:07

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×11
×5

Asked: May 29 '14 at 18:05

Seen: 1,729 times

Last updated: Jun 06 '14 at 08:07

powered by OSQA