/** Adds an "Access" element to the SOAP header */
  public boolean handleRequest(MessageContext msgct) {
    if (msgct instanceof SOAPMessageContext) {
      SOAPMessageContext smsgct = (SOAPMessageContext) msgct;
      try {
        SOAPMessage msg = smsgct.getMessage();
        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
        SOAPHeader header = msg.getSOAPHeader();

        if (header == null) header = envelope.addHeader(); // add an header if non exists

        SOAPHeaderElement accessElement =
            header.addHeaderElement(
                envelope.createName(
                    "Access", "ns0", "http://www.ipd.uni-karlsruhe.de/jplag/types"));
        SOAPElement usernameelem = accessElement.addChildElement("username");
        usernameelem.addTextNode(username);
        SOAPElement passwordelem = accessElement.addChildElement("password");
        passwordelem.addTextNode(password);
        SOAPElement compatelem = accessElement.addChildElement("compatLevel");
        compatelem.addTextNode(compatibilityLevel + "");
      } catch (SOAPException x) {
        System.out.println("Unable to create access SOAP header!");
        x.printStackTrace();
      }
    }
    return true;
  }
 public void writeTo(SOAPMessage saaj) throws SOAPException {
   SOAPHeader header = saaj.getSOAPHeader();
   SOAPHeaderElement she = header.addHeaderElement(new QName(getNamespaceURI(), getLocalPart()));
   she.addChildElement(actionLocalName);
   she.addTextNode(action);
   if (soapAction != null) {
     she.addChildElement(soapActionLocalName);
     she.addTextNode(soapAction);
   }
 }
  /**
   * @param authHeader
   * @param qnameAuthHeader
   * @param soapHeader
   * @return SOAPHeaderElement
   */
  private SOAPHeaderElement ProcessAuthHeader(
      AuthHeader authHeader, QName qnameAuthHeader, SOAPHeader soapHeader) {

    SOAPHeaderElement headerElement;

    try {
      /*
       * Create the authentication header element
       */
      headerElement = soapHeader.addHeaderElement(qnameAuthHeader);

      /*
       * Check if Identifier is specified
       */
      if (authHeader.getIdentifier() != null) {
        /*
         * Create Identifier element
         */
        QName qName =
            new QName(
                qnameAuthHeader.getNamespaceURI(),
                AuthHeader.STR_Identifier,
                qnameAuthHeader.getPrefix());
        SOAPElement element = soapFactory.createElement(qName);
        element.addTextNode(authHeader.getIdentifier());
        headerElement.addChildElement(element);
      }

      /*
       * Check if PassKey is specified
       */
      if (authHeader.getPasskey() != null) {
        /*
         * Create PassKey element
         */
        QName qName =
            new QName(
                qnameAuthHeader.getNamespaceURI(),
                AuthHeader.STR_Passkey,
                qnameAuthHeader.getPrefix());
        SOAPElement element = soapFactory.createElement(qName);
        element.addTextNode(authHeader.getPasskey());
        headerElement.addChildElement(element);
      }
    } catch (SOAPException ex) {
      headerElement = null;
    }

    return headerElement;
  }
  private SOAPMessage actionToSoap(RpcInvokeAction action) throws Exception {
    useFirstElementPrefix = true;

    SOAPMessage message = messageFactory.createMessage();
    actionData =
        WsRpcActionUtil.getWsRpcActionData(((SimpleRpcInvokeAction) action).getProperties());

    SOAPEnvelope env = message.getSOAPPart().getEnvelope();
    env.addNamespaceDeclaration(ACTION_PREFIX, actionData.getMethodInputNameSpace());

    setFields(action.getFields(), env.getBody());

    if (actionData.getSoapAction().length() > 0) {
      message.getMimeHeaders().addHeader("SOAPAction", actionData.getSoapAction());
    }

    // Base auth headers from http://www.whitemesa.com/soapauth.html#S322
    /*
     * all auth standarts: http://www.soapui.org/testing-dojo/best-practices/authentication.html
     */
    if (props.getPassword() != null
        && props.getUserName() != null
        && !props.getUserName().trim().equals("")) {
      SOAPHeaderElement auth =
          message
              .getSOAPHeader()
              .addHeaderElement(
                  new QName("http://soap-authentication.org/basic/2001/10/", "BasicAuth", "h"));
      auth.setMustUnderstand(true);
      auth.addChildElement("Name").setValue(props.getUserName());
      auth.addChildElement("Password").setValue(props.getPassword());
    }

    logMessage("Request message:", message);

    return message;
  }
