我需要通過https從xfire客戶端調用帶有ws-security(用戶名令牌)的axis2 Web服務。我可以通過xfire dynamic client來做這個練習,但是沒有wsdl base客戶端的運氣(即從wsdl生成java stub)。任何人都可以指出什麼可能是錯的(存根,ws-安全別的東西)?從xfire客戶端調用axis2 Web服務:找不到Operation的端點引用(EPR)
例外:螺紋
異常 「主」 org.codehaus.xfire.XFireRuntimeException: 無法調用服務..嵌套 例外是 org.codehaus.xfire.fault.XFireFault: 對於沒有找到 操作端點引用(EPR)是 https://localhost/services/DataServiceSample2 和WSA動作= org.codehaus.xfire.fault.XFireFault: 爲端點引用(EPR)沒有找到0操作是 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);
}
是您的服務器在同一臺機器作爲你的客戶端上運行? – 2010-02-22 09:17:19
否 – FoxyBOA 2010-02-22 14:12:38