How to post data to a soap service in mule - http

I have a requirement.
I have a xml file and after transformation I need to send the payload to a soap service.
I have been using http-request for rest. But now for soap service which component should I use to send data.
I hope http-outbound is deprecated now.
Any help with example is appreciated

You could use http Request as well for sending soap request, you could use the XML to post to the Soap web service.

You could either use Web Service Consumer or Http-request + CXF.
https://docs.mulesoft.com/mule-user-guide/v/3.7/consuming-web-services-with-cxf
https://docs.mulesoft.com/mule-user-guide/v/3.6/web-service-consumer

I have used WSConsumer Component. I have read all the details from the property file And its working as intended

Related

.NET soap web service that returns JSON- how does it work?

I don't have something in particular that I need to implement, I am just trying to understand some concepts.
As far as I know, .NET web method (for example), that is inside a web service, is using the SOAP protocol. that means that the data received to the server needs to be in XML format, and the data that is returned from the web method should also be in XML format.
I know I can write something like this:
[WebMethod]
public static Object someMethod(Object josn)
{
Console.Write(json("someProperty"));
return new {name = "John"}
}
I know that data sent back to the client is in JSON format...
but if we are using the SOAP protocol, shouldn't it return XML?
I want to understand what is happening behind the scene or what am I missing, does the request was sent in xml format and the .NET framework knows how to extract the parameters that were sent, if so- how can I retrieve the full xml that represents the request made?
What you are referring to is called the SOAP envelope. Take a look here:
Sample SOAP Envelope
One of the easiest ways to see the SOAP envelope that is being used in a request or response is to use Fiddler or Postman.
EDIT
Here's an example of WCF SOAP envelope with JSON (not sure if you are using WCF or the old .NET Web Service with ASMX files):
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header></s:Header>
<s:Body>[{"DateOfBirth":"\/Date(286801200000+1300)\/","FirstName":"Foo","Id":1,"LastName":"Bar"},{"DateOfBirth":"\/Date(333720000000+1200)\/","FirstName":"Foo","Id":1,"LastName":"Bar"}]</s:Body>
</s:Envelope>

XI52 IBM Websphere DataPower

I have a service like this
MPGW <===> WSP <===> Backend
On the response, I have an attachment which I was expecting the type to be 'XOP' but instead I'm getting 'MIME' . Is there any way I can over ride to XOP?
FYI...when I hit the service directly the back-end (by passing datapower), I'm getting XOP attachment type.
Processing MTOM with SOAP 1.1 is not supported in DataPower so make sure you are using SOAP 1.2.
You need to check if it is the WSP (likely) or the MPGW that is changing the response. This you can do using the Probe.
You can handle the attachments in a MTOM Policy for the service. Also use pass-through if possible for the MPGW to make sure it is not changing the payload.

ASP.NET WebAPI return headers before receiving request body

I have a scenario where I need to send some headers to the client before receiving the request body.
It would be like using the 100-continue, but I could not figure out how to do this with ASP.NET WebAPI.
Is there a way using the native tools and IIS hosting?
Please use http method “HEAD”.
Please see https://www.rfc-editor.org/rfc/rfc2616#section-9.4

(REST ) Client - set the javax.servlet.http.HttpServletRequest into request How to?

A lot of web applications must be used the specified REST service. This REST service uses currently the informations only from javax.servlet.http.HttpServletRequest. This HttpServletRequest may be contain the specific cookie and other parameters.
I'm try to use the (REST) client API form JERSEY to realize a client, that will build the REST requests. This client will be called within custom web filter, that will be registered by web.xml of each web application.
Currently i have the following problem: i'm don't know, howto transmitt the HttpServletRequest during call of the REST Service....
Thx for your help....
So if I understand correctly, you want receive a request in any of the web applications, and then you want to forward this request to the REST web service?
If so, you will need to serialize the request to make it transportable. You could also create a class that is able to hold the data that you need from the javax.servlet.http.HttpServletRequest and then serialize it into XML or JSON.
If you have the request in a more transportable format, you can pass it to your REST service via a #HeaderParam or as the request body (I would prefer the latter).

SOAP and HTTP Post

I have an ASP.NET web service running that accepts both HTTP POST and SOAP requests. Are there any disadvantages to using a simple HTTP POST to get the data from the WS instead of using SOAP over HTTP?
I can't think of anything else other than the support for transmission of complex data types, and I don't think I'll need that in this project.
Thanks,
Teja.
The clue is in the question...
using a simple HTTP POST to get the data
A POST is not a GET, a GET is a GET.
If you're the only person operating on the WS then it's not a problem as long as you are handling your incoming connections properly. If it is open to outsiders then I would recommend sticking to conventions, they are there to save us from ourselves :)

Resources