Esempio n. 5
0
  public SOAPMessage buildPullMessage(
      URI uri, String enumerationContext, String resourceUri, int maxElements, int timeout)
      throws SOAPException {
    MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = messageFactory.createMessage();

    SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
    env.removeNamespaceDeclaration(env.getPrefix());
    env.setPrefix("s");
    env.addNamespaceDeclaration("a", NS_WS_ADDRESSING);
    env.addNamespaceDeclaration("w", NS_WS_MANAGEMENT);
    env.addNamespaceDeclaration("n", NS_WS_ENUMERATION);
    env.addNamespaceDeclaration("ev", NS_WS_EVENTING);

    QName mustUnderstand = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "mustUnderstand", "s");

    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
    soapHeader.setPrefix("s");

    SOAPHeaderElement toHeader =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "To", "a"));
    toHeader.setValue(uri.toString());

    SOAPHeaderElement resourceURI =
        soapHeader.addHeaderElement(new QName(NS_WS_MANAGEMENT, "ResourceURI", "w"));
    resourceURI.addAttribute(mustUnderstand, "true");
    resourceURI.setValue(resourceUri);

    SOAPHeaderElement replyTo =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "ReplyTo", "a"));

    SOAPElement addressElement =
        replyTo.addChildElement(new QName(NS_WS_ADDRESSING, "Address", "a"));
    addressElement.addAttribute(mustUnderstand, "true");
    addressElement.addTextNode("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");

    SOAPElement actionElement =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "Action", "a"));
    actionElement.addAttribute(mustUnderstand, "true");
    actionElement.addTextNode(ENUMERATION_PULL);

    // MaxEnvelopeSize
    SOAPElement maxEnvelopeSize =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "MaxEnvelopeSize", "w"));
    maxEnvelopeSize.addAttribute(mustUnderstand, "true");
    maxEnvelopeSize.addTextNode("51200");

    // Message ID
    SOAPElement messageId =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "MessageID", "a"));
    messageId.addTextNode("uuid:" + UUID.randomUUID().toString());

    // Locale
    // SOAPElement locale = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "Locale", "w"));
    // locale.addAttribute(mustUnderstand, "false");
    // locale.addAttribute(new QName("xml", "lang"), "en-US");

    SOAPElement operationTimeout =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "OperationTimeout", "w"));
    operationTimeout.addTextNode(String.format("PT%d.000S", timeout));

    SOAPBody soapBody = soapMessage.getSOAPBody();
    soapBody.setPrefix("s");

    SOAPElement pullElement = soapBody.addBodyElement(new QName(NS_WS_ENUMERATION, "Pull", "n"));

    SOAPElement enumerationContextElement =
        pullElement.addChildElement(new QName(NS_WS_ENUMERATION, "EnumerationContext", "n"));
    enumerationContextElement.setTextContent(enumerationContext);

    // SOAPElement maxTime = pullElement.addChildElement(new
    // QName(NS_WS_ENUMERATION, "MaxTime", "n"));
    // maxTime.setTextContent("PS60S");

    SOAPElement maxElement =
        pullElement.addChildElement(new QName(NS_WS_ENUMERATION, "MaxElements", "n"));
    maxElement.setTextContent(String.valueOf(maxElements));

    // SOAPElement maxCharacters = pullElement.addChildElement(new
    // QName(NS_WS_ENUMERATION, "MaxCharacters", "n"));
    // enumerationContextElement.setTextContent("250000");

    return soapMessage;
  }
