Example usage for org.w3c.dom Element getNamespaceURI

List of usage examples for org.w3c.dom Element getNamespaceURI

Introduction

In this page you can find the example usage for org.w3c.dom Element getNamespaceURI.

Prototype

public String getNamespaceURI();

Source Link

Document

The namespace URI of this node, or null if it is unspecified (see ).

Usage

From source file:com.googlecode.ehcache.annotations.config.EhCacheConfigBeanDefinitionParser.java

public BeanDefinition parse(final Element element, final ParserContext parserContext) {
    final Object elementSource = parserContext.extractSource(element);

    final NodeList evictExpiredElements = element.getElementsByTagNameNS(element.getNamespaceURI(),
            XSD_ELEMENT__EVICT_EXPIRED_ELEMENTS);
    if (evictExpiredElements.getLength() > 1) {
        throw new BeanCreationException("Only one '" + XSD_ELEMENT__EVICT_EXPIRED_ELEMENTS + "' is allowed");
    }/*from   w  w w .  jav  a  2  s  .  c  o m*/

    final int evictExpiredElementsLength = evictExpiredElements.getLength();
    if (evictExpiredElementsLength == 1) {
        final Element evictExpiredElement = (Element) evictExpiredElements.item(0);

        final String interval = evictExpiredElement.getAttribute(XSD_ATTRIBUTE__INTERVAL);

        List<CacheNameMatcher> cacheNameMatchers = parseEvictExpiredElement(evictExpiredElement);

        // get RuntimeBeanReference for cacheManager
        final RuntimeBeanReference cacheManagerReference = new RuntimeBeanReference(
                element.getAttribute(AnnotationDrivenEhCacheBeanDefinitionParser.XSD_ATTR__CACHE_MANAGER));

        // make RootBeanDefinition, RuntimeBeanReference for ExpiredElementEvictor instance, wire cacheNameMatchers reference and 
        final RootBeanDefinition expiredElementEvictor = new RootBeanDefinition(ExpiredElementEvictor.class);
        expiredElementEvictor.setSource(elementSource);
        expiredElementEvictor.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);

        final MutablePropertyValues propertyValues = expiredElementEvictor.getPropertyValues();
        propertyValues.addPropertyValue("cacheManager", cacheManagerReference);
        propertyValues.addPropertyValue("cacheNameMatchers", cacheNameMatchers);
        propertyValues.addPropertyValue("interval", interval);

        // register expiredElementEvictor
        final BeanDefinitionRegistry registry = parserContext.getRegistry();
        registry.registerBeanDefinition(EHCACHE_CONFIG_EVICTION_TASK_BEAN_NAME, expiredElementEvictor);
    }

    return null;
}

From source file:org.apache.servicemix.http.endpoints.HttpSoapProviderEndpoint.java

@Override
public void validate() throws DeploymentException {
    if (wsdl == null) {
        throw new DeploymentException("wsdl property must be set");
    }/*from   w  w  w  . java 2 s  . c o m*/
    HttpSoapProviderMarshaler marshaler;
    if (getMarshaler() instanceof HttpSoapProviderMarshaler) {
        marshaler = (HttpSoapProviderMarshaler) getMarshaler();
    } else if (getMarshaler() == null) {
        marshaler = new HttpSoapProviderMarshaler();
    } else {
        throw new DeploymentException("The configured marshaler must inherit HttpSoapProviderMarshaler");
    }
    try {
        description = DomUtil.parse(wsdl.getInputStream());
        Element elem = description.getDocumentElement();
        if (WSDLUtils.WSDL1_NAMESPACE.equals(elem.getNamespaceURI())) {
            validateWsdl1(marshaler);
        } else if (WSDLUtils.WSDL2_NAMESPACE.equals(elem.getNamespaceURI())) {
            validateWsdl2(marshaler);
        } else {
            throw new DeploymentException("Unrecognized wsdl namespace: " + elem.getNamespaceURI());
        }
        marshaler.setUseJbiWrapper(useJbiWrapper);
        marshaler.setPolicies(policies);
        setMarshaler(marshaler);
    } catch (DeploymentException e) {
        throw e;
    } catch (Exception e) {
        throw new DeploymentException("Unable to read WSDL from: " + wsdl, e);
    }
    super.validate();
}

