views:

172

answers:

2

I'm trying to integrate a rails application with a WCF service. I've tried soap4r and Savon with no love at all. As far as I can tell, none of the Ruby libraries support the newest version of SOAP.

The error that I was getting was:

Cannot process the message because the content type 'text/xml;charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.'application/soap+xml; charset=utf-8'.

I managed to beat this error by changing the WCF service binding from wsHttpBinding to basicHttpBinding, but then received the new error:

The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). (SOAP::FaultError)

Now, this error leaves me baffled because I don't see any way to configure endpoints in any of the Ruby libraries. Does anyone know?

Has anyone successfully called WCF services from Ruby?'application/soap+xml; charset=utf-8'.

A: 

Hi, this may not be what you want t hear but I've recently been interacting with SOAP in Ruby.... It's not fun at all, none of the gems available are complete, stable or well documented and all seem to fall down when you add a tiny bit of complexity (passing an object containing some values instead of just passing a integer or string).

I ended up sniffing the request made by a .net client, then building objects that have a .to_xml method, taking a XML Builder object and adding it's own stuff..

That takes care of the request and then each service request method is custom made to extract the information needed for the result.

Very manual way to do it, and have to add more for every method i need to use but at least it works!

Some other guys I work with had success using JRuby and Axis. I stayed away from this as I wanted a pure Ruby solution.

Sorry I couldn't be of more help.. if you'd like I'll post my code to build the soap request...

clocKwize
Did Savon not work for you? What were the issues that Savon had?
Steve Weet
@Steve Weet: I attempted to use it, it kept throwing exceptions in the Savon code. Can't remember exactly the problem, but couldn't work out what I was doing wrong from the docs, or a search online so I gave up. Btw - I live in Rainham
clocKwize
@clocKwize. I've had some success with Savon but SOAP with Ruby is not a happy experience. Ever since ActionWebService was dropped from Rails Core no-one seems interested in SOAP. It's a shame if you live in a corporate world where you have to support SOAP. Nice to know I'm not the only Rubyist in Medway.
Steve Weet
Thanks so much for the responses. That is what I was beginning to gather from my attempted use of Ruby's SOAP libraries also. On the other hand, the generated drivers from soap4r seemed to have proper object support, so I thought I must just be missing something. If it's not too much effort, seeing the code you used to hand-generate the requests would be quite helpful.@Steve Weet Have you worked with Savon at all with WCF services? If so, is there any documentation on it that you found helpful?Thanks again.
Sharon
A: 

Please note that I got this working...after I changed the web.config for the service to basicHttpBinding, Savon is able to send and receive messages. It is only soap4r that is unable to still and throws the Action '' error.

Sharon