<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>__username__</wsse:Username>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
To add this header to webservice call i write the following code;
import com.sun.xml.ws.api.message.Header;
import com.sun.xml.ws.api.message.Headers;
import com.sun.xml.ws.developer.WSBindingProvider;
....
private static final String SECURITY_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
private static final String MY_USERNAME = "my_username";
....
private void addUsernameSecurityHeader(UserService service) throws SOAPException {
SOAPFactory soapFactory = SOAPFactory.newInstance();
QName securityQName = new QName(SECURITY_NAMESPACE, "Security");
SOAPElement security = soapFactory.createElement(securityQName);
QName tokenQName = new QName(SECURITY_NAMESPACE, "UsernameToken");
SOAPElement token = soapFactory.createElement(tokenQName);
QName userQName = new QName(SECURITY_NAMESPACE, "Username");
SOAPElement username = soapFactory.createElement(userQName);
username.addTextNode(MY_USERNAME);
token.addChildElement(username);
security.addChildElement(token);
Header header = Headers.create(security);
((WSBindingProvider)servis).setOutboundHeaders(header);
}
after adding header to webservice calls following annoying problem popped up;
com.sun.xml.internal.messaging.saaj.soap.LocalStrings != com.sun.xml.messaging.saaj.soap.LocalStrings
some of the pages on the web tell this is a java bug some other says this is a saaj version problem. Whatever, after working more than 8 hours i end up with the following solution;
1. download saaj-impl-1.3.3.jar
2. create an endorsed folder under the JAVA_HOME/lib and copy the new saaj-impl.jar to here. (Be sure weblogic server uses this directory to run application server instances)
I tried this solution with weblogic 10.3.0 and 10.3.2 and it's works ...
4 yorum:
Teşekkürler Murat, aynı problem ile ben de karşılaştım, bakalım benim problemi mi de çözecek mi...
İngilizce bilen birisi için google dan rahatlıkla bulunabilecek bir çözümün Türkçesi için teşekkürler :)
Transparency is a must in scrum rules as it allows important aspects of the process to be visible to all the members who are responsible for the result. Since every team member should understand it is always advisable to use a common “terminology” so that reviews can be shared by all.
Hi, I am bit confused whether to opt for Scrum credentials or attend a PMP prep course / PMP classes preparing to take PMP certification exams . Any tthought?
Yorum Gönderme