From source file:com.netflix.ice.login.saml.Saml.java

public LoginResponse processLogin(HttpServletRequest request) throws LoginMethodException {
    IceSession iceSession = new IceSession(request.getSession());
    iceSession.voidSession(); //a second login request voids anything previous
    logger.info("Saml::processLogin");
    LoginResponse lr = new LoginResponse();
    String assertion = (String) request.getParameter("SAMLResponse");
    if (assertion == null) {
        lr.redirectTo = config.singleSignOnUrl;
        return lr;
    }/*  w ww.jav  a  2  s  . c  o  m*/
    logger.trace("Received SAML Assertion: " + assertion);
    try {
        // 1.1 2.0 schemas
        Schema schema = SAMLSchemaBuilder.getSAML11Schema();

        //get parser pool manager
        BasicParserPool parserPoolManager = new BasicParserPool();
        parserPoolManager.setNamespaceAware(true);
        parserPoolManager.setIgnoreElementContentWhitespace(true);
        parserPoolManager.setSchema(schema);

        String data = new String(Base64.decode(assertion));
        logger.info("Decoded SAML Assertion: " + data);

        StringReader reader = new StringReader(data);
        Document document = parserPoolManager.parse(reader);
        Element documentRoot = document.getDocumentElement();

        QName qName = new QName(documentRoot.getNamespaceURI(), documentRoot.getLocalName(),
                documentRoot.getPrefix());

        //get an unmarshaller
        Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(documentRoot);

        //unmarshall using the document root element
        XMLObject xmlObj = unmarshaller.unmarshall(documentRoot);
        Response response = (Response) xmlObj;
        for (Assertion myAssertion : response.getAssertions()) {
            if (!myAssertion.isSigned()) {
                logger.error("SAML Assertion not signed");
                throw new LoginMethodException("SAML Assertions must be signed by a trusted provider");
            }

            Signature assertionSignature = myAssertion.getSignature();
            SAMLSignatureProfileValidator profVal = new SAMLSignatureProfileValidator();

            logger.info("Validating SAML Assertion");
            // will throw a ValidationException 
            profVal.validate(assertionSignature);

            //Credential signCred = assertionSignature.getSigningCredential();
            boolean goodSignature = false;
            for (Certificate trustedCert : trustedSigningCerts) {
                BasicCredential cred = new BasicCredential();
                cred.setPublicKey(trustedCert.getPublicKey());
                SignatureValidator validator = new SignatureValidator(cred);
                try {
                    validator.validate(assertionSignature);
                } catch (ValidationException ve) {
                    /* Not a good key! */
                    logger.debug("Not signed by " + trustedCert.toString());
                    continue;
                }
                logger.info("Assertion trusted from " + trustedCert.toString());
                processAssertion(iceSession, myAssertion, lr);
                goodSignature = true;
                break;
            }

            if (goodSignature) {
                lr.loginSuccess = true;
            }

        }
    } catch (org.xml.sax.SAXException saxe) {
        logger.error(saxe.toString());
    } catch (org.opensaml.xml.parse.XMLParserException xmlpe) {
        logger.error(xmlpe.toString());
    } catch (org.opensaml.xml.io.UnmarshallingException uee) {
        logger.error(uee.toString());
    } catch (org.opensaml.xml.validation.ValidationException ve) {
        throw new LoginMethodException("SAML Assertion Signature was not usable: " + ve.toString());
    }
    return lr;
}

From source file:org.apache.taverna.activities.wsdl.T2WSDLSOAPInvoker.java

