Default HTTP method for outbound endpoint in MULE ESB - http

What is the default HTTP method that an outbound endpoint in MULE uses? For example, if I have the following endpoint:
<https:outbound-endpoint exchange-pattern="request-response"
address="https://api.example.com/makeCall">
Will the message be sent with a GET or POST?

Since the method property of an HTTP/HTTPS outbound endpoint is not required, there is no default property set by Mule - according to the Mule documentation.
However, this blog post suggests that the default method for an outbound endpoint, like the one in your example, is POST. Since this blog post isn't official, I can't guarantee it's reliability. Hope this helps!

Related

AWS API Gateway: Add header if response is Unauthorized

I setup an API Gateway in AWS that uses custom authorizers to implement an OAuth2 flow. It works fine. When the user is not authorized they get a 401 Authorized response. That is correct as well, but I would like to add a header that gives the client the endpoint where it can get the token. Something like AuthorizeUrl: url
How can I add this header to my response?
Unfortunately this isn't possible but it's on our backlog. I know it doesn't really make sense when the client gets a 401 but you can't tell them how to authorize.
I don't have an ETA to provide but I'll add a +1 to the feature request.
AWS added this functionality last year.
Refer to this
To do it manually:
Go to 'Response Headers' in API Gateway Console.
Choose Unauthorized (401)
Below 'Response Headers' add AuthorizeUrl and url
Save and deploy API to some stage.
To add this to Cloudformation, refer to this similar answer.
You can also add this to swagger, by adding this snippet(yaml):
x-amazon-apigateway-gateway-responses:
UNAUTHORIZED:
statusCode: 401
responseParameters:
gatewayresponse.header.AuthorizeUrl:"url"
responseTemplates:
application/json: "{\"message\":$context.error.messageString}"
In the API Gateway console go to the "Method Response" interface. You can add HTTP Status 401. In "Response Headers" add your custom "AuthorizeUrl" header. Then in the "Integration Response" interface you can add the value you'd like for that header.

Mediation sequence for DELETE method in wso2 not working

I have a SOAP web service for delete action, with endpoint URL
http://some-ip-address:my-port/bank/websrv/delcus
And can be invoked only by POST method.
I have published this API and added DELETE resource for invoking this service.
So the URL becomes
https://my-apim-endpoint/public/customer/{customer-id}
And I added mediation sequence for DELETE action. So whenever this API is invoked, it will go through the mediation sequence and send POST request to the endpoint
http://some-ip-address:my-port/bank/websrv/delcus
But when I invoke the API, the endpoint URL is getting replaced with the following URL.
Here is how the send mediator looks like,
<send>
<endpoint>
<http method="post" uri-template="http://some-ip-address:my-port/bank/websrv/delcus"/>
</endpoint>
</send>
http://some-ip-address:my-port/bank/websrv/100000023
Instead of
http://some-ip-address:my-port/bank/websrv/delcus
And giving me error response. Please anyone can help?
When you use http type endpoint, the resource path get appended to the endpoint url. for example say you have an endpoint http://test.com/path and if you have defined a /resource/{id} resource, then the request will be sent to http://test.com/path/resource/{id} kind of a url. That is the default behavior.
To call a SOAP service instead of using http type endpoint, you can use use address endpoint type. when you create endpoint with address type, you can define whether it is a soap11 or soap12. (format option in advanced options section in the implement tab). this will send a soap payload to http://test.com/path. (you do not have to build soap headers etc. only message body) .

How to post data to a soap service in mule

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

Custom HTTP method at Mule HTTP point

I use Mule as REST API <-> AMQP.
And I have to send custom Request Method: "PRINT", but I'm receiving:
Status Code: 400 Bad Request
The request could not be understood by the server due to malformed syntax.
Do you have any ideas how I can add custom HTTP method to Mule?
Unfortunately, because of this validateMessage() method here Mule rejects any method not listed here :(
I guess you need to open a bug with MuleSoft, asking for the capacity to configure extra methods, and in the meantime create a patch for the transport.

API Endpoint Semantics

Is an API endpoint the 'method', like https://api.foursquare.com/v2/venues/ or the full URL including non-query-string parameters like https://api.foursquare.com/v2/venues/5104
In other words, are these two separate endpoints or considered the same endpoint?
http://myapi.com/somemodel/1
http://myapi.com/somemodel/2
According to this Wikipedia article, the endpoint is a web service, defined by a WSDL file, and
does nothing more than define the
address or connection point to a web
service. It is typically represented
by a simple HTTP URL string.
Microsoft uses the term endpoint in various contexts, but they all amount to the same thing: the endpoint is the entire interface, not one particular method.
In the context of a REST endpoint, the endpoint would contain the requisite GET, PUT, POST and DELETE methods (as applicable).

Resources