Esempio n. 6
0
  public SOAPMessage buildWQLQuery(
      URI uri, String namespace, String query, int maxElements, int timeout) throws SOAPException {
    MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = messageFactory.createMessage();

    SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
    env.removeNamespaceDeclaration(env.getPrefix());
    env.setPrefix("s");
    env.addNamespaceDeclaration("a", NS_WS_ADDRESSING);
    env.addNamespaceDeclaration("w", NS_WS_MANAGEMENT);
    env.addNamespaceDeclaration("en", NS_WS_ENUMERATION);

    QName mustUnderstand = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "mustUnderstand", "s");

    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
    soapHeader.setPrefix("s");

    SOAPHeaderElement toHeader =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "To", "a"));
    toHeader.setValue(uri.toString());

    SOAPHeaderElement resourceURI =
        soapHeader.addHeaderElement(new QName(NS_WS_MANAGEMENT, "ResourceURI", "w"));
    resourceURI.addAttribute(mustUnderstand, "true");
    resourceURI.setValue(WSMAN_WMI_PREFIX + "/" + namespace + "/*");

    SOAPHeaderElement replyTo =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "ReplyTo", "a"));

    SOAPElement addressElement =
        replyTo.addChildElement(new QName(NS_WS_ADDRESSING, "Address", "a"));
    addressElement.addAttribute(mustUnderstand, "true");
    addressElement.addTextNode("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");

    SOAPElement actionElement =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "Action", "a"));
    actionElement.addTextNode(ENUMERATION_ENUMERATE);

    // MaxEnvelopeSize
    SOAPElement maxEnvelopeSize =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "MaxEnvelopeSize", "w"));
    maxEnvelopeSize.addAttribute(mustUnderstand, "true");
    maxEnvelopeSize.addTextNode("51200");

    // Message ID
    SOAPElement messageId =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "MessageID", "a"));
    messageId.addTextNode("uuid:" + UUID.randomUUID().toString());

    // Locale
    // SOAPElement locale = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "Locale", "w"));
    // locale.addAttribute(mustUnderstand, "false");
    // locale.addAttribute(new QName("xml", "lang"), "en-US");

    SOAPElement operationTimeout =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "OperationTimeout", "w"));
    operationTimeout.addTextNode(String.format("PT%d.000S", timeout));

    SOAPBody soapBody = soapMessage.getSOAPBody();
    soapBody.setPrefix("s");

    SOAPElement enumerateElement =
        soapBody.addBodyElement(new QName(NS_WS_ENUMERATION, "Enumerate", "en"));

    // Return in the same response
    enumerateElement.addChildElement(new QName(NS_WS_MANAGEMENT, "OptimizeEnumeration", "w"));
    SOAPElement maxElement =
        enumerateElement.addChildElement(new QName(NS_WS_MANAGEMENT, "MaxElements", "w"));
    maxElement.addTextNode(String.valueOf(maxElements));
    SOAPElement filterElement =
        enumerateElement.addChildElement(new QName(NS_WS_MANAGEMENT, "Filter", "w"));
    filterElement.setAttribute("Dialect", DIALECT_WQL);
    filterElement.addTextNode(query);

    return soapMessage;
  }