@Override
protected void addSoapHeader(SOAPEnvelope envelope) throws SOAPException {
    if (wsrfEndpointReference != null) {

        // Extract elements
        // Add WSA-stuff
        // Add elements

        Document wsrfDoc;// w w  w.j ava2  s.  c  om
        try {
            wsrfDoc = parseWsrfEndpointReference(wsrfEndpointReference);
        } catch (Exception e) {
            logger.warn("Could not parse endpoint reference, ignoring:\n" + wsrfEndpointReference, e);
            return;
        }

        Element wsrfRoot = wsrfDoc.getDocumentElement();

        Element endpointRefElem = null;
        if (!wsrfRoot.getNamespaceURI().equals(WSA200403NS)
                || !wsrfRoot.getLocalName().equals(ENDPOINT_REFERENCE)) {
            // Only look for child if the parent is not an EPR
            NodeList nodes = wsrfRoot.getChildNodes();
            for (int i = 0, n = nodes.getLength(); i < n; i++) {
                Node node = nodes.item(i);
                if (Node.ELEMENT_NODE == node.getNodeType() && node.getLocalName().equals(ENDPOINT_REFERENCE)
                        && node.getNamespaceURI().equals(WSA200403NS)) {
                    // Support wrapped endpoint reference for backward compatibility
                    // and convenience (T2-677)
                    endpointRefElem = (Element) node;
                    break;
                }
            }
        }

        if (endpointRefElem == null) {
            logger.warn("Unexpected element name for endpoint reference, but inserting anyway: "
                    + wsrfRoot.getTagName());
            endpointRefElem = wsrfRoot;
        }

        Element refPropsElem = null;
        NodeList nodes = endpointRefElem.getChildNodes();
        for (int i = 0, n = nodes.getLength(); i < n; i++) {
            Node node = nodes.item(i);
            if (Node.ELEMENT_NODE == node.getNodeType() && node.getLocalName().equals(REFERENCE_PROPERTIES)
                    && node.getNamespaceURI().equals(WSA200403NS)) {
                refPropsElem = (Element) node;
                break;
            }
        }
        if (refPropsElem == null) {
            logger.warn("Could not find " + REFERENCE_PROPERTIES);
            return;
        }

        SOAPHeader header = envelope.getHeader();
        if (header == null) {
            header = envelope.addHeader();
        }

        NodeList refProps = refPropsElem.getChildNodes();

        for (int i = 0, n = refProps.getLength(); i < n; i++) {
            Node node = refProps.item(i);

            if (Node.ELEMENT_NODE == node.getNodeType()) {
                SOAPElement soapElement = SOAPFactory.newInstance().createElement((Element) node);
                header.addChildElement(soapElement);

                Iterator<SOAPHeaderElement> headers = header.examineAllHeaderElements();
                while (headers.hasNext()) {
                    SOAPHeaderElement headerElement = headers.next();
                    if (headerElement.getElementQName().equals(soapElement.getElementQName())) {
                        headerElement.setMustUnderstand(false);
                        headerElement.setActor(null);
                    }
                }
            }
        }
    }
}

From source file:com.vmware.demo.SamlService.java

