I have a requirement , where for one particular url , i need to send email . What should be the best approach of doing this ?
a ) Create a separate flow with vm inbound and add smtp connector there , call this vm endpoint from your Rest java component .
or
b ) create a choice filter after rest component , check the url and send email if it matches with the one , else send the original response .
I can not put choice filter before rest component because some rest interceptors are invoked and set some properties first , then only i need to prepare email content based on that .
Mule version is 3.5.0
Is that URL dynamic? Did you consider using APIKit with RAML definition to expose your web service. If URL is not dynamic, then have a separate flow to handle it and generate email.
With VM approach, once message is pushed to VM or any other queue, it becomes asynchronous unless that's the behavior you want
Related
I'm just starting with Oracle Service Bus 12C.
I created a proxy service that takes in a couple of parameters. A pipeline that moves those parameters to the request-headers. A business service that calls my PHP. So far, the PHP receives the parameters correctly.
Next, I am returning a response from PHP. As a first step, I did a simple echo "Hello, World";
Two things are happening at this point.
Firstly, when debugging the app, JDeveloper shows that $body in Response Action is blank. However, in a log action, I added $body. That shows:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">Hello, World</soapenv:Body>
No idea why JDeveloper doesn't want to show this.
So, how do I get the string part from this so I can use a Insert Action to build the XML response that the proxy service would understand?
I tried these in the log action, but all of them give blank outputs:
$body/*
$body/soap-env:body
$body/soap-env:Body
$body/soap-env:Body/#value
$body/soap-env:body/#value
Edit: According to https://docs.oracle.com/cd/E13171_01/alsb/docs25/consolehelp/context.html $body/* should extract the payload without the soap-env:Body wrapper.
Got it:
$body/text()
I noticed that the tag is soap-env in the request and soapenv in the response. The $body/* works for the request to remove the wrapper in the request only.
Situation:
Using recording with Jmeter I have generated a list of api requests. The way my test object works is that when you login using UI it creates a key for the entire session (which also keeps on changing), however there is an option of having a static api key for a user that you can use for all requests when sending the api requests NOT using the UI of my software.
Problem:
I have a list of api requests that I want to test but I would like to overwrite only one variable in the header of all my api requests (i.e. adding the static api key).
Is there a way of overwriting only one variable in all (most of) the headers?
The Header Manager lets you add or override HTTP request headers.
Create a header manager at the top and enter the common value. This value will be send with all the headers.
For more information check the below link:-
https://www.blazemeter.com/blog/using-jmeters-http-header-manager
Hope this helps.
Add/Copy desired HTTP Header Manager above the Thread Group OR above Recording Controller and remove/disable all HTTP Header Manager inside request samplers, all request samplers will use the Main HTTP Header by default.
Cheers!
I am using a service fabric Rest API and i need to add some custom headers to my requests.
I am using both a stateless implementation of the service fabric.
When receiving information in the HttpMessageRequest I have the headers there containing information.
I initiate my stateless service using the following code:
// in api controller:
proxy = Proxy.ForMicroservice<IServiceInterface>();
// in the Proxy class:
public static I Create<I>(Uri serviceAddress, UserData data) where I : class, IService
{
var returnval = ServiceProxy.Create<I>(serviceAddress,listenerName:Naming.Listener<I>());
return returnval;
}
I tried the following article (from stack overflow) but it seems to be oriented on WCF. I also expected there to be a more out of the box information about this.
How can i maintain my header information which I received in the original call, or at least transfer this information to my stateless service, without using something like an wrapper Data transfer object?
You can use CallContext to set the headers . After wards,follow this sample on how to send customHeaders to service .
https://github.com/Azure-Samples/service-fabric-dotnet-getting-started/tree/master/Services/ServiceRemotingCustomHeaders/ServiceRemotingCustomHeaders
It looks like you want to do something like this Passing user and auditing information in calls to Reliable Services in Service Fabric transport. You need to set and pass your custome header information in the fabric transport call end then pick that up on the recieving (service side). CallContext can be used to convey that header information from the MethodDispather to any internal service logic without having to rely on expanding your service methods to include it as arguments.
I 'd like to know how to handle and to design the flow to consume three sequential calls type PUT with muleSoft. I 'll enter from main flow by VM Connector and I insert HTTP connector to consume PUT with data in payload. To handle the errors if the first, second and third request PUT response unsuccessful (example status code 400),Where can I handle it? Must I another flow? how can I do?
Above I have already done Flow call Request Put
Assuming that you will have the same request for all 3 outbound call that you are calling sequentially , what you can do is
just after the VM inbound save your request in a variable, then call
the first HTTP call as you are doing.
After the HTTP outbound call for first service, set the payload with your variable and call your second service using another HTTP
Same steps as step 2 you follow for your 3rd call
Regarding exception, you can check here for handling https://developer.mulesoft.com/docs/display/current/Catch+Exception+Strategy
And to control HTTP status code, if you are using Mule 3.6+ version, you can easily control HTTP status code with your http:request component as given here with Status Code Validator:- https://developer.mulesoft.com/docs/display/current/HTTP+Request+Connector
I'm using GWT to develop a web app. I'm currently using AJAX calls to retrieve values from the server. I have following queries regarding to AJAX calls:
Assume: I have an app, name of which is: "Application" and the entry point class is: "entry.java"
I know: the application could be invoked as: http://localhost:8080/Application/entry.html
1. I would like to know what what is the output URL given by gwt.getmodulebaseURL()?
Assume: In the same application I have a service called "ServerValuesService" and its corresponding Async. I have corresponding serviceImpl, which has a method called List < String >search(String) at the server side.
I could retrieve the values from the server as well. However,
2. I would like to know what would be the direct URL to access this service? For Instance, I need to obtain the list of values, by just giving a URL (passing value for the String). i.e. I need to access the method search(String) and retrieve the list just by typing a url such as:
http://localhost:8080/Application/entry/serverValuesService?string="hello"
I'm sure the above URL is wrong. I need to know exact conversion between URL and the corresponding service. Is this possible at all?
Thanks in advance!
1) In your case it will give you http://localhost:8080/Application . Application is your modulename.
2) These services are actually HttpServlets and their URL's are defined in the web.xml file. But Google uses POST method to send your variables and takes care of serialization for you, what you are trying to do is send it via GET method which is as far as I know not implemented by Google RemoteServiceServlet.So I would say no its not possible unless you extend these services to work with GET methods yourself but I don't know if that is possible.
Assume: I have an app, name of which is: "Application" and the entry point class is: "entry.java"
I know: the application could be invoked as: http://localhost:8080/Application/entry.html
The url http://localhost:8080/Application/entry.html is called host page url. In this html page you load your GWT module using a script tag:
<!-- This script tag is what actually loads the GWT module. The -->
<!-- 'nocache.js' file (also called a "selection script") is -->
<!-- produced by the GWT compiler in the module output directory -->
<!-- or generated automatically in hosted mode. -->
<script language="javascript" src="calendar/calendar.nocache.js"></script>
So if you put above example in your entry.html, the module will be loaded from http://localhost:8080/Application/calendar/calendar.nocache.js making http://localhost:8080/Application/calendar/ your module base url.
I would like to know what would be the direct URL to access this
service? For Instance, I need to obtain the list of values, by just
giving a URL (passing value for the String). i.e. I need to access the
method search(String) and retrieve the list just by typing a url
GWT RPC use a custom serialization format to encode requests to the RPC Service on server. The RPC service is implemented as a subclass of RemoteServiceServlet on the server. The RemoteServiceServlet handles the http POST requests, de-serializing the request from client and invvoking appropriate service method of sub-class.
So for directly accessing the service you'll need:
1. The service URL
2. Request payload encoded in GWT's custom serialization format
3. Ability to HTTP POST the payload to the Service URL
1 and 3 are easy to acquire. You already know the URL at which your service is mapped in web.xml. And you can do post from any http client or browser plugins like this. The hard-part would be to generate request payload in GWT's custom serialization format. For simple cases, you can generate a request from your application and capture the raw payload from Firebug, Fiddler or similar tool and simply replay it using your http client.