OSGi コンテナーで実行する必要があるクライアントを開発しています。cxf-codegen-plugin によって生成されたスタブを使用しています。次のスタンドアロン アプリケーションは正常に動作します。
public class MyClient {
public static void main(String args[]) throws java.lang.Exception{
String endpointT = "http://myService/endpoint/";
MyServicess = new MyService( );
MyServicePortType port = ss.MyServicePort();
BindingProvider provider = (BindingProvider) port;
Client client = ClientProxy.getClient(port);
client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointT) ;
System.out.println("Invoking findEventManager...");
System.out.println(port.callService());
}
}
OSGiコンテナで同じことを試してみると(OSGiのfelix実装を使用するkarafを使用しています)。うまくいきません!この例外を見せてくださいjavax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method callService.
。コードは次のようになります。
@Component(name="RemoteExample", immediate=true)
@Service
public class RemoteExampleImpl extends Thread implements IRemoteExample {
private Boolean running =false;
@Activate
protected void activate(ComponentContext context) {
running =true;
this.start();
}
public void run() {
boolean cont = true;
while (cont && running) {
String endpointT = "http://myService/endpoint/";
MyServicess = new MyService( );
MyServicePortType port = ss.MyServicePort();
BindingProvider provider = (BindingProvider) port;
Client client = ClientProxy.getClient(port);
client.getRequestContext().put(Message.ENDPOINT_ADDRESS, endpointT) ;
System.out.println("Invoking findEventManager...");
System.out.println(port.callService());
}
}
@Deactivate
protected void deactivate(ComponentContext context) {
running = false;
mLogger.info("LocalExampleImpl deactivated");
}
}
このコードを機能させるにはどうすればよいですか?