public String validateSAMLResponse(String samlResponse, String samlCert) throws Exception {
    String decodedString = "";
    try {/*from  www  .j  ava  2 s . co m*/
        decodedString = decodeSAMLResponse(samlResponse);
        InputStream inputStream = new ByteArrayInputStream(decodedString.getBytes("UTF-8"));

        // Parse XML
        BasicParserPool parserPoolManager = new BasicParserPool();
        parserPoolManager.setNamespaceAware(true);
        parserPoolManager.setIgnoreElementContentWhitespace(true);
        Document document = parserPoolManager.parse(inputStream);
        Element metadataRoot = document.getDocumentElement();

        QName qName = new QName(metadataRoot.getNamespaceURI(), metadataRoot.getLocalName(),
                metadataRoot.getPrefix());

        // Unmarshall document
        Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(qName);
        Response response = (Response) unmarshaller.unmarshall(metadataRoot);
        Issuer issuer = response.getIssuer();
        logger.info("Parsed response.  Issued:" + response.getIssueInstant().toString() + ", issuer: "
                + issuer.getValue());

        java.security.cert.X509Certificate jX509Cert = SamlUtils.parsePemCertificate(samlCert);
        if (null == jX509Cert) {
            logger.info("Failed to parse cert. " + samlCert);
            return "";
        }

        PublicKey publicCert = jX509Cert.getPublicKey();
        logger.info("Extracted cert.  Cert:" + publicCert);
        X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(publicCert.getEncoded());

        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
        logger.debug("Key created by provider: " + keyFactory.getProvider().toString());

        // Setup validation
        BasicX509Credential publicCredential = new BasicX509Credential();
        publicCredential.setPublicKey(publicKey);
        SignatureValidator signatureValidator = new SignatureValidator(publicCredential);
        Signature signature = response.getSignature();

        // Validate
        try {
            signatureValidator.validate(signature);
            logger.info("Assertion signature validated.");
        } catch (ValidationException e) {
            logger.error("Failed to validate signature of assertion", e);
            throw e;
        }

        // Get decryption key
        RSAPrivateKey privateKey = null;
        BasicX509Credential decryptionCredential = new BasicX509Credential();
        decryptionCredential.setPrivateKey(privateKey);
        StaticKeyInfoCredentialResolver skicr = new StaticKeyInfoCredentialResolver(decryptionCredential);

        // Decrypt assertion
        Decrypter decrypter = new Decrypter(null, skicr, new InlineEncryptedKeyResolver());
        if (response.getEncryptedAssertions().isEmpty()) {
            logger.info("Nothing to decrypt in assertion.");
        } else {
            Assertion decryptedAssertion;
            try {
                decryptedAssertion = decrypter.decrypt(response.getEncryptedAssertions().get(0));
                logger.info("Assertion decryption succeeded.");
            } catch (DecryptionException e) {
                logger.error("Failed to decrypt assertion", e);
                throw e;
            }

            // Extract attributes, log in output
            List<AttributeStatement> attributeStatements = decryptedAssertion.getAttributeStatements();
            for (int i = 0; i < attributeStatements.size(); i++) {
                List<Attribute> attributes = attributeStatements.get(i).getAttributes();
                for (int x = 0; x < attributes.size(); x++) {
                    String strAttributeName = attributes.get(x).getDOM().getAttribute("Name");

                    List<XMLObject> attributeValues = attributes.get(x).getAttributeValues();
                    for (int y = 0; y < attributeValues.size(); y++) {
                        String strAttributeValue = attributeValues.get(y).getDOM().getTextContent();
                        logger.info(strAttributeName + " = " + strAttributeValue);
                    }
                }
            }
        }
    } catch (Exception ex) {
        logger.error("Failed to validate assertion", ex);
        throw ex;
    }
    return decodedString;
}

From source file:org.springmodules.validation.bean.conf.loader.xml.handler.AbstractPropertyValidationElementHandler.java

/**
 * Determines whether the given element is supported by this handler. The check is done by comparing the element
 * tag name and namespace with the ones that are configured with this handler.
 *
 * @see org.springmodules.validation.bean.conf.loader.xml.handler.PropertyValidationElementHandler#supports(org.w3c.dom.Element, Class, java.beans.PropertyDescriptor)
 *///from w  w w  .j a  va 2  s .  c om
public boolean supports(Element element, Class clazz, PropertyDescriptor descriptor) {
    String localName = element.getLocalName();
    if (!localName.equals(elementName)) {
        return false;
    }
    String ns = element.getNamespaceURI();
    return ObjectUtils.nullSafeEquals(ns, namespaceUri);
}

From source file:org.solmix.runtime.support.spring.AbstractBeanDefinitionParser.java

protected void firstChildAsProperty(Element element, ParserContext ctx, BeanDefinitionBuilder bean,
        String propertyName) {//w  w w .  j  a  v  a2  s.com
    Element first = getFirstChild(element);
    if (first == null) {
        throw new IllegalStateException(propertyName + " property must have child elements!");
    }
    String id;
    BeanDefinition child;
    if (first.getNamespaceURI().equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
        String name = first.getLocalName();
        if ("ref".equals(name)) {
            id = first.getAttribute("bean");
            if (id == null) {
                throw new IllegalStateException("<ref> elements must have a \"bean\" attribute!");
            }
            bean.addPropertyReference(propertyName, id);
            return;
        } else if ("bean".equals(name)) {
            BeanDefinitionHolder bdh = ctx.getDelegate().parseBeanDefinitionElement(first);
            child = bdh.getBeanDefinition();
            bean.addPropertyValue(propertyName, child);
            return;
        } else {
            throw new UnsupportedOperationException("Elements with the name " + name + " are not currently "
                    + "supported as sub elements of " + element.getLocalName());
        }
    }
    child = ctx.getDelegate().parseCustomElement(first, bean.getBeanDefinition());
    bean.addPropertyValue(propertyName, child);
}

