使用wwsapi更改soap消息中的名称空间前缀

时间:2012-06-08 20:52:06

标签: c soap native ws-security wwsapi

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

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

这是我的要求:

    <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>并且它没有看到它......任何对此有所了解的人?

0 个答案:

没有答案