I'm new on OSB(Oracle Service Bus) and I need to know like 2 operations of the same WSDL can commnicate.
Let me explain, the op1 response with a name and address, then the op2 need this parameters to response more information about the customer(ID and Phone).
Then, the op1 response parameters are the op2 request parameter.
anyone know how or a good manual where it explained??
I've read some oracle manual but can not find the solution.
Thanks.
If I understand correctly, you have a Proxy based on this WSDL, and in this proxy you have two operations op1 and op2, and they have the same input parameters. Let's call this proxy "ClientProxy"
Let's start with an empty implementation of op2, that is, the request and response pipelines would be empty.
Now add a add a Service Callout action on op2. It can be in the request or response pipeline. This Service Callout has properties service = ClientProxy, invoking = op1
When you call op2 from a client or tester, you would pass the input parameters. The Service Callout action will take this parameters and send them to the op1, and put the response back in the $body
Related
I have a Lua proxy that needs to route requests. Each request destination is established based on the response from another HTTP request with a header from the initial request. My understanding is that HAProxy is an event-driven software, so blocking system calls are absolutely forbidden and my code is blocking because is doing an HTTP request.
I read about yielding after the request but I think it won't help since the HTTP request is already started. The library for doing the request is https://github.com/JakobGreen/lua-requests#simple-requests
local requests = require('requests')
core.register_fetches('http_backend', function(txn)
local dest = txn.sf:req_fhdr('X-dest')
local url = "http://127.0.0.1:8080/service";
local response = requests.get(url.."/"+dest);
local json = response.json()
return json.field
end )
How do I convert my code to be non-blocking?
You should consider using HAProxy's SPOE which was created exactly for these blocking scenarios.
I managed to do it using Lua. The thing I was making wrong was using require('requests') this is blocking. Ideally for HA never use a Lua external library. I have to deal with plain sockets and do an HTTP request and very important to use HA core method core.tcp() instead of Lua sockets.
I need some hint how to solve a problem with Spring Integration.
I have a Gateway interface.
public interface OrderGateway {
Future<Response> process(Request value);
}
I send a request message via the gateway. The ValidationService should check if the data is correct. If yes it should forward the message to the OrderService. The OderService will generate a response.
But if the request data is not correct the ValidationService should generate a response object return it to the gateway. In that case the OrderService should no be invoked. What kind of message endpoint would be the ValidationService? Would it bit a Router? I would like to a avoid handling this by throwing an exception. How to solve such a situation with Spring Integration?
+--------------------------------+
v |
Async Gateway --> CH --> ValidationService --> CH --> OrderService +
^ |
|---------------------------------------------------------------|
Thanks in advance.
The normal way to handle this would be to throw an exception and add an error-channel on the gateway; handle the error there and return the validation response from there.
If that's not suitable then, yes, a payload type router would work, with the validation result being sent to a "bridge to nowhere" (a bridge with only an input channel) and the framework will route it back to the gateway.
I have never used JUnit or other testing frameworks. All i know is how to develop rest service. I recently saw REST assured framework to test REST api. But all the articles that i found looks like below. But i don't know how to pass request xml and how will i get response and when should i call this method.?
Do i need to use some other tool before this REST assured.? I am completely beginner in this kind of testing frameworks. Please show me some light in this world. All i know is how to send request and check values in the response in SOAPUI. I have never tried this.
expect().
statusCode(200).
body(
"user.email", equalTo("test#hascode.com"),
"user.firstName", equalTo("Tim"),
"user.lastName", equalTo("Testerman"),
"user.id", equalTo("1")).
when().
get("/service/single-user/xml");
expect() /* what u expect after sending a request to REST Service */
statusCode(200) /*you are expecting 200 as statuscode which tells request handled successfully at server */
body()
/* the conditions given in body are compare the value with expected values. "equalTo" hamcrest matcher condition (you need to have hamcrest jar in java classpath).*/
when(). /* as is name says above all will be done after sending get/post/put/delete request right so before you put these get,post,put,delete you will have this method as prefix */
get("/service/single-user/xml")
/* the actual REST API request url goes here. can be GET/POST/PUT/DELETE. the confusion for you is its only showing half part which is base path.you can give entire request url in get() method.*/
more on:
http://rest-assured.googlecode.com/svn/tags/1.8.1/apidocs/com/jayway/restassured/RestAssured.html
I hope this helps.
I am working on a web-project. I have created one Http Url Connection. But for that, I have to test the code for time-out InterruptedIOException, that will execute on time-out, but even after setting time-out time as 1msec, my case is executed successfully.
How can I make delay from SOAPUI, so that I can have time-out successfull?
If you want to test how a client will react to a timeout, create a mockservice in SoapUI, and have it execute an OnRequest script prior to returning the (usually pre-determined) response. The script can be as simple as:
sleep(60000)
This would give you a 60-second delay before responding.
Select your response in the tree.
Then at the bottom in "MockResponse Properties" look for:
If you need to simulate a timeout thrown from an HTTP connectivity,
then better use the script
mockRequest.getHttpResponse().sendError(408)
This will generate an html response as well. You may set any HTTP code status you desire.
You may put it in "OnRequest Script", or in the "Script" of an existing Mock Response.
Use HTTP STatus property of Response Message set the value to 408
I have implemented a simple appmod that handle WebSockets and echo back the messages. But how do I handle an ws.close(); from the JavaScript client? I have tried with the code below, but handle_message({close, Reason}) is never called and ws.onclose = function(evt) {} is never executed on the JavaScript client.
When I use the same JavaScript client code interacting with a node.js websocket, the client receives an onclose event immediately after ws.close();.
Here is the code for my simple appmod:
-module(mywebsocket).
-export([handle_message/1]).
handle_message({text, Message}) ->
{reply, {text, <<Message/binary>>}};
handle_message({close, Reason}) ->
io:format("User closed websocket.~n", []),
{close, normal}.
Updated answer:
As of github commit 16834c, which will eventually be part of Yaws 1.93, Yaws passes a new callback to your WebSockets callback module when the client sends a close message. The callback is:
{close, Status, Reason}
where Status is either the close status sent by the client, or the numerical value 1000 (specified by RFC 6455 for a normal close) if the client didn't include a status value. Reason is a binary holding any optional reason string passed from the client; it will be an empty binary if the client sent no reason.
Your callback handler for a close message MUST return {close, CloseReason} where CloseReason is either the atom normal for a normal close (which results in the status code 1000 being returned to the client) or another legal numerical status code allowed by RFC 6455. Note that CloseReason is unrelated to any Reason value passed by the client. Technically CloseReason can also be any other Erlang term, in which case Yaws returns status 1000 and passes the term to erlang:exit/1 to exit the Erlang process handling the web socket, but based on RFC 6455 we suggest simply returning the atom normal for CloseReason in all cases.
Original answer, obsoleted by Yaws github commit 16834c:
Yaws never passes a {close, Reason} message to your callback module. Rather, {close, Reason} is a valid return value from handle_message/1 should your callback module decide it wants to close the ws socket.
I modified the websockets_example.yaws file shipped with Yaws (version 1.92) to call this._ws.close() in the client if the user enters the "bye" message on the web page, and added an alert to the _onclose function to show that the onclose event is triggered. In this case the alert occurred, I believe because the "bye" message causes the server to close the ws socket explicitly. But I then modified the example to call this._ws.close() in the client no matter what message the user enters, and in that case no alert for onclose occurred. In this case, a check with lsof showed the ws connection from the browser to Yaws was still present.
So, for now I believe you've hit a bug where the Yaws websockets support isn't detecting the client close and closing its end. I'll see if I can fix it.