https 経由で xfire クライアントから ws-security (ユーザー名トークン) を使用して axis2 Web サービスを呼び出す必要があります。xfire dynamic clientを介して演習を行うことができましたが、wsdl ベース クライアント (つまり、wsdl から Java スタブを生成する) ではうまくいきませんでした。何が問題なのか (スタブ、ws-security など) を指摘してくれる人はいますか?
例外:
スレッド "メイン" org.codehaus.xfire.XFireRuntimeException の例外: サービスを呼び出すことができませんでした.. ネストされた例外は org.codehaus.xfire.fault.XFireFault です: オペレーションのエンドポイント参照 (EPR) が見つかりません https://localhost /services/DataServiceSample2 および WSA アクション = org.codehaus.xfire.fault.XFireFault: 操作のエンドポイント参照 (EPR) が見つかりません https://localhost/services/DataServiceSample2 および WSA アクション =
コード:
public static void main(String[] args) throws MalformedURLException {
ProtocolSocketFactory easy = new EasySSLProtocolSocketFactory();
Protocol protocol = new Protocol("https", easy, 9443);
Protocol.registerProtocol("https", protocol);
ObjectServiceFactory serviceFactory = new ObjectServiceFactory();
serviceFactory.setStyle("message");
Service serviceModel = serviceFactory.create(DataServiceSample2PortType.class);
XFireProxyFactory factory = new XFireProxyFactory();
DataServiceSample2PortType service = (DataServiceSample2PortType) factory.create(serviceModel, "https://localhost:9443/services/DataServiceSample2");
Client client = Client.getInstance(service);
client.addOutHandler(new DOMOutHandler());
Properties properties = new Properties();
properties.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
properties.setProperty(WSHandlerConstants.USER, "admin");
properties.setProperty(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
properties.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, PasswordHandler.class.getName());
client.addOutHandler(new WSS4JOutHandler(properties));
sab.TopCustomerResponse topCustomersInCalifornia = service.topCustomersInCalifornia(null);
}