2017-09-07 8 views
0
I have the following Java method using AXIOM 1.2.13: 

private OMElement createSecurityHeader(String username, String password) { 
OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX); 
OMFactory factory = new SOAP11Factory(); 
OMElementImpl securityHeader; 
OMElementImpl usernameTokenElement; 
OMElementImpl usernameElement; 
OMElementImpl passwordElement; 

// create the Security header block 
securityHeader = new OMElementImpl("Security", wsseNS, factory); 
securityHeader.addAttribute("mustUnderstand", "1", null); 

// nest the UsernameToken in the Security header 
usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS, securityHeader, factory); 

// nest the Username and Password elements 
usernameElement = new OMElementImpl(USERNAME_LN, wsseNS, usernameTokenElement, factory); 
usernameElement.setText(username); 

passwordElement = new OMElementImpl(PASSWORD_LN, wsseNS,usernameTokenElement, factory); 
passwordElement.setText(password); 
passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null); 

return securityHeader; 
} 
} 

AXIOM 1.2.20で動作するようにこのコードを移行します。AXIOM 1.2.13から1.2.20への移行

これを行うには一般的にどのような解決法やリソースが必要ですか?

答えて

0

OMAbstractFactory.getSOAP11Factory()を使用してSOAPFactoryインスタンスを取得し、内部実装クラスへの参照がなくなるまでファクトリメソッドを使用するようにコードを書き直します。結果のコードはAxiomの両方のバージョンで動作します。

関連する問題