Hi,

> From: "John Didion" <john / didion.net>
> Sent: Friday, March 26, 2004 12:55 PM

> I ran this code[1] and got these results[2]. As you can see, the resuting
> xml is very different from the original. Is there anything I can do to make
> the result look like the original?

> require 'soap/processor'
>
> str = <<SOAP
> <soap:Envelope
>   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>   xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
>   xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
>   <soap:Header>
>     <wsse:Security>
>       <wsse:UsernameToken>
>         <wsse:Username>USERNAME</wsse:Username>
>         <wsse:Password
> Type="wsse:PasswordDigest">PASSWORDDIGEST</wsse:Password>
>         <wsse:Nonce>NONCE</wsse:Nonce>
>         <wsu:Created>2003-09-08T05:52:36Z</wsu:Created>
>       </wsse:UsernameToken>
>     </wsse:Security>
>   </soap:Header>
>   <soap:Body>
>     <DELETE xmlns="http://schemas.xmlsoap.org/wsdl/http/"/>
>   </soap:Body>
> </soap:Envelope>
> SOAP
>
> env = SOAP::Processor.unmarshal(str)
> puts SOAP::Processor.marshal(env)

CVS version of soap4r can handle SOAPHeader better.

Result of your code[1].

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
      <n1:Security xmlns:n1="http://schemas.xmlsoap.org/ws/2002/07/secext">
        <n1:UsernameToken>
          <n1:Username>USERNAME</n1:Username>
          <n1:Password>PASSWORDDIGEST</n1:Password>
          <n1:Nonce>NONCE</n1:Nonce>
          <n2:Created
xmlns:n2="http://schemas.xmlsoap.org/ws/2002/07/utility">2003-09-08T05:52:36Z</n2:Created></n1:UsernameToken></n1:Security>
  </env:Header>
  <env:Body>
    <n3:DELETE xmlns:n3="http://schemas.xmlsoap.org/wsdl/http/"
        xsi:type="n3:DELETE"
        env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    </n3:DELETE>
  </env:Body>
</env:Envelope>

If you don't want "xsi:type..." in SOAP Body, try

  puts SOAP::Processor.marshal(env, {:generate_explicit_type => false})

Body must be;

  <env:Body>
    <n3:DELETE xmlns:n3="http://schemas.xmlsoap.org/wsdl/http/">
    </n3:DELETE>
  </env:Body>

You can get the CVS version from
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/lib/soap4r/

Regards,
// NaHi