# Simple "pass-thru" SOAP4R web service

**URL:** <https://www.ruby-forum.com/t/simple-pass-thru-soap4r-web-service/73232>\
**Category:** Ruby\
**Created:** [February 25, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/simple-pass-thru-soap4r-web-service/73232 "2006-02-25T18:03:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kturner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c2a13f/32.png) [@kturner](https://www.ruby-forum.com/u/kturner)\
**Post date:** [February 25, 2006, 6:03pm UTC](https://www.ruby-forum.com/t/simple-pass-thru-soap4r-web-service/73232/1 "2006-02-25T18:03:56Z")

</div>

I’m trying to write a simple “pass-thru” web service using SOAP4R. This  
web service will take the message passed and write it as XML to a file.  
I don’t want the web service to have to understand the format of the  
incoming message,just write it to a file. I also want the service to  
take the contents of an xml file and return it to the caller. I’ve  
played with the soap marshal methods, and got close but I think the  
answer is much easier than what I’ve been doing. I’m brand new to Ruby  
and would appreciate any advice.

Thanks,  
-Kevin

INBOUND SOAP MESSAGE:

\<?xml version='1.0'?\>

\<soap:Envelope xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”  
xmlns:xsd=“[XML Schema](http://www.w3.org/2001/XMLSchema)”  
xmlns:soap=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”\>  
soap:Body  
  
  
\<order\_no\>123\</order\_no\>  
\<order\_date\>20060216\</order\_date\>  
\<line\_items\>  
Sample item ONE  
Sample item TWO  
\</line\_items\>  
  
  
\</soap:Body\>  
\</soap:Envelope\>

SIMPLE WEB SERVICE:

require ‘soap/marshal’  
require ‘xmlsimple’

class Order

def postorder(request)  
# How do I take request and write to file as xml?  
puts “inspect: #{request.inspect}”

```
# Now I want the web service return message to
# be the xml from a file.
retxml = XmlSimple.xml_in('returnxml.xml')
# The following is close but not right.
# The caller gets a single string, not xml data.
XmlSimple.xml_out(retxml)

```

end

end

VALUE OF request.inspect

inspect: #\<SOAP::Mapping::Object:0x2ecdb5c {}order\_no=“123”  
{}order\_date=“20060216” {}line\_items=#\<SOAP::Mapping::Object:0x2ecd61c  
{}item=[“Sample item ONE”, “Sample item TWO”]\>\>
