Example #1
0
/**
@fn _wsse__Security* soap_wsse_add_Security(struct soap *soap)
@brief Adds Security header element.
@param soap context
@return _wsse__Security object
*/
struct _wsse__Security*
soap_wsse_add_Security(struct soap *soap)
{ DBGFUN("soap_wsse_add_Security");
  /* if we don't have a SOAP Header, create one */
  soap_header(soap);
  /* if we don't have a wsse:Security element in the SOAP Header, create one */
  if (!soap->header->wsse__Security)
  { soap->header->wsse__Security = (_wsse__Security*)soap_malloc(soap, sizeof(_wsse__Security));
    if (!soap->header->wsse__Security)
      return NULL;
    soap_default__wsse__Security(soap, soap->header->wsse__Security);
  }
  return soap->header->wsse__Security;
}
    void checkHeader(const std::string & faultMessage)
    {
        // check WSA
        if (soap_header() == NULL) {
            if (soap_sender_fault(RemoteDiscoveryBindingProxy::soap, "checkHeader", faultMessage.c_str()) != 0)
                throw SoapException(RemoteDiscoveryBindingProxy::soap);
        }

//        if (soap_header()->wsd__AppSequence != NULL) {
//            wsd__AppSequenceType * seq = soap_header()->wsd__AppSequence;
//            instanceId() = seq->InstanceId;
//            messageNumber() = seq->MessageNumber;
//            if (seq->SequenceId != NULL)
//                sequenceId() = *seq->SequenceId;
//        }
    }
Example #3
0
int
bes_init(struct bes_context **context)
{
    struct bes_context *ctx;
    struct soap *soap;
    
    if (context == NULL) {
        return BESE_BAD_ARG;
    }
    
    ctx = (struct bes_context *)malloc(sizeof(struct bes_context));
    if (ctx == NULL) {
        // fprintf (stderr, "err 1\n");
        return BESE_SYS_ERR;
    }
    memset(ctx, 0, sizeof(struct bes_context));
    
    soap_ssl_init();
    soap = soap_new1(SOAP_C_UTFSTRING);
    if (soap == NULL) {
        free(ctx);
        // fprintf (stderr, "err 2\n");
        return BESE_SYS_ERR;
    }
    soap_set_recv_logfile(soap, NULL);
    soap_set_sent_logfile(soap, NULL);
    soap_set_test_logfile(soap, NULL);
    soap_register_plugin(soap, soap_wsse);
    soap_set_namespaces(soap, default_namespaces);
    soap_header(soap);
  
    ctx->soap = soap;
    *context = ctx;

    return BESE_OK;
}
SOAP_FMAC5 int SOAP_FMAC6 soap_wsa_alloc_header(struct soap *soap) {
	soap_header(soap);
	if (soap->header)
		return SOAP_OK;
	return soap->error = SOAP_EOM;
}