From source file:be.fedict.eid.dss.ws.DigitalSignatureServicePortImpl.java

@Override
public SignResponse sign(SignRequest signRequest) {

    LOG.debug("sign");

    // parse request
    String requestId = signRequest.getRequestID();
    LOG.debug("request Id: " + requestId);

    // verify profile
    String profile = signRequest.getProfile();
    LOG.debug("signRequest.profile: " + profile);
    if (!profile.equals(DSSConstants.ARTIFACT_NAMESPACE)) {
        return DSSUtil.createRequestorSignErrorResponse(requestId, DSSConstants.RESULT_MINOR_NOT_SUPPORTED,
                "Profile not supported.");
    }/*  ww w  .j  a v  a  2s.c  om*/

    // parse OptionalInput's
    boolean returnStorageInfo = false;
    String documentId = null;

    AnyType optionalInputs = signRequest.getOptionalInputs();
    if (null == optionalInputs) {
        return DSSUtil.createRequestorSignErrorResponse(requestId, DSSConstants.RESULT_MINOR_NOT_SUPPORTED,
                "Expecting Artifact Binding OptionalInputs...");
    }
    for (Object optionalInputObject : optionalInputs.getAny()) {

        if (optionalInputObject instanceof Element) {

            Element element = (Element) optionalInputObject;

            if (DSSConstants.ARTIFACT_NAMESPACE.equals(element.getNamespaceURI())
                    && DSSConstants.RETURN_STORAGE_INFO.equals(element.getLocalName())) {

                returnStorageInfo = true;

            } else if (DSSConstants.ARTIFACT_NAMESPACE.equals(element.getNamespaceURI())
                    && DSSConstants.RETURN_STORED_DOCUMENT.equals(element.getLocalName())) {

                try {
                    ReturnStoredDocument returnStoredDocument = DSSUtil.getReturnStoredDocument(element);
                    documentId = returnStoredDocument.getIdentifier();
                } catch (JAXBException e) {

                    return DSSUtil.createRequestorSignErrorResponse(requestId,
                            DSSConstants.RESULT_MINOR_NOT_SUPPORTED,
                            "Failed to unmarshall \"ReturnStoredDocument\"" + " element.");
                }

            } else {

                return DSSUtil.createRequestorSignErrorResponse(requestId,
                        DSSConstants.RESULT_MINOR_NOT_SUPPORTED,
                        "Unexpected OptionalInput: \"" + element.getLocalName() + "\"");

            }
        }
    }

    if (!returnStorageInfo && null == documentId || returnStorageInfo && null != documentId) {

        return DSSUtil.createRequestorSignErrorResponse(requestId, DSSConstants.RESULT_MINOR_NOT_SUPPORTED,
                "Missing Artifact Binding OptionalInputs...");
    }

    if (returnStorageInfo) {

        return storageInfoResponse(signRequest);
    } else {

        return storedDocumentResponse(signRequest, documentId);
    }
}

From source file:be.fedict.eid.dss.ws.DigitalSignatureServicePortImpl.java

