gsoap在Header中加入参数
在http://www.w3.org/Submission/ws-addressing/的第2.3节Binding Endpoint References中描述了将reference parameter加入到<S:Header></S:Header>的情况。
我想使用gsoap实现这一功能,但不知道如何入手,例如我想将<fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>加入到<S:Header></S:Header>中。
在gsoap中有wsseapi.h和wsaapi.h文件,分别是加密和WS-Address的内容。
如果我要在<S:Header></S:Header>中加入SSL加密,我可以使用
soap_wsse_add_Security(&m_soapManager);
soap_wsse_add_UsernameTokenDigest(&m_soapManager,"",username,password);
/* SOAP Header: */
struct SOAP_ENV__Header
{
public:
struct _wsse__Security *wsse__Security;/* mustUnderstand */
char *wsa5__MessageID;/* optional element of type wsa5:MessageID */
struct wsa5__RelatesToType *wsa5__RelatesTo;/* optional element of type wsa5:RelatesTo */
struct wsa5__EndpointReferenceType *wsa5__From;/* optional element of type wsa5:From */
struct wsa5__EndpointReferenceType *wsa5__ReplyTo;/* mustUnderstand */
struct wsa5__EndpointReferenceType *wsa5__FaultTo;/* mustUnderstand */
char *wsa5__To;/* mustUnderstand */
char *wsa5__Action;/* mustUnderstand */
};
<S:Header>
...
<wsa:To>http://www.fabrikam123.example/acct</wsa:To>
<fabrikam:CustomerKey>123456789</fabrikam:CustomerKey>
<fabrikam:ShoppingCart>ABCDEFG</fabrikam:ShoppingCart>
...
</S:Header>