Esempio n. 7
0
  public SOAPMessage buildEventSubscription(
      URI uri, String subscriptionQuery, int maxElements, int timeout) throws SOAPException {
    // EVENT_LOG_NOTIFICATION_QUERY = """
    // SELECT * FROM __InstanceCreationEvent
    // WHERE TargetInstance ISA 'Win32_NTLogEvent'
    // AND TargetInstance.EventType <= %d
    // """
    MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = messageFactory.createMessage();

    SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
    env.removeNamespaceDeclaration(env.getPrefix());
    env.setPrefix("s");
    env.addNamespaceDeclaration("a", NS_WS_ADDRESSING);
    env.addNamespaceDeclaration("w", NS_WS_MANAGEMENT);
    env.addNamespaceDeclaration("en", NS_WS_ENUMERATION);
    env.addNamespaceDeclaration("ev", NS_WS_EVENTING);

    QName mustUnderstand = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "mustUnderstand", "s");

    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
    soapHeader.setPrefix("s");

    SOAPHeaderElement toHeader =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "To", "a"));
    toHeader.setValue(uri.toString());

    SOAPHeaderElement resourceURI =
        soapHeader.addHeaderElement(new QName(NS_WS_MANAGEMENT, "ResourceURI", "w"));
    resourceURI.addAttribute(mustUnderstand, "true");
    resourceURI.setValue(WSMAN_EVENTLOG_PREFIX);

    SOAPHeaderElement replyTo =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "ReplyTo", "a"));

    SOAPElement addressElement =
        replyTo.addChildElement(new QName(NS_WS_ADDRESSING, "Address", "a"));
    addressElement.addAttribute(mustUnderstand, "true");
    addressElement.addTextNode("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");

    SOAPElement actionElement =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "Action", "a"));
    actionElement.addTextNode(EVENTING_SUBSCRIBE);

    // MaxEnvelopeSize
    SOAPElement maxEnvelopeSize =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "MaxEnvelopeSize", "w"));
    maxEnvelopeSize.addAttribute(mustUnderstand, "true");
    maxEnvelopeSize.addTextNode("51200");

    // Message ID
    SOAPElement messageId =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "MessageID", "a"));
    messageId.addTextNode("uuid:" + UUID.randomUUID().toString());

    // Locale
    // SOAPElement locale = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "Locale", "w"));
    // locale.addAttribute(mustUnderstand, "false");
    // locale.addAttribute(new QName("xml", "lang"), "en-US");

    SOAPElement operationTimeout =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "OperationTimeout", "w"));
    operationTimeout.addTextNode(String.format("PT%d.000S", timeout));

    SOAPBody soapBody = soapMessage.getSOAPBody();
    soapBody.setPrefix("s");

    SOAPElement enumerateElement =
        soapBody.addBodyElement(new QName(NS_WS_EVENTING, "Subscribe", "ev"));

    SOAPElement deliveryElement =
        enumerateElement.addChildElement(new QName(NS_WS_EVENTING, "Delivery", "ev"));
    deliveryElement.setAttribute("Mode", "http://schemas.dmtf.org/wbem/wsman/1/wsman/Pull");

    SOAPElement expiresElement =
        enumerateElement.addChildElement(new QName(NS_WS_EVENTING, "Expires", "ev"));
    // EXPIRE in 60 seconds - don't do this normally!
    expiresElement.addTextNode(String.format("PT%dS", new Date().getTime() + 500)); // "PT60S");

    // <ev:Expires>[xs:dateTime | xs:duration]</ev:Expires>
    SOAPElement filterElement =
        enumerateElement.addChildElement(new QName(NS_WS_MANAGEMENT, "Filter", "w"));
    filterElement.setAttribute("Dialect", DIALECT_EVENTQUERY);

    // Need to convert the XML snippet specified in the subscriptionQuery
    try {
      filterElement.addChildElement(new Util().xmlToSOAPElement(subscriptionQuery));
    } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // Tell them to send bookmarks so we can catch up later if we get
    // disconnected
    enumerateElement.addChildElement(new QName(NS_WS_MANAGEMENT, "SendBookmarks", "w"));

    return soapMessage;
  }
Esempio n. 8
0
  public SOAPMessage buildUnsubscribeMessage(
      URI uri, String enumerationContext, String subscriptionId, int maxElements, int timeout)
      throws SOAPException {
    MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = messageFactory.createMessage();

    SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
    env.removeNamespaceDeclaration(env.getPrefix());
    env.setPrefix("s");
    env.addNamespaceDeclaration("a", NS_WS_ADDRESSING);
    env.addNamespaceDeclaration("w", NS_WS_MANAGEMENT);
    env.addNamespaceDeclaration("en", NS_WS_ENUMERATION);
    env.addNamespaceDeclaration("ev", NS_WS_EVENTING);

    QName mustUnderstand = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "mustUnderstand", "s");

    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
    soapHeader.setPrefix("s");

    SOAPHeaderElement toHeader =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "To", "a"));
    toHeader.setValue(uri.toString());

    SOAPHeaderElement resourceURI =
        soapHeader.addHeaderElement(new QName(NS_WS_MANAGEMENT, "ResourceURI", "w"));
    resourceURI.addAttribute(mustUnderstand, "true");
    resourceURI.setValue(WSMAN_EVENTLOG_PREFIX);

    SOAPHeaderElement replyTo =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "ReplyTo", "a"));

    SOAPElement addressElement =
        replyTo.addChildElement(new QName(NS_WS_ADDRESSING, "Address", "a"));
    addressElement.addAttribute(mustUnderstand, "true");
    addressElement.addTextNode("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");

    SOAPElement actionElement =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "Action", "a"));
    actionElement.addTextNode(EVENTING_UNSUBSCRIBE);

    // MaxEnvelopeSize
    SOAPElement maxEnvelopeSize =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "MaxEnvelopeSize", "w"));
    maxEnvelopeSize.addAttribute(mustUnderstand, "true");
    maxEnvelopeSize.addTextNode("51200");

    // Message ID
    SOAPElement messageId =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "MessageID", "a"));
    messageId.addTextNode("uuid:" + UUID.randomUUID().toString());

    SOAPElement operationTimeout =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "OperationTimeout", "w"));
    operationTimeout.addTextNode(String.format("PT%d.000S", timeout));

    SOAPElement hsubId = soapHeader.addChildElement(new QName(NS_WS_EVENTING, "Identifier", "ev"));
    hsubId.addTextNode(subscriptionId);

    SOAPBody soapBody = soapMessage.getSOAPBody();
    soapBody.setPrefix("s");

    soapBody.addChildElement(new QName(NS_WS_EVENTING, "Unsubscribe", "ev"));

    return soapMessage;
  }
