We would like to call a websphere web service from silverlight.
If I have understood it correctly:
Silverlight only supports async web service calls
Websphere does not support async calls
Is this correct?
Is it possible to call websphere web services from silverlight?
A general answer to your first question: There is no need for a webservice server to support asynchronous calls. Because HTTP is stateless, the server handles one request in one thread.
Generally speaking, the client can choose whether to wait for the response (synchronous) or to let a new thread wait for the response and do other things meanwhile (asynchronous).
The decision of doing synchronous or asynchronous calls is therefore only part of the client.
It should be possible.
Silverlight is asynchronous only in that the HTTP Web Request (GET, POST) is not linked to the receipt of the the HTTP response. You send an HTTP Request which is one action and separately from the Request you receive and handle the HTTP Response, you don't send a request then wait on the same thread for a response.
On your web server it makes no difference how you receive the request and send the response, so it could be handled synchronously or asynchronously, the Silverlight app would be oblivious to that.
Saying that 'Silverlight only supports async web service calls' only means that it does not block the calling thread while waiting for a response. The request is sent on one thread, the response is received on another thread.
Related
i have to fetch data from Rest API from flink process element in every data fetch from the stream, how can i achive that, i couldnt find enough meterials to call the Rest service asynchronously. please help me with some sample articles.
All the job is happening inside the asyncInvoke of the RichAsyncFunction. So, to be able to call REST service, You need to use some async HTTP client (technically it could be a synchronous client but this doesn't make sense). An example of async http client usage can be found here.
So, when You execute the async request all You need to do, is to call resultFuture.complete in Your request handler, so that the result is passed downstream in Flink.
In Firefox 57 you can intercept the body of http requests as well as responses (using filterResponseData). Is it possible to do the same for web sockets?
I do not think you can use the API to look at the WebSocket communication.
The webRequestAPI only applies to the WebSocket handshake, which is still normal HTTP. But once the HTTP upgrade is complete, it will no longer be observable by the API.
To quote from a related bugfix on Chrome:
Support WebSocket in WebRequest API.
This CL makes WebRequest API support intercepting the WebSocket handshake
request. Since the handshake is done by means of an HTTP upgrade request, its
flow fits into HTTP-oriented WebRequest model. Additional restriction applies,
that WS request redirects triggered by extensions are ignored.
Note that WebRequest API does not intercept:
Individual messages sent over an established WebSocket connection.
WebSocket closing connection
As Mozilla typically tries to follow the Chrome extension, I would expect that Firefox should behave the same.
I am sending outbound messages from Salesforce. They are always sending as POST, though. Is there a way to change the method they are using?
I'd like to send some of them as PUT, instead (and, eventually, some DELETE). I'm not finding anything from Google searches.
Outbound Messages are SOAP 1.1 based, and as such are required to use POST by the SOAP 1.1 spec, so there are no options to use other HTTP methods for the Outbound Message requests.
If you want to send HTTP requests instead of SOAP messages, you'll need to write an Apex trigger and use a future method to make the HTTP request from apex.
I created an App Engine backend to serve http requests for a long running process. The backend process works as expected when the query references an input of small size, but times out when the input size is large. The query parameter is the url of an App Engine BlobStore blob, which is the input data for the backend process. I thought the whole point of using App Engine backends was to avoid the timeout restricts that App Engine frontends possess. How can I avoid getting a timeout?
I call the backend like this, setting the connection timeout length to infinite:
HttpURLConnection connection = (HttpURLConnection)(new URL(url + "?" + query).openConnection());
connection.setRequestProperty("Accept-Charset", charset);
connection.setRequestMethod("GET");
connection.setConnectTimeout(0);
connection.connect();
InputStream in = connection.getInputStream();
int ch;
while ((ch = in.read()) != -1)
json = json + String.valueOf((char) ch);
System.out.println("Response Message is: " + json);
connection.disconnect();
The traceback (edited for anonymity) is:
Uncaught exception from servlet
java.net.SocketTimeoutException: Timeout while fetching URL: http://my-backend.myapp.appspot.com/somemethod?someparameter=AMIfv97IBE43y1pFaLNSKO1hAH1U4cpB45dc756FzVAyifPner8_TCJbg1pPMwMulsGnObJTgiC2I6G6CdWpSrH8TrRBO9x8BG_No26AM9LmGSkcbQZiilhC_-KGLx17mrS6QOLsUm3JFY88h8TnFNer5N6-cl0iKA
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException(URLFetchServiceImpl.java:142)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:43)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296)
at org.someorg.server.HUDXML3UploadService.doPost(SomeService.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
As you can see, I'm not getting the DeadlineExceededException, so I think something other than Google's limits is causing the timeout, and also making this a different issue from similar stackoverflow posts on the topic.
I humbly thank you for any insights.
Update 2/19/2012: I see what's going on, I think. I should be able to have the client wait indefinitely using GWT [or any other type of client-side async framework] async handler for an any client request to complete, so I don't think that is the problem. The problem is that the file upload is calling the _ah/upload App Engine system endpoint which then, once the blob is stored in the Blobstore) calls the upload service's doPost backend to process the blob. The client request to _ah/upload is what is timing out, because the backend doesn't return in a timely fashion. To make this timeout problem go away, I attempted to make the _ah_upload service itself a public backend accessible via http://backend_name.project_name.appspot.com/_ah/upload, but I don't think that google allows a system service (like _ah/upload) to be run as a backend. Now my next approach is to just have ah_upload immediately return after triggering the backend processing, and then call another service to get the original response I wanted, after processing is finished.
The solution was to start a backend process as a tasks and add that to the task queue, then returning a response to client before it waits to process the backend task (which can take a long time). If I could have assigned ah_upload to a backend, this would have also solved the problem, since the clien't async handler could wait forever for the backend to finish, but I do not think Google permits assigning System Servlets to backends. The client will now have to poll persisted backend process response data, as Paul C mentioned, since tasks can not respond like a normal servlet.
I'd like to start multiple HTTP requests rapidly after each other, without having to wait on the previous response to arrive. I've tried this using WebClient.UploadStringAsync, but this doesn't work. I'd like to efficiently implement the following scenario:
Send request 1
Send request 2
Send request 3
And in another thread:
Receive response 1
Receive response 2
Receive response 3
Can this be done in Silverlight?
I'd like to start multiple HTTP requests rapidly after each other, without having to wait on the previous response to arrive
That's called HTTP Pipelining (assuming you hope to use the same socket) and it's not supported by many proxies and gateway devices. I would be surprised if Silverlight tried to support it.
Yes it can be done. What leads you to believe that UploadStringAsync isn't working?
Here is my guess you are posting to ASP.NET with Sessions turned on (the default) right?
The requests will be queued at the server end because ASP.NET will only process one request for a specific Session at a time.