@Override
public ResponseBaseType verify(VerifyRequest verifyRequest) {

    LOG.debug("verify");

    /*/*from   w w  w  . j  a v  a  2 s  .  co m*/
     * Parse the request.
     */
    String requestId = verifyRequest.getRequestID();
    LOG.debug("request Id: " + requestId);
    List<DocumentDO> documents = getDocuments(verifyRequest.getInputDocuments());

    if (documents.isEmpty()) {
        return DSSUtil.createRequestorErrorResponse(requestId, null, "No valid document found to validate.");
    }
    if (documents.size() != 1) {
        return DSSUtil.createRequestorErrorResponse(requestId, null, "Can validate only one document.");
    }
    byte[] data = documents.get(0).getDocumentData();
    String mimeType = documents.get(0).getContentType();

    byte[] originalData = null;
    boolean returnVerificationReport = false;
    AnyType optionalInput = verifyRequest.getOptionalInputs();
    if (null != optionalInput) {
        List<Object> anyObjects = optionalInput.getAny();
        for (Object anyObject : anyObjects) {
            if (anyObject instanceof Element) {
                Element element = (Element) anyObject;
                if (DSSConstants.VR_NAMESPACE.equals(element.getNamespaceURI())
                        && "ReturnVerificationReport".equals(element.getLocalName())) {
                    /*
                     * We could check for supported ReturnVerificationReport
                     * input, but then again, who cares?
                     */
                    returnVerificationReport = true;
                }
                if (DSSConstants.ORIGINAL_DOCUMENT_NAMESPACE.equals(element.getNamespaceURI())
                        && DSSConstants.ORIGINAL_DOCUMENT_ELEMENT.equals(element.getLocalName())) {
                    try {
                        originalData = DSSUtil.getOriginalDocument(element);
                    } catch (JAXBException e) {
                        return DSSUtil.createRequestorErrorResponse(requestId,
                                DSSConstants.RESULT_MINOR_NOT_PARSEABLE_XML_DOCUMENT);
                    }
                }
            }
        }
    }

    /*
     * Invoke the underlying DSS verification service.
     */
    List<SignatureInfo> signatureInfos;
    try {
        signatureInfos = this.signatureVerificationService.verify(data, mimeType, originalData);
    } catch (DocumentFormatException e) {
        return DSSUtil.createRequestorErrorResponse(requestId,
                DSSConstants.RESULT_MINOR_NOT_PARSEABLE_XML_DOCUMENT);
    } catch (InvalidSignatureException e) {
        return DSSUtil.createRequestorErrorResponse(requestId);
    }

    /*
     * Construct the DSS response.
     */
    ObjectFactory dssObjectFactory = new ObjectFactory();

    ResponseBaseType responseBase = dssObjectFactory.createResponseBaseType();
    responseBase.setRequestID(requestId);
    Result result = dssObjectFactory.createResult();
    result.setResultMajor(DSSConstants.RESULT_MAJOR_SUCCESS);
    AnyType optionalOutput = dssObjectFactory.createAnyType();
    if (signatureInfos.size() > 1) {
        result.setResultMinor(DSSConstants.RESULT_MINOR_VALID_MULTI_SIGNATURES);
    } else if (1 == signatureInfos.size()) {
        result.setResultMinor(DSSConstants.RESULT_MINOR_VALID_SIGNATURE);
    } else {
        result.setResultMinor(DSSConstants.RESULT_MINOR_INVALID_SIGNATURE);
    }

    if (returnVerificationReport) {
        DSSUtil.addVerificationReport(optionalOutput, signatureInfos);
    }

    if (!optionalOutput.getAny().isEmpty()) {
        responseBase.setOptionalOutputs(optionalOutput);
    }

    responseBase.setResult(result);
    return responseBase;
}

From source file:com.twinsoft.convertigo.engine.util.WsReference.java

