Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

405
Visualizações
SOAP Request with WSSE-Header in Javascript

I have the following code to execute a SOAP request with an wsse header but it seems not to work. I get a error response but I am not able to get the fault/error out of the response.

Does the below code look correct or do I miss something?

var request = "<soapenv:Envelope" +
    "xmlns:dlg='http://dlg123Lib'" +
    "xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
    "<soapenv:Header>" +
        "<wsse:Security" +
            "xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'" +
            "xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>" +
            "<wsse:UsernameToken wsu:Id='UsernameToken-BF09AFF37A2C36D4AB164000000000000000'>" +
                "<wsse:Username>BLABLABLA</wsse:Username>" +
                "<wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>BLABLABLA</wsse:Password>" +
            "</wsse:UsernameToken>" +
        "</wsse:Security>" +
    "</soapenv:Header>" +
    "<soapenv:Body>" +
        "<dlg:getData>" +
            "<name>AB</name>" +
        "</dlg:getData>" +
    "</soapenv:Body>" +
"</soapenv:Envelope>"

jQuery.ajax({
        url: 'https://endpoint_url/dlg/data',
        type: "POST",
        data: request,
        dataType: "xml",
        contentType: "text/xml; charset='utf-8'",
        success: function (soapResponse) {
            alert("Success");
        },
        error: function (soapResponse) {
            alert("Error");
        }
});

When I execute the exact same request like above in SoapUI without setting an Authorization the request is executed correctly.

So it must be something wrong with the jQuery implementation(?)

enter image description here

UPDATE 15.01.2022 I was told by the customer that the Payload of the request is empty. Anybody an idea why this could happen?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda