Successfully calling a WCF Service from Ruby? Anyone? - ruby

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'.

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.

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...

I was running into the same issue with Savon with my WCF web service. The content error is because your service is expecting SOAP 1.2, but by default Savon sends the request as SOAP 1.1.
The Content-Type value for 1.1 is 'text/xml;charset=UTF-8', but if the server is configured for 1.2 (which is what wsHttpBinding is), the Content-Type must be 'application/soap+xml; charset=utf-8'.
I found this method on the Savon website:
response = client.request :get_user do
soap.version = 2
end

Related

Spring RestTemplate 404 error for large POST request to .NET Core REST api

I am trying to make a Java (Spring) application which invokes a REST api in a .NET Core application. Everything seems to work in the general case, but now that I am making a POST with an XML string which takes up 80 megabytes on my system, the RestTemplate produces a 404 error code saying "Not found". I have tried to remove the POST size limit in both the .NET Core application (by using the DisableRequestSizeLimit attribute in the API controller) and in the Spring configuration (by setting the variable spring.servlet.multipart.max-request-size to 200MB in application.properties). Neither of it seems to work. Is there some way to fix this? I am willing to use an alternative to the RestTemplate, if that would make sense. I am using the exchange method of the RestTemplate object.
Not found is a general error, if the problem would be sending the request, other problem will happens. I highly recommend you to test the rest api with another tool, like Postman or Insomnia. After that works with the tool try with your client application.
Clarification:
spring.servlet.multipart.max-request-size is for api in your Spring application, no for requesting another services.
Due to Milton BO's answer, I made a request in POSTMAN, which gave me a more detailed error response from the ASP.NET Core app. And it told me to change the maximum allowed post size in the web.config (or appplicationhost.config) file for IIS Express. Furthermore, I am now using the Kestrel server instead of IIS Express, so the DisableRequestSizeLimit attribute now works as expected.

Mockable.io - mock not found for all SOAP mocks

I am making my way through the book "Implementing Oracle Integration Cloud Service" and a few chapters use Mockable.io to mock calls. Unfortunately, I haven't been able to get a single SOAP Mock to work. No matter what I try I get "Mock not found." This happens in the browser, if I try to call the mock as an endpoint in SOAPUI and Oracle ICS also returns a "404 not found" when I call the integration that I have the mock wired to and all of the online SOAP clients I've tried return the same result. I have seen other posts that claim Mockable.io works fine for REST mocks, but at least one person could not get any SOAP Mocks to work. Either I'm missing something very basic (likely) or Mockable.io doesn't work consistently with SOAP mocks. Has anyone had success using Mockable.io for SOAP mocks? I am calling the mock with the URL: http://demoXXXXXXX.mockable.io/FlightStatusUpdate (the Xs obscure the demo ID, I am not testing it with Xs, just to be clear). I have not found any resources for Mockable.io online apart from REST resources, I sent them a message and posted on their issues site. I hope the product is still being developed. Any information or guidance would be appreciated! Thank you!

no SOAPAction header! in Oracle service bus

I am facing below error in respose,
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
i am trying to fixing in pipeline ,
selected pass all headers through pipeline but didn’t helpedenter image description here
Do you really need a SoapAction?
One of the options available in a proxy is to decide which operation a SOAP message is, by inspecting the message body.
If someone sends a message (perhaps through a biz ref) and doesn't include a SOAP action header, a proxy will still recover if it uses this method.

POST call in Mulesoft

I am trying to make a HTTPS POST call in mulesoft to an external API. I had read in the mulesoft documentation and also in other posts that in order to send the request body, a map has to be prepared.
Hence, i am using the "Set-Payload" to prepare a map.
Eg: #[{'key':'value'}]
When I am using the logger to display it, it prints a map (as expected).
But when the POST call is being made, i am receiving the following error:
Response code 503 mapped as failure. Message payload is of type: BufferInputStream
Payload : org.glassfish.grizzly.utils.BufferInputStream#3f8f77a
Could anyone let me know where am i going wrong?
Thanks in Advance.
The server you're trying to call is returning status 503. Have you tried calling the external API using other client SOAP/Postman/Curl?
Also check this out:
http://forums.mulesoft.com/questions/2009/consume-get-restful-service.html
You should set proper mimetype for muleMessage and set the http POST method, then it should work.
While posting the data male sure how your http is expecting the input. What ever the transformations you want to make before posting do it, finally when posting the data to http cross check your data type with the data in the server your are trying to send. Both needs to match. Then it work.
I generally try to Isolate HTTP interaction problems into two parts. One is related to request itself for e.g. URL,Method,Headers,Payload,MimeType and other should be related to transport and network interaction with Server itself. To better view the information for both of the above details use a htt[ proxy/debugger [for. e.g. Fiddler] around the traffic flowing while you make a request. This will throw more light on the stuff hindering you while making this call successfully.
You can try any of the below sugestions-:
Set payload as map, mention MIME Type as application/json and then use json to object transformer (with return class as java.util.HashMap).
Set payload as simple string. This could help.
Status code 503 implies that the server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay.
Please try resending the message or hit the API with Postman.
It looks like you need to change the port in the request-config to 443 since you're using HTTPS.
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="jiratst.murex.com" port="443" doc:name="HTTP Request Configuration" basePath="/rest/api/2/project">
try using input {'key':'value'} in set payload instead of Array.

OSB - Split-Join calling secured web service

I create a new Split-Join (in the OSB workshop application). Then
I use an action "Invoke Service" to call a not secured business service. So far no problem. When I assign a security policy to my business service, the OSB does not accept. Here is the error message in the OSB workshop:
[Parallel, Scope, Invoke Service]
The WSDL Binding for BusinessService "OSB/1_0/BusinessServices/TestBS" is not supported: The service feature "WS-Security" is not supported.
How can I call a secured business service in a splitJoin?
Thanks
I'll put a little more expanded version of the correct answer of user2364825.
Split-Join is actually a "window" into an older product (that's why it looks and behave differently from OSB). That product has some limitation, including inability to work with WS_POLICY.
There are two commonly used workarounds for that.
Approach #1. Make a version of the same WSDL stripped of WS_POLICY and use it in the Split-Join. From the Split-Join, call the intermediate proxy with that stripped WSDL which in turn calls a business service with the original WSDL.
BizService(Stripped WSDL)->Split-Join->Proxy2(Stripped WSDL)->BizService(Real WSDL)
That approach only works if the WS_POLICY headers are created by OSB code.
If the message going via Split-Join already has some SOAP Headers (including Policies), those are going to be lost, and the approach #1 is not working.
Approach #2. Make a custom WSDL which wraps the original message with all its SOAP Headers and whatnot. Use that WSDL for Split-Join, pass the wrapped message to an unwrapping proxy, and then call the real proxy/biz.
BizService(Wrapper WSDL)->Split-Join->Proxy2(Wrapper WSDL)->BizService(Real WSDL)
The second approach is more complex, but also more powerful. For instance, it easily can be extended to support user headers (Split-Join doesn't support them too), passing debug information and pretty much anything else.
This approach is implemented in my GenericParallel service which does all above and some more.
I also have a blog post outlining passing the SOAP Headers via Split-Join in a bit more details. (The WS_Policy is just a SOAP Header after all).
YOu can never a call a WSDL based proxy/Business Service that has WS_POLICY defined in the WSDL. You need to have a intermediate business/proxy to pass the message to the WS-policy containg WSDL service.

Resources