private static XmlHttpTransaction createSoapTransaction(XmlSchema xmlSchema, WsdlInterface iface,
        WsdlOperation operation, Project project, HttpConnector httpConnector)
        throws ParserConfigurationException, SAXException, IOException, EngineException {
    XmlHttpTransaction xmlHttpTransaction = null;
    WsdlRequest request;//from  www  . j a  v  a2 s .  c  om
    String requestXml;
    String transactionName, comment;
    String operationName;

    if (operation != null) {
        comment = operation.getDescription();
        try {
            comment = (comment.equals("")
                    ? operation.getBindingOperation().getDocumentationElement().getTextContent()
                    : comment);
        } catch (Exception e) {
        }
        operationName = operation.getName();
        transactionName = StringUtils.normalize("C" + operationName);
        xmlHttpTransaction = new XmlHttpTransaction();
        xmlHttpTransaction.bNew = true;
        xmlHttpTransaction.setHttpVerb(HttpMethodType.POST);
        xmlHttpTransaction.setName(transactionName);
        xmlHttpTransaction.setComment(comment);

        // Set encoding (UTF-8 by default)
        xmlHttpTransaction.setEncodingCharSet("UTF-8");
        xmlHttpTransaction.setXmlEncoding("UTF-8");

        // Ignore SOAP elements in response
        xmlHttpTransaction.setIgnoreSoapEnveloppe(true);

        // Adds parameters
        XMLVector<XMLVector<String>> parameters = new XMLVector<XMLVector<String>>();
        XMLVector<String> xmlv;
        xmlv = new XMLVector<String>();
        xmlv.add(HeaderName.ContentType.value());
        xmlv.add(MimeType.TextXml.value());
        parameters.add(xmlv);

        xmlv = new XMLVector<String>();
        xmlv.add("Host");
        xmlv.add(httpConnector.getServer());
        parameters.add(xmlv);

        xmlv = new XMLVector<String>();
        xmlv.add("SOAPAction");
        xmlv.add(""); // fix #4215 - SOAPAction header must be empty
        parameters.add(xmlv);

        xmlv = new XMLVector<String>();
        xmlv.add("user-agent");
        xmlv.add("Convertigo EMS " + Version.fullProductVersion);
        parameters.add(xmlv);

        xmlHttpTransaction.setHttpParameters(parameters);

        QName qname = null;
        boolean bRPC = false;
        String style = operation.getStyle();
        if (style.toUpperCase().equals("RPC"))
            bRPC = true;

        // Set SOAP response element
        if (bRPC) {
            try {
                MessagePart[] parts = operation.getDefaultResponseParts();
                if (parts.length > 0) {
                    String ename = parts[0].getName();
                    if (parts[0].getPartType().name().equals("CONTENT")) {
                        MessagePart.ContentPart mpcp = (MessagePart.ContentPart) parts[0];
                        qname = mpcp.getSchemaType().getName();
                        if (qname != null) {
                            // response is based on an element defined with a type
                            // operationResponse element name; element name; element type
                            String responseQName = operationName + "Response;" + ename + ";" + "{"
                                    + qname.getNamespaceURI() + "}" + qname.getLocalPart();
                            xmlHttpTransaction.setResponseElementQName(responseQName);
                        }
                    }
                }
            } catch (Exception e) {
            }
        } else {
            try {
                qname = operation.getResponseBodyElementQName();
                if (qname != null) {
                    QName refName = new QName(qname.getNamespaceURI(), qname.getLocalPart());
                    xmlHttpTransaction.setXmlElementRefAffectation(new XmlQName(refName));
                }
            } catch (Exception e) {
            }
        }

        // Create request/response
        request = operation.addNewRequest("Test" + transactionName);
        requestXml = operation.createRequest(true);
        request.setRequestContent(requestXml);
        //responseXml = operation.createResponse(true);

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document requestDoc = db.parse(new InputSource(new StringReader(requestXml)));
        //Document responseDoc = db.parse(new InputSource(new StringReader(responseXml)));

        Element enveloppe = requestDoc.getDocumentElement();
        String soapenvNamespace = enveloppe.getNamespaceURI();

        // Retrieve variables
        Element header = (Element) requestDoc.getDocumentElement()
                .getElementsByTagNameNS(soapenvNamespace, "Header").item(0);
        Element body = (Element) requestDoc.getDocumentElement()
                .getElementsByTagNameNS(soapenvNamespace, "Body").item(0);

        //System.out.println(XMLUtils.prettyPrintDOM(requestDoc));

        // Extract variables
        List<RequestableHttpVariable> variables = new ArrayList<RequestableHttpVariable>();
        extractSoapVariables(xmlSchema, variables, header, null, false, null);
        extractSoapVariables(xmlSchema, variables, body, null, false, null);

        // Serialize request/response into template xml files
        String projectName = project.getName();
        String connectorName = httpConnector.getName();
        String templateDir = Engine.PROJECTS_PATH + "/" + projectName + "/soap-templates/" + connectorName;
        File dir = new File(templateDir);
        if (!dir.exists())
            dir.mkdirs();

        String requestTemplateName = "/soap-templates/" + connectorName + "/" + xmlHttpTransaction.getName()
                + ".xml";
        String requestTemplate = Engine.PROJECTS_PATH + "/" + projectName + requestTemplateName;

        xmlHttpTransaction.setRequestTemplate(requestTemplateName);
        saveTemplate(requestDoc, requestTemplate);

        // Adds variables
        for (RequestableHttpVariable variable : variables) {
            //System.out.println("adding "+ variable.getName());
            xmlHttpTransaction.add(variable);
        }

        xmlHttpTransaction.hasChanged = true;
    }

    return xmlHttpTransaction;
}