SOAP4r & Attachment

128 views
Skip to first unread message

nick

unread,
Apr 17, 2009, 12:42:33 PM4/17/09
to soap4r
Hi all I was wondering if somebody could explain how to send an
attachment using sopa4r.

I have a service that I communicate with (baisacaly a hermes ebxml
server) , and I'm trying to send an xml file and potentionally csv an
jpg file that are generatated by our systems to the server? How do I
attach them?

Does anyone have a complete example? Can't find anything on the wiki.


Thank yoU!!!!!!!!!!

Ömer yavuz

unread,
Apr 17, 2009, 4:09:22 PM4/17/09
to soa...@googlegroups.com
Hi,
There are samples on sources
You can use soap interfaces to send data
You can check soap client samples
You can add your simple data instead of client active data
Regards
Omer





2009/4/17 nick <nick.go...@gmail.com>

nick gorbikoff

unread,
Apr 17, 2009, 5:47:36 PM4/17/09
to soa...@googlegroups.com
Hi, Omer
Thanks for replying.
Yes I saw them. They were very helpful figuring out how to send message.
But all of the examples assume that I control the server, and/or can create a ruby server.

I 'm trying to pull info from a customer server that is an ebXML server ( serving SOAP::RPC)  the server is (Hermes 2 ebXML)


Here is a response I'm getting back (from STDERR)
My question is how do I pull that payload from a response?
All I'm getting back is <hasMessage> - true or false

All of the objects were created by wsdl2ruby

The docs for the server are very limitted and all they say is

------------------------------------------

Response Message 
  The SOAP Body of the response message has the following form. In the 
following response SOAP message, we assume that the content elements under
SOAP Body have the namespace URI http://service.ebms.edi.cecid.hku.hk/:
 
<SOAP-ENV:Body> 
<!—has this element and equal to “TRUE” only when the ebMS message  exists> 
  <hasMessage>TRUE</hasMessage>  
</SOAP-ENV:Body>
 

 If the message of the message identifier exists, the <hasMessage> element 
exists and it has the value “TRUE”.
 
  If the received ebMS message has payloads, the response message will have 
one or more SOAP attachments. Each SOAP attachment has a content type, which is 
set by the sender application.

---------------------------------------

So how do I pull that payload out?


My STDERR dump - below:


irb(main):026:0> a = obj.request(messageId)
Wire dump:

= Request

! CONNECT TO ebxml01.ajrintl.com:30055
! CONNECTION ESTABLISHED
POST /corvus/httpd/ebms/receiver HTTP/1.1
SOAPAction: "Ebmsreceiverdownload"
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.8 (httpclient.rb/269, ruby 1.8.6 (2007-09-24) [i386-mswin32])
Date: Fri, 17 Apr 2009 20:29:55 GMT
Content-Length: 320
Host: ebxml01.ajrintl.com:30055

<?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:Body>
    <messageId>20090417-1...@192.168.1.10</messageId>
  </env:Body>
</env:Envelope>

= Response

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type: multipart/related; type="text/xml"; boundary="----=_Part_100_8510092.1240000195866"
Transfer-Encoding: chunked
Date: Fri, 17 Apr 2009 20:29:55 GMT

35f
------=_Part_100_8510092.1240000195866
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><hasMessa
ge xmlns="http://service.ebms.edi.cecid.hku.hk/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:string">true</ha
sMessage></SOAP-ENV:Body></SOAP-ENV:Envelope>
------=_Part_100_8510092.1240000195866
Content-Type: application/octet-stream
Content-ID: <Payload-0>

<?xml version='1.0'?><library><name>Favorite Books</name><book isbn='0201710897'><title>The PickAxe</title><description>
Best Ruby book out there!</description><author>David Thomas, Andrew Hunt, Dave Thomas</author></book><book isbn='56'><ti
tle>Kremlin</title><description>Cool wompkas</description><author>Nick Gorbikoff</author></book></library>
------=_Part_100_8510092.1240000195866--
0

! CONNECTION CLOSED


=> "true"

2009/4/17 Ömer yavuz <omerya...@gmail.com>



--
--------------------------------------

Nick Gorbikoff
nick.go...@gmail.com

Ömer yavuz

unread,
Apr 17, 2009, 6:16:37 PM4/17/09
to soa...@googlegroups.com
Hi,

It seems you have soap request
This is text
You can use string formatting operations to solve problem.
Your data is regular
You can use Ruby string gsub commands with for/each commands
You must parse these data
That is very easy
If you check Ruby commands, you can write this parser

Regards,
Omer YAVUZ

2009/4/18 nick gorbikoff <nick.go...@gmail.com>

nick gorbikoff

unread,
Apr 17, 2009, 7:14:03 PM4/17/09
to soa...@googlegroups.com
Hi, Omer.
I guess my question is who do I grab that response ( in partucular the attachment / payload part) to process it out later .
I see it in STDERR, but how do I actually pass it out to some variable?
Reply all
Reply to author
Forward
0 new messages