2

我在 C 项目中使用 WWSAPI 通过发送和接收 SOAP 消息与 Web 服务进行通信。

我遇到的错误是服务器期望看到一个<wsse:Security>标签,而我的程序生成的消息没有标签。相反,它有一个<o:Security>标签。有没有办法在 C/C++ 的 WWSAPI 中指定命名空间前缀?

这是我的要求:

    <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Header>
        <a:Action s:mustUnderstand="1">http://ge.evse.com/getAllGeneratedPasswords</a:Action>
        <a:MessageID>urn:uuid:1fc3d3dc-a1c1-4fcf-bfca-96e712afba1b</a:MessageID>
        <a:To s:mustUnderstand="1">https://services.stg.gewattstation.com/EVSEManufacturingServices/services/EVSEManufacturingServices</a:To>
        <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <Created>2012-06-08T19:00:59.476Z</Created>
            <Expires>2012-06-08T19:05:59.476Z</Expires>
          </Timestamp>
          <o:UsernameToken>
            <o:Username>joe</o:Username>
            <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><!--censored sensitive information--></o:Password>
          </o:UsernameToken>
        </o:Security>
      </s:Header>
      <s:Body>
        <getAllGeneratedPasswords xmlns="http://service.services.manufacturing.evse.inds.ge.com/">
          <userType xmlns="">user</userType>
        </getAllGeneratedPasswords>
      </s:Body>
    </s:Envelope>

这是来自网络服务的响应:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <soap:Fault>
          <faultcode xmlns:ns1="http://docs.oas is-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd ">ns1:InvalidSecurity</faultcode>
          <faultstring>An error was discovered processing the &lt;wsse:Security> header</faultstring>
        </soap:Fault>
      </soap:Body>
    </soap:Envelope>

正如你所看到的,它正在寻找<wsse:Security>但它没有看到它……任何对此一无所知的人?

4

0 回答 0