Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > SOAP XML Generation from a SOAP Object (Soap4r 1.5.4)

Reply
Thread Tools

SOAP XML Generation from a SOAP Object (Soap4r 1.5.4)

 
 
Dan Fitzpatrick
Guest
Posts: n/a
 
      07-09-2005
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:rocessor.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


 
Reply With Quote
 
 
 
 
NAKAMURA, Hiroshi
Guest
Posts: n/a
 
      07-16-2005
-----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-----


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wsdl (soap) without code generation Thomas Guettler Python 2 04-04-2008 12:13 PM
SOAP Client -getting data from SOAP::Mapping::Object? Mason Brown Ruby 1 05-23-2007 03:24 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
avoiding XML serialization, different WSDL generation, soap serialization Ramunas Urbonas ASP .Net Web Services 1 07-27-2004 09:57 PM
HTML Generation (Next Generation CGI) John W. Long Ruby 4 11-24-2003 04:24 AM



Advertisments