私は遠隔からアクセスできるサービスを書く必要があります。 私はcxf-dosgi-ri-singlebundle-distribution-1.4.0を使用しています。 だから私はこれらのプロパティで、実装、APIを作った:分散OSGi - サービスを消費する
Dictionary<String, String> restProps = new Hashtable<String, String>();
restProps.put("service.exported.interfaces", "*");
restProps.put("service.exported.configs", "org.apache.cxf.ws");
restProps.put("org.apache.cxf.ws.address", "http://192.168.0.3:9090/preview");
bundleContext.registerService(Preview.class.getName(), new PreviewService(),restProps);
私は、バンドルを展開する場合、(APIおよびD-OSGiのjarファイルを展開した後)私は、ブラウザでWSDLを見ることができます、でも、リモートコンピュータから。 「http://192.168.0.3:9090/preview?wsdl」はこのようです。
しかし、消費者が来る。あると、クライアントジャーでOSGI-INF /リモート・サービス/リモート-services.xmlの:
<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
<endpoint-description>
<property name="objectClass">
<array>
<value>com.liferay.preview.api</value>
</array>
</property>
<property name="endpoint.id">http://192.168.0.3:9090/preview</property>
<property name="service.imported.configs">org.apache.cxf.ws</property>
</endpoint-description>
</endpoint-descriptions>
は私が(D-のOSGiバンドルとAPIを展開した後)のバンドルを展開することができますが、私は」いつもヌル参照を返す。 チュートリアルは、常にこの
st = new ServiceTracker(bundleContext, MyService.class.getName(), null) {
@Override
public Object addingService(ServiceReference reference) {
Object svc = bundleContext.getService(reference);
if (svc instanceof MyService) {
printServiceInfo((MyService) svc);
}
return super.addingService(reference);
}
};
st.open();
のようなコードを使用してしかし、私は、私は(ServiceTrackerにはコンストラクタを - 私は戻ってレジストリインスタンスからServiceTrackerインスタンスを取得することができます)これを使用することはできませんLiferayの7、使用しています
をOSGiコンテナはFelixです。私は上で見たように、 をWSDL記述にアクセスし、のは言わせてできるかどうかという、どこかでそれを読んだ
は、ハロー()私のAPIで、その後、 「http://192.168.0.3:9090/preview/hello」コールが動作するはず方法があります。..しかし、そうではありません。 私はこれをデバッグする方法も知らない。 (遠隔のものがなければ、ローカルに、同じコンテナにメソッド呼び出しが働いています)
どんな助けもうまくいくでしょう!ありがとう!
この場合、クライアントにremote-services.xmlは必要ありませんか? –
正確に。詳細については、このチュートリアルを参照してください。http://liquid-reality.de/display/liquid/2013/02/13/Apache+Karaf+Tutorial+Part+8+-+Distributed+OSGi Btw。 Aries RSAもあり、CXF以外の高速バイナリトランスポートを提供しています。 http://aries.apache.org/modules/rsa.html –