Esempio n. 9
0
  public SOAPMessage buildGetMessage(
      URI uri,
      String namespace,
      String className,
      Map<String, String> selectors,
      int maxElements,
      int timeout)
      throws TransformerException, SOAPException, IOException {
    MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = messageFactory.createMessage();

    SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
    env.removeNamespaceDeclaration(env.getPrefix());
    env.setPrefix("s");
    env.addNamespaceDeclaration("a", NS_WS_ADDRESSING);
    env.addNamespaceDeclaration("w", NS_WS_MANAGEMENT);

    QName mustUnderstand = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "mustUnderstand", "s");

    SOAPHeader soapHeader = soapMessage.getSOAPHeader();
    soapHeader.setPrefix("s");

    SOAPHeaderElement toHeader =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "To", "a"));
    toHeader.setValue(uri.toString());

    SOAPHeaderElement resourceURI =
        soapHeader.addHeaderElement(new QName(NS_WS_MANAGEMENT, "ResourceURI", "w"));
    resourceURI.addAttribute(mustUnderstand, "true");
    resourceURI.setValue(wmiClassUri("root/cimv2", className));

    SOAPHeaderElement replyTo =
        soapHeader.addHeaderElement(new QName(NS_WS_ADDRESSING, "ReplyTo", "a"));

    SOAPElement addressElement =
        replyTo.addChildElement(new QName(NS_WS_ADDRESSING, "Address", "a"));
    addressElement.addAttribute(mustUnderstand, "true");
    addressElement.addTextNode("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");

    SOAPElement actionElement =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "Action", "a"));
    actionElement.addTextNode(TRANSFER_GET);

    // MaxEnvelopeSize
    // SOAPElement maxEnvelopeSize = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "MaxEnvelopeSize", "w"));
    // maxEnvelopeSize.addAttribute(mustUnderstand, "true");
    // maxEnvelopeSize.addTextNode("153600");

    // Message ID
    SOAPElement messageId =
        soapHeader.addChildElement(new QName(NS_WS_ADDRESSING, "MessageID", "a"));
    messageId.addTextNode("uuid:" + UUID.randomUUID().toString());

    // Locale
    // SOAPElement locale = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "Locale", "w"));
    // locale.addAttribute(mustUnderstand, "false");
    // locale.addAttribute(new QName("xml", "lang"), "en-US");

    SOAPElement selectorSet =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "SelectorSet", "w"));
    for (String key : selectors.keySet()) {
      SOAPElement selector =
          selectorSet.addChildElement(new QName(NS_WS_MANAGEMENT, "Selector", "w"));
      selector.setAttribute("Name", key);
      selector.addTextNode(selectors.get(key));
    }

    // <w:OperationTimeout>PT60.000S</w:OperationTimeout>
    SOAPElement operationTimeout =
        soapHeader.addChildElement(new QName(NS_WS_MANAGEMENT, "OperationTimeout", "w"));
    operationTimeout.addTextNode(String.format("PT%d.000S", timeout));

    // SOAPElement fragmentTransfer = soapHeader.addChildElement(new
    // QName(NS_WS_MANAGEMENT, "FragmentTransfer", "w"));
    // fragmentTransfer.addAttribute(mustUnderstand, "true");
    // fragmentTransfer.addTextNode("FreeSpace");

    SOAPBody soapBody = soapMessage.getSOAPBody();
    soapBody.setPrefix("s");

    return soapMessage;
  }