Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (outboundProperty.booleanValue()) {
- SOAPMessage message = smc.getMessage();
- try {
- SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope();
- SOAPHeader header = envelope.addHeader();
- if (header == null){
- header = envelope.addHeader();
- }
- SOAPFactory soapFactory = SOAPFactory.newInstance();
- final SOAPElement security = header.addChildElement("Security", "o", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
- SOAPElement usernameToken = security.addChildElement("UsernameToken", "o");
- SOAPElement username = usernameToken.addChildElement("Username", "o");
- username.addTextNode("Test");
- SOAPElement password =usernameToken.addChildElement("Password", "o");
- password.addTextNode("password");
- //Print out the outbound SOAP message to System.out
- message.writeTo(System.out);
- System.out.println("==============================");
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- try {
- //This handler does nothing with the response from the Web Service so
- //we just print out the SOAP message.
- SOAPMessage message = smc.getMessage();
- message.writeTo(System.out);
- System.out.println("");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- return outboundProperty;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement