📄 wsdlport.cpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are not authorized to use this source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the SOURCE.RTF on your install media or the root of your tools installation.
// THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//+----------------------------------------------------------------------------
//
//
// File: wsdlport.cpp
//
// Contents:
//
// implementation file
//
// IWSDLPort Interface implemenation
//
//-----------------------------------------------------------------------------
#include "headers.h"
#include "wsdlserv.h"
#include "wsdlport.h"
#include "wsdloper.h"
#include "enwsdlop.h"
BEGIN_INTERFACE_MAP(CWSDLPort)
ADD_IUNKNOWN(CWSDLPort, IWSDLPort)
ADD_INTERFACE(CWSDLPort, IWSDLPort)
END_INTERFACE_MAP(CWSDLPort)
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: CWSDLPort::CWSDLPort()
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
CWSDLPort::CWSDLPort()
{
m_pOperationsEnum = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: CWSDLPort::~CWSDLPort()
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
CWSDLPort::~CWSDLPort()
{
CAutoRefc<CWSDLOperation> pWSDLOperation=0;
long lFetched;
TRACEL((2, "Port shutdown %S\n", m_bstrName));
if (m_pOperationsEnum)
{
m_pOperationsEnum->Reset();
while(m_pOperationsEnum->Next(1, (IWSDLOperation**)&pWSDLOperation, &lFetched)==S_OK)
{
((CWSDLOperation*)pWSDLOperation)->Shutdown();
release(&pWSDLOperation);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::get_name(BSTR *pbstrPortName)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::get_name(BSTR *pbstrPortName)
{
return _WSDLUtilReturnAutomationBSTR(pbstrPortName, m_bstrName);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::get_documentation(BSTR *bstrServicedocumentation)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::get_documentation(BSTR *bstrServicedocumentation)
{
return _WSDLUtilReturnAutomationBSTR(bstrServicedocumentation, m_bstrDocumentation);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::get_address(BSTR *pbstrAddress)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::get_address(BSTR *pbstrAddress)
{
return _WSDLUtilReturnAutomationBSTR(pbstrAddress , m_bstrLocation);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::get_bindStyle(BSTR *pbstrbindStyle)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::get_bindStyle(BSTR *pbstrbindStyle)
{
return(_WSDLUtilGetStyleString(pbstrbindStyle, m_fDocumentMode));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::get_transport(BSTR *pbstrtransport)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::get_transport(BSTR *pbstrtransport)
{
return _WSDLUtilReturnAutomationBSTR(pbstrtransport, m_bstrBindTransport);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::GetSoapOperations(IEnumWSDLOperations **ppIWSDLOperations)
//
// parameters:
//
// description:
//
// returns:
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::GetSoapOperations(IEnumWSDLOperations **ppIWSDLOperations)
{
HRESULT hr = S_OK;
ASSERT(m_pOperationsEnum!=0);
if (ppIWSDLOperations==0)
return(E_INVALIDARG);
hr = m_pOperationsEnum->Clone(ppIWSDLOperations);
ASSERT(hr==S_OK);
return (hr);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// function: HRESULT CWSDLPort::Init(IXMLDOMNode *pPortNode, ISoapTypeMapperFactory * ptypeFactory)
//
// parameters:
//
// description:
//
// returns:
// S_OK: successfully init
// S_FALSE: not a SOAP port
// error : one of the errors that the XML methods can throw
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT CWSDLPort::Init(IXMLDOMNode *pPortNode, ISoapTypeMapperFactory * ptypeFactory)
{
HRESULT hr = E_FAIL;
CAutoRefc<IXMLDOMNode> pBinding=0;
CAutoRefc<IXMLDOMNode> pLocation=0;
CAutoRefc<IXMLDOMNodeList> pNodeList=0;
CAutoBSTR bstrTemp;
ASSERT(pPortNode != 0);
hr = _WSDLUtilFindAttribute(pPortNode, _T("name"), &m_bstrName);
if (FAILED(hr))
{
globalAddError(WSDL_IDS_PORTNONAME, WSDL_IDS_PORT,hr);
goto Cleanup;
}
CHK(_WSDLUtilFindDocumentation(pPortNode, &m_bstrDocumentation));
TRACEL((2, "Port Init %S\n", m_bstrName));
hr = _WSDLUtilFindAttribute(pPortNode, _T("binding"), &bstrTemp);
if (FAILED(hr))
{
globalAddError(WSDL_IDS_PORTNOBINDING, WSDL_IDS_PORT,hr, m_bstrName);
goto Cleanup;
}
// now find the start of the binding name
CHK(_WSDLUtilSplitQName(bstrTemp, 0, &m_bstrBinding));
// now get the location of the soap:address element
hr = pPortNode->selectSingleNode(_T("./soap:address"), &pLocation);
if (FAILED(hr) || pLocation==0)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -