I am currently working on requirement to migrate our 3g code to 4g, How can we attach TargetEndpointOperationRef to service callout in 4G. Can you please explain with an example?
< sci:ServiceCallout name="sample" continueOnError="false">
< sci:EndpointRef inheritAllFlowVariables="true" inheritAllHeaders="true" inheritQueryParams="true">
< sci:TargetEndpointRef> InterceptTarget < /sci:TargetEndpointRef>
< sci:TargetEndpointOperationRef> my_info < /sci:TargetEndpointOperationRef>
< /sci:EndpointRef>
< sci:Request>
< sci:Payload ref="tmpMessage"/>
< sci:Assign sourceval="GET" type="verb"/>
< sci:Assign sourceval="application/vnd.vmware.admin.vdc+xml" targetval="Accept"type="header"/>
< /sci:Request>
< /sci:ServiceCallout>
Thanks
As of now there is no direct way to call the Target Endpoint directly from a service callout
On an additional note. When you have a situation like this which requires a Target Url to be referred from ServiceCallout and otherwise. It will be better to use the Concept of Target Servers. This way you don't have to maintain the backend url at multiple places in Service Callout Policies/Target.xml files but can be created as Environment level resource and used across.
Eg
1. Create a Target server using management APIs
http://apigee.com/docs/api/api_methods/232-create-a-targetserver
2. Refer it in Service callout
<ServiceCallout name="service_callout_backend">
<HTTPTargetConnection>
<Properties/>
<HealthMonitor>
<IsEnabled>true</IsEnabled>
<IntervalInSec>30</IntervalInSec>
<TCPMonitor>
<ConnectTimeoutInSec>60</ConnectTimeoutInSec>
<Port>443</Port>
</TCPMonitor>
</HealthMonitor>
<LoadBalancer>
<Algorithm>RoundRobin</Algorithm>
<RetryEnabled>true</RetryEnabled>
<MaxFailures>10</MaxFailures>
<Server name="server1">
<IsEnabled>true</IsEnabled>
</Server>
<Server name="server2">
<IsEnabled>true</IsEnabled>
</Server>
</LoadBalancer>
<Path>/v1/backend1?token={access_token}</Path>
</HTTPTargetConnection>
<Request clearPayload="false" variable="request"/>
<Response>response</Response>
</ServiceCallout>
3. Refer in Proxy target server xml also similarly
Related
As the title says. I have some EJBs in an EAR and I have a client jar providing remote methods to a JSF app also sitting in liberty (different server/machine). The client jar tries to access the remote EJBs via lookup.
This is breaking my heart for two days now. As the title says...
I am aware of other stackoverflow questions from the past and I am aware of the following resources:
https://www.ibm.com/docs/en/was-liberty/core?topic=liberty-using-enterprise-javabeans-remote-interfaces
https://github.com/OpenLiberty/open-liberty/blob/release/dev/com.ibm.ws.ejbcontainer.remote_fat/test-applications/RemoteClientWeb.war/src/com/ibm/ws/ejbcontainer/remote/client/web/RemoteTxAttrServlet.java
I have tried every combination provided in the above but no joy.
I use (wlp-javaee8.21.0.0.8) with javaee8 feature enabled, this enables everything else I need e.g. ejb-3.2, ejbRemote-3.2, jndi-1.0 and a few others)
I have an EAR my-ear that contains a module my-module-1.0.4-SNAPSHOT.jar which contains my beans. I am using gradle/liberty plugin and IntelliJ.
I am using tests from within IntelliJ in the client jar module to try to access the remote beans.
My myEAR deploys fine and starts up fine and the app shows running in admincenter. In messages.log I see my EJB bindings. Just picking one example.
[16/08/21 10:58:42:384 IST] 00000022
com.ibm.ws.ejbcontainer.osgi.internal.NameSpaceBinderImpl I
CNTR0167I: The server is binding the
my.org.functiona.ejb.advance.MyAdvance interface of the MyAdvanceBean
enterprise bean in the my-module-1.0.4-SNAPSHOT.jar module of the
my-ear application. The binding location is:
ejb/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvanceBean#my.org.functiona.ejb.advance.MyAdvance
[16/08/21 10:58:42:385 IST] 00000022
com.ibm.ws.ejbcontainer.osgi.internal.NameSpaceBinderImpl I
CNTR0167I: The server is binding the
my.org.functiona.ejb.advance.MyAdvance interface of the MyAdvanceBean
enterprise bean in the my-module-1.0.4-SNAPSHOT.jar module of the
my-ear application. The binding location is:
my.org.functiona.ejb.advance.MyAdvance [16/08/21 10:58:42:385 IST]
00000022 com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime
I CNTR0167I: The server is binding the
my.org.functiona.ejb.advance.MyAdvance interface of the MyAdvanceBean
enterprise bean in the my-module-1.0.4-SNAPSHOT.jar module of the
my-ear application. The binding location is:
java:global/my-ws-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvanceBean!my.org.functiona.ejb.advance.MyAdvance
This is my corresponding interface:
package my.org.functiona.ejb.advance;
import javax.ejb.Remote;
#Remote
public interface MyAdvance {
This is my corresponding implementation:
package my.org.functiona.ejb.advance;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
#Stateless(mappedName = "MyAdvance")
#TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class MyAdvanceBean implements MyAdvance {
Like I said, its breaking my heart. I tried every combination of provided in the (patchy) documentation and other sources. The most progress I made was by accessing "corbaname::localhost:2809/NameService" through a default InitialContext().lookup. So at least I was able to confirm I can gwet through to the NameService. But any subsequent bean lookup using that context with any combination of the names provided in messages.log or in the code snippets from documentation all fail with the exception below.
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
Same for InitialContext() lookups where I prefix the names with "corbaname::localhost:2809/NameService#".
I tried
ejb/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvanceBean#my.org.functiona.ejb.advance.MyAdvance
ejb/global/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvanceBean#my.org.functiona.ejb.advance.MyAdvance
ejb/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvance#my.org.functiona.ejb.advance.MyAdvance
ejb/global/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvance#my.org.functiona.ejb.advance.MyAdvance
java:global/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvance#my.org.functiona.ejb.advance.MyAdvance
java:global/my-ear/my-module-1.0.4-SNAPSHOT.jar/MyAdvanceBean#my.org.functiona.ejb.advance.MyAdvance
my.org.functiona.ejb.advance.MyAdvance
and probably a few others
I replaced the # sign with an exclamation mark in all of the above. And went through it again.
I tried corbaloc:: and corbaloc:iiop: for context. Nothing.
I am no web dev expert but this feels very try and error and I dont feel it should be like that. I understand in websphere proper I could identify the names in the admin console but then I'm not even certain websphere proper and liberty behave the same way.
Sine accessing EJBs from remote seems bread & butter stuff I assume I am overlooking something basic and silly due to my inexperience.
Any pointers anyone? Thank you so much for your time reading this.
Carsten
Edit: server.xml
<server description="disbCoreServer">
<featureManager>
<feature>javaee-8.0</feature>
<feature>adminCenter-1.0</feature>
<feature>websocket-1.1</feature>
</featureManager>
<quickStartSecurity userName="admin" userPassword="carsten" />
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
host="${hostname}"
httpPort="${default.http.port}"
httpsPort="${default.https.port}">
<accessLogging filepath="${com.ibm.ws.logging.log.directory}/accessLog.log" logFormat='%h %i %u %t "%r" %s %b %{R}W' />
<tcpOptions soReuseAddr="true" />
</httpEndpoint>
<include location="appConfXML/disb_core_jndi.xml"/>
<include location="appConfXML/disb_core_jdbc.xml"/>
<include location="appConfXML/disb_core_jms.xml"/>
<include location="appConfXML/disb_core_mail.xml"/>
</server>
The example provided through the FAT test (remoteLookup) works just fine. I just didnt have all my ducks in a row.
https://github.com/OpenLiberty/open-liberty/blob/release/dev/com.ibm.ws.ejbcontainer.remote_fat/test-applications/RemoteClientWeb.war/src/com/ibm/ws/ejbcontainer/remote/client/web/RemoteTxAttrServlet.java
My scenario is serverA hosting EJBs and serverB running the remote client calling serverA's EJBs.
Steps on serverB are:
Get (local) InitialContext with no properties: InitialContext initialContext = new InitialContext();
With the above lookup the remote Context: Context remoteContext = (Context) initialContext.lookup("corbaname::remotehost:remotePort/NameService");
With the remoteContext lookup the EJB remote interfaces and 'narrow' and cast them to appropriate type
String lookupName = "ejb/global" + "/" + "MyAppName" + "/" + "MyModuleName" + "/" + jndiName;
Object remoteObj = remoteContext.lookup(lookupName);
return interfaceClass.cast(PortableRemoteObject.narrow(remoteObj, interfaceClass));
Where
"MyAppName" is my apps name, the name of the EAR in my case (without .jar)
"MyModuleName" is the name of the EJB module within my EAR (without .jar)
and jndiName is the bean name / fully qualified interface name separated by exclamation mark e.g. "MyBean!myorg.ejb.interfaces.MyBeanIfc"
Call the interfaces to remotely execute serverA EJB code
Note: When running serverA and serverB on the same machine (e.g. localhost) ensure they are not operating on the same port for NameService.
Thanks to everyone who tried to help!
I am trying to use the NCache Open Source. I already installed it in my local machine. I already edited the config.ncconf file as instructed. Already restarted the service by using Restart-Service command.
<cache-config cache-name="myreplicatedcache">
<cache-settings inproc="False">
<logging enable-logs="True" trace-errors="True" trace-debug="False" log-path=""/>
<performance-counters enable-counters="True" snmp-port="0"/>
<cache-notifications item-remove="False" item-add="False" item-update="False"/>
<cleanup interval="15sec"/>
<storage type="heap" cache-size="1024mb"/>
<eviction-policy default-priority="normal" eviction-ratio="5%"/>
<cache-topology topology="replicated">
<cluster-settings operation-timeout="60sec"
stats-repl-interval="600sec" use-heart-beat="False">
<cluster-connection-settings port-range="1" connection-retries="2"
connection-retry-interval="10secs" cluster-port="7804"/>
</cluster-settings>
</cache-topology>
<client-death-detection enable="False" grace-interval="60sec"/>
</cache-settings>
<cache-deployment>
<servers>
<server-node ip="192.168.0.101"/>
</servers>
</cache-deployment>
</cache-config>
Still, I cannot start the new cache that I registered. I encountered - "Specified cache is not registered". I am not sure why it's happening for I am sure it is registered. Here is what it looks like:
Are the ports open and allows traffic? You can try by shutting down the windows firewall and if that works, define rules to allow traffic.
also you can try with partitioned cache configuration
<cache-config cache-name="myPartitionedCache" alias="" config-id="44fb997a-f6a7-433b-9439-7ef9de9f47c7" config-version="0">
<cache-settings inproc="False">
<logging enable-logs="True" trace-errors="True" trace-debug="False" log-path=""/>
<performance-counters enable-counters="True" snmp-port="0"/>
<cache-notifications item-remove="False" item-add="False" item-update="False"/>
<cleanup interval="15sec"/>
<storage type="heap" cache-size="1024mb"/>
<eviction-policy default-priority="normal" eviction-ratio="5%"/>
<cache-topology topology="partitioned">
<cluster-settings operation-timeout="60sec" stats-repl-interval="60sec" use-heart-beat="False">
<cluster-connection-settings port-range="1" connection-retries="2" connection-retry-interval="2secs" cluster-port="7801"/>
</cluster-settings>
</cache-topology>
<client-death-detection enable="False" grace-interval="60sec"/>
</cache-settings>
<cache-deployment>
<servers>
<server-node ip="yourIPHere"/>
</servers>
</cache-deployment>
</cache-config>
I can’t figure out what the basic initial/minimal setup of Fuseki is if I want something like Bob DuCharme in his Learning SPARQL book. He uses old release of Fuseki (0.2.6) and starts it in a very trivial way (with no additional configuration):
fuseki-server --update --loc=dataDir /myDataset
With only this he has a fully functional SPARQL endpoint with a default graph. However, neither with Fuseki 1 nor Fuseki 2 I am able to do this. With Fuseki 2 the server runs immediately but the UI does not react—I can’t upload or edit, it shows no datasets (I would expect it should list /myDataset at least!). It works only like a purely static page with no functionality on the background.
The console log looks like everything works:
fuseki-server --update --loc=dataDir /myDataset
[2015-11-11 09:05:05] Server INFO Fuseki 2.3.0 2015-07-25T17:11:28+0000
[2015-11-11 09:05:05] Config INFO FUSEKI_HOME=/home/honza/.apache-jena-fuseki-2.3.0
[2015-11-11 09:05:05] Config INFO FUSEKI_BASE=/home/honza/karolinum/run
[2015-11-11 09:05:05] Servlet INFO Initializing Shiro environment
[2015-11-11 09:05:05] Config INFO Shiro file: file:///home/honza/karolinum/run/shiro.ini
[2015-11-11 09:05:05] Config INFO Template file: templates/config-tdb-dir
[2015-11-11 09:05:05] Config INFO TDB dataset: directory=dataDir
[2015-11-11 09:05:10] Config INFO Register: /myDataset
[2015-11-11 09:05:10] Server INFO Started 2015/11/11 09:05:10 CET on port 3030
Got it. The solution is it is necessary to change security settings in run/shiro.ini file, like this:
[users]
username=password
[urls]
## Control functions open to anyone
/$/status = anon
/$/ping = anon
/$/** = authcBasic,user[username]
# Everything else
/**=anon
I'm trying to setup a multi-NIC cluster with Cloudera5. Each node has an ethernet interface (eth1 - 172.17.2.x) plus an infiniband interface (ib0 - 192.168.69.x).
The problem is, the cluster communicates the infiniband addresses to the "outside world" when using HDFS.
I found out that the right parameter to get such a configuration working is "dfs.datanode.dns.interface" and that it has to be set to "eth1".
However, this parameter is not present in the Cloudera Manager interface. As it automatically overwrites the hdfs-site.xml file, I can't go to write it in the file.
I tried to use the Cloudera manager "Safety Valves" (Configuration > Service-Wide > Advanced > HDFS Service Advanced Configuration Snippet (Safety Valve) for hdfs-site.xml), and set it to
<property>
<name>dfs.datanode.dns.interface</name>
<value>eth1</value>
</property>
but the HDFS Canary fails.
Could anyone please
Confirm that it's the right parameter
give me some help on how to set
it in the Cloudera Manager interface ?
Thanks in advance.
You can add further configuration properties that is not present in the CM interface filling these field in the HDFS configuration page:
- HDFS Service Advanced Configuration Snippet (Safety Valve) for hdfs-site.xml"
- Cluster-wide Advanced Configuration Snippet (Safety Valve) for core-site.xml
- HDFS Service Advanced Configuration Snippet (Safety Valve) for hadoop-policy.xml
In yout case you have to insert this code:
<property>
<name>dfs.datanode.dns.interface</name>
<value>eth1</value>
</property>
in the HDFS Service Advanced Configuration Snippet
I am trying to get data from my server, used RemoteObject to accomplish it.
When I run the application on my localhost it works great but when iam using it on my server i get a Channel.Security.Error(Security Error accessing URL).
On the server side logs there is a mention about cross domain .
77.127.194.4 - - [23/Oct/2008 21:15:11] "GET /crossdomain.xml HTTP/1.1" 501
Any one encountered the same problem ? any idea ?
Have you tried to add to your crossdomain.xml (where your fetching the stuff from) this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
<allow-access-from domain="*.YOUR_SITE_GOES_HERE.com" secure="false" />
</cross-domain-policy>
The stuff in capslock you'll probably have to change to fit your framework. For example i copied that from the one i use with macromedia flash. Instead of "www.YOUR_FRAME_WORK_CROSSDOMAIN_POLICY.com/..." i normaly have "www.macromedia.com/xml/dtds/...
I'm not sure but try to investigate that, it's probably your problem. For cross-domain, you normaly need to add to the server side, where your fecthing stuff from, permission for other sites to get it.
I have found the solution. You are right about crossdomain.xml file, but unfortunately, the Python SimpleXMLRPCServer library does not support the GET method by default, so we need to implement this.
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
class ExtendedXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
def do_GET(self):
#only allow a request for the crossdomain file
if self.path != '/crossdomain.xml':
self.send_response(403)
self.log_request(403)
return
#open the crossdomain file and read its contents
response = open('crossdomain.xml', 'r').read()
#write the data to the socket along with valid HTTP headers
self.send_response(200)
self.send_header("Content-type", "text/xml")
self.send_header("Content-length", str(len(response)))
self.end_headers()
self.wfile.write(response)
self.log_request(200)