int NotificationProducerBindingService::Subscribe(_wsnt__Subscribe *wsnt__Subscribe, _wsnt__SubscribeResponse *wsnt__SubscribeResponse)
{
	std::cout << __FUNCTION__ << std::endl;
	ServiceContext* ctx = (ServiceContext*)this->soap->user;
	
	NotificationConsumerBindingProxy* subcriberProxy = new NotificationConsumerBindingProxy(wsnt__Subscribe->ConsumerReference.Address);
	
	_wsnt__Notify notification;
	notification.NotificationMessage.push_back(soap_new_wsnt__NotificationMessageHolderType(subcriberProxy->soap));
	notification.NotificationMessage.back()->Message.__any = soap_dom_element(subcriberProxy->soap, (char*)NULL, (char*)NULL, (char*)"subscribed");	
	if (subcriberProxy->Notify(&notification) != SOAP_OK)
	{
		subcriberProxy->soap_stream_fault(std::cerr);
	}
	
	ctx->m_subscriber.push_back(subcriberProxy);
	std::cout << __FUNCTION__ << " nb subscriber:" << ctx->m_subscriber.size() << std::endl;	
	
	std::ostringstream os;
	os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port;
	std::string url(os.str());
	
	time_t sec = time(NULL);
	wsnt__SubscribeResponse->SubscriptionReference.Address = strcpy((char*)soap_malloc(this->soap, url.size()+1), url.c_str());
	wsnt__SubscribeResponse->CurrentTime = soap_new_ptr(this->soap,sec);
	wsnt__SubscribeResponse->TerminationTime = soap_new_ptr(this->soap,sec+3600);
	
	return SOAP_OK;
}
int NotificationProducerBindingService::Subscribe(_wsnt__Subscribe *wsnt__Subscribe, _wsnt__SubscribeResponse *wsnt__SubscribeResponse)
{
	std::cout << __FUNCTION__ << std::endl;
	ServiceContext* ctx = (ServiceContext*)this->soap->user;
	
	NotificationConsumerBindingProxy* subcriberProxy = new NotificationConsumerBindingProxy(wsnt__Subscribe->ConsumerReference.Address);
	
	_wsnt__Notify notification;
	notification.NotificationMessage.push_back(soap_new_wsnt__NotificationMessageHolderType(subcriberProxy->soap));
	notification.NotificationMessage.back()->Message.__any = soap_dom_element(subcriberProxy->soap, (char*)NULL, (char*)NULL, (char*)"subscribed");	
	if (subcriberProxy->Notify(&notification) != SOAP_OK)
	{
		subcriberProxy->soap_stream_fault(std::cerr);
	}
	
	ctx->m_subscriber.push_back(subcriberProxy);
	std::cout << __FUNCTION__ << "nb subscriber:" << ctx->m_subscriber.size() << std::endl;	
	
	return SOAP_OK;
}