httpadapter in Esper CEP implementation - http

I need to send data to a web page from esper engine using httpadapter. I followed the steps mentioned in examples. Somehow it didn't wwork. I need to send using plain java object. Also let me know how to configure web server for the request and response.

If you are sending from Web page to Web Server . Please check all your java/Event class variables are starting with small letters.
For Example : if you declare CardId : will not work .. Give null
carId : will work.
Configure web server : HttpOutputAdapter
Its all matters in URI. your web server uri and service name you invoke.
http://host:port/servicename?parameters.

Related

How to setup HTTP Basic Authentication for SOAP Client within WebSphere Liberty

We are trying to deploy an EAR on WebSphere Liberty.
Our application contains an EJB-module, which contains and EJB that makes a call to another SOAP server.
The WSDL of the service defines a wsp:Policy with ExactlyOne of http:BasicAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/
After deployment when we send a request to our application, which would trigger that SOAP-call we get an error: None of the policy alternatives can be satisfied.
I found some java-code on how to solve this
HTTPConduit http = (HTTPConduit) client.getConduit();
http.getAuthorization().setUserName("user");
http.getAuthorization().setPassword("pass");
But I do not want to do this in the Java-code but I want to make it part of the server config.
I found several helpful links, but still could not get it working.
Does anybody have any suggestions on how I can set this up?
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_wssec_migrating.html
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_sec_ws_clientcert.html
You could use the JNDI feature to express the userid and password in server.xml, then have your java code pull it out of JNDI.
https://www.ibm.com/support/knowledgecenter/en/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/twlp_dep_jndi.html

Scraping this type of site architecture possible?

I'm trying to build a web application for a customer. It implements a simple remote search on this site:
https://www.handelsregister.de/rp_web/mask.do?Typ=n
All I need to do is insert some value in the input field labeled Company or keywords, perform the search and get the HTTP response.
The problem is I am not familiar with this kind of architecture; I have always worked with APIs that have URLs, etc. Is it possible to perform the above operation automatically by programming?
Probably. You could send POST requests and parse the response. Here is a basic example in Python with the module requests :
import requests
query = "test"
post_fields = {'suchTyp':'n',
'registerArt':'',
'registerNummer':'',
'registergericht':'',
'schlagwoerter':query,
'schlagwortOptionen':2,
'ergebnisseProSeite':100,
'btnSuche':'Rechercher'}
response = requests.post("https://www.handelsregister.de/rp_web/search.do", data=post_fields)
print(response.status_code)
print(response.text)

shiro authentication against remote server given the logintoken

I have a nexus oss instance running on my laptop. What I want to do is , I will send a userlogintoken in a request sent to this nexus oss and get the userlogintoken from the nexus oss plugin and then authenticate it against teamforge(my application name) which runs in a different box.
In nexus oss they use shiro . So I too will use shiro in my nexus plugin that will do authentication against teamforge . I don't know where to start . Can I have some examples that can run standalone , which can do the task as mentioned above , so that I can start moving from there.
so requirement is basically that I need to give the server url and the userlogintoken to shiro and have to authenticate against the server url provided using that logintoken provided.
I refered a number of places searching for this kind of shiro example as I am extremely new to shiro , but I did not find examples that can do authentication given a remote server url (in my case the teamforge url).there are examples for authentication from usernames , passwords stored in ini files , or in database , but did not find examples for my use case .
Can somebody please guide me ?
Try to implement your own org.apache.shiro.realm.AuthorizingRealm you can make it configurable via Shiro.ini quite easily. You have to create public getter/setter with same name as property in ini file.
You need to implement protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) and protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) methods. They are called during currentUser.login(token).
Shiro.ini
customRealm= me.harish.shiro.realm.CustomRealm
customRealm.url = http://teamforge.com/?loginme
customRealm.apiKey = ABCD
customRealm.apiSecret = magic1
securityManager.realms= $customRealm
Some helpful links:
https://www.google.sk/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#fp=5cd33cfa2e98ac64&q=custom%20realm%20shiro
http://shiro.apache.org/realm.html

How to get executing server name or address with Selenium Server 2.20

When working with Selenium Server, it would be very useful to log the name of the machine that actually does the execution of the selenium script. Is it possible to get that information?
I am working with C# bindings, but answer in any language would do fine.
We should know where the Selenium Server is running.
This is Java Code :
we have straight method for this in HttpCommandExecutor class, getAddressOfRemoteServer()
code for Firefox :
RemoteWebDriver rcw = new RemoteWebDriver(new URL("http://serveraddress:portnumber/wd/hub"), DesiredCapabilities.firefox())
so if you have an instance of RemoteWebDriver
rcw.getCommandExecutor().getAddressOfRemoteServer()
code for IE :
Same as Above OR for Local
((HttpCommandExecutor)(new InternetExplorerDriver().getCommandExecutor())).getAddressOfRemoteServer();
Here's how to do this in Grid.
Please refer to this blog post of mine to learn how to find out the node ip and port to which the test was routed to.
Blog post : https://rationaleemotions.wordpress.com/2016/01/15/where-did-my-test-run/
In a nutshell, here's what you need to do (The blog I shared has elaborate explanation and required code )
Get the session id from webdriver via Webdriver.getSessionId()
You then append the session id obtained from the previous step to the URL http://localhost:4444/grid/api/testsession?session= (replace localhost with the actual Grid IP/host and replace 4444 with the port on which grid is listening to) and trigger a POST call.
From the JSON response you parse the value of attribute proxyId as a URL and extract out the IP and port from it.

Connect to data/service wsdl URL introspect error

Hi I am trying to add a web service in flex 4. This web service is deployed in share point 2010 in the intranet . I am able to see this wsdl file through browser but trying to introspect the service is giving an authentication error.
I am getting the following error :-
There was an error during service introspection.
WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://sql2008:47672/_vti_bin/StoryboardingDatabaseConnect.asmx?WSDL'.: java.io.IOException: Authentication failure
Edit :-
Have added the video showing the error at http://www.youtube.com/watch?v=moXfxmiHAqQ
The Data Services Wizard does not support (as of now, afaik) connection to https services, neither to ones that need authentication.
So you should add your credentials manually to your soap request's header using name-value pairs:
[{name: "userName", value: "yourUserName"},
{name: "password", value: "yourPassword"}].
You can read more about it in the Working with SOAP Headers section of this article (Using WebService components).
You might also find this post from the Adobe forums useful, elaborating this issue.

Resources