SOAP XML Generation from a SOAP Object (Soap4r 1.5.4)

Discussion in 'Ruby' started by Dan Fitzpatrick, Jul 9, 2005.

  1. I am trying to create a soap xml string but am having only partial
    success. Marshall.marshall works great but creating the XML string from
    a SOAP object is not working for me.

    Example A at http://dev.ctor.org/soap4r/wiki/WhichAPIshouldIuse is what
    I would like to do. However there are multiple errors. Any assistance in
    getting this example to work, or something similar is appreciated.

    require 'soap/processor'

    headerItem = SOAP::SOAPHeaderItem.new(
    SOAP::SOAPElement.new( 'urn:ns', 'headerItem', 'text1' )
    # The 3rd element is no longer valid for #new
    )
    header = SOAP::SOAPHeader.new
    header.add( headerItem )
    # 2 arguments are required for #add
    bodyItem = SOAP::SOAPStruct.new( 'MyCustomClass' )
    bodyItem.name = 'anObject'
    # No longer a #name method in SOAP::SOAPStruct
    bodyItem.add( 'str', SOAP::SOAPString.new( 'SOAP4R' ))
    bodyItem.add( 'int', SOAP::SOAPInt.new( 1234 ))
    bodyItem.add( 'dateTime', SOAP::SOAPDateTime.new( DateTime.now ))
    body = SOAP::SOAPBody.new( bodyItem )
    str = SOAP::processor.marshal( header, body )
    # Returns the following error:
    # XSD::NS::FormatError: namespace:
    # http://schemas.xmlsoap.org/soap/envelope/ not defined yet
    # from /usr/local/lib/ruby/1.8/xsd/ns.rb:77:in `name'
    # from /usr/local/lib/ruby/1.8/soap/element.rb:189:in `encode'
    # from /usr/local/lib/ruby/1.8/soap/generator.rb:127:in `encode_element'
    # from /usr/local/lib/ruby/1.8/soap/generator.rb:65:in `encode_data'
    # from /usr/local/lib/ruby/1.8/soap/generator.rb:53:in `generate'
    # from /usr/local/lib/ruby/1.8/soap/processor.rb:30:in `marshal'

    puts str
     
    Dan Fitzpatrick, Jul 9, 2005
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    This is a duplicate response of a mail in soap4r ML.

    Dan Fitzpatrick wrote:
    > I am trying to create a soap xml string but am having only partial
    > success. Marshall.marshall works great but creating the XML string from
    > a SOAP object is not working for me.
    >
    > Example A at http://dev.ctor.org/soap4r/wiki/WhichAPIshouldIuse is what
    > I would like to do. However there are multiple errors. Any assistance in
    > getting this example to work, or something similar is appreciated.


    Sorry for the old examples. I updated the page. Please check the page
    again.
    http://dev.ctor.org/soap4r/wiki/WhichAPIshouldIuse

    Regards,
    // NaHi
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.0 (Cygwin)

    iD8DBQFC2QUSf6b33ts2dPkRAooRAJ4lAwFUoXJValkKHGSdS/5Hb7t1CQCgr2Pq
    54DTHeN7As66SrXFOieLMs0=
    =PfL+
    -----END PGP SIGNATURE-----
     
    NAKAMURA, Hiroshi, Jul 16, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephane Wirtel
    Replies:
    0
    Views:
    113
    Stephane Wirtel
    Mar 13, 2006
  2. Replies:
    0
    Views:
    130
  3. Rickard Sjostrom

    SOAP4R and Perl::SOAP::Lite interoperability

    Rickard Sjostrom, Sep 6, 2006, in forum: Ruby
    Replies:
    0
    Views:
    108
    Rickard Sjostrom
    Sep 6, 2006
  4. snacktime
    Replies:
    4
    Views:
    170
    gregarican
    Nov 20, 2006
  5. Henning Panke
    Replies:
    0
    Views:
    154
    Henning Panke
    Jun 22, 2007
Loading...

Share This Page