- Timestamp:
- Jan 28, 2013 11:09:48 AM (12 years ago)
- Location:
- trunk/src/VBox/Main/webservice
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/webservice/vboxweb.cpp
r43136 r44414 6 6 * server, to which clients can connect. 7 7 * 8 * Copyright (C) 2007-201 2Oracle Corporation8 * Copyright (C) 2007-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1437 1437 return aStr.c_str(); 1438 1438 } 1439 #define DECODE_STR_MAX 0x100000 1440 void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData)) 1439 1440 #define DECODE_STR_MAX _1M 1441 void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData), const char *pszMethodName, IUnknown *pObj, const com::Guid &iid) 1441 1442 { 1442 1443 const char* pszStr = aStr.c_str(); … … 1446 1447 { 1447 1448 WebLog("Decode string too long.\n"); 1448 RaiseSoapRuntimeFault(soap, VERR_BUFFER_OVERFLOW, (ComPtr<IUnknown>)NULL);1449 RaiseSoapRuntimeFault(soap, pszMethodName, E_INVALIDARG, pObj, iid); 1449 1450 } 1450 1451 … … 1453 1454 if (FAILED(rc)) 1454 1455 { 1455 WebLog("String Decoding Failed. E RROR: 0x%lX\n", rc);1456 RaiseSoapRuntimeFault(soap, rc, (ComPtr<IUnknown>)NULL);1456 WebLog("String Decoding Failed. Error code: %Rrc\n", rc); 1457 RaiseSoapRuntimeFault(soap, pszMethodName, E_INVALIDARG, pObj, iid); 1457 1458 } 1458 1459 … … 1461 1462 1462 1463 /** 1463 * Raises a SOAP runtime fault. Implementation for the RaiseSoapRuntimeFault template 1464 * function in vboxweb.h. 1465 * 1464 * Raises a SOAP runtime fault. 1465 * 1466 * @param soap 1467 * @param pcszMethodName 1468 * @param apirc 1466 1469 * @param pObj 1467 */ 1468 void RaiseSoapRuntimeFault2(struct soap *soap, 1469 HRESULT apirc, 1470 IUnknown *pObj, 1471 const com::Guid &iid) 1470 * @param iid 1471 */ 1472 void RaiseSoapRuntimeFault(struct soap *soap, 1473 const char *pcszMethodName, 1474 HRESULT apirc, 1475 IUnknown *pObj, 1476 const com::Guid &iid) 1472 1477 { 1473 1478 com::ErrorInfo info(pObj, iid.ref()); … … 1475 1480 WEBDEBUG((" error, raising SOAP exception\n")); 1476 1481 1477 WebLog("API return code: 0x%08X (%Rhrc)\n", apirc, apirc); 1478 WebLog("COM error info result code: 0x%lX\n", info.getResultCode()); 1479 WebLog("COM error info text: %ls\n", info.getText().raw()); 1480 1481 // allocated our own soap fault struct 1482 WebLog("API method name: %s\n", pcszMethodName); 1483 WebLog("API return code: %#10lx (%Rhrc)\n", apirc, apirc); 1484 if (info.isFullAvailable() || info.isBasicAvailable()) 1485 { 1486 const com::ErrorInfo *pInfo = &info; 1487 do 1488 { 1489 WebLog("COM error info result code: %#10lx (%Rhrc)\n", pInfo->getResultCode(), pInfo->getResultCode()); 1490 WebLog("COM error info text: %ls\n", pInfo->getText().raw()); 1491 1492 pInfo = pInfo->getNext(); 1493 } 1494 while (pInfo); 1495 } 1496 1497 // compose descriptive message 1498 com::Utf8Str str = com::Utf8StrFmt("VirtualBox error: rc=%#lx", apirc); 1499 if (info.isFullAvailable() || info.isBasicAvailable()) 1500 { 1501 const com::ErrorInfo *pInfo = &info; 1502 do 1503 { 1504 str += com::Utf8StrFmt(" %ls (%#lx)", pInfo->getText().raw(), pInfo->getResultCode()); 1505 pInfo = pInfo->getNext(); 1506 } 1507 while (pInfo); 1508 } 1509 1510 // allocate our own soap fault struct 1482 1511 _vbox__RuntimeFault *ex = soap_new__vbox__RuntimeFault(soap, 1); 1483 1512 // some old vbox methods return errors without setting an error in the error info, … … 1488 1517 ex->component = ConvertComString(info.getComponent()); 1489 1518 ex->interfaceID = ConvertComString(info.getInterfaceID()); 1490 1491 // compose descriptive message1492 com::Utf8StrFmt str("VirtualBox error: %s (0x%lX)", ex->text.c_str(), ex->resultCode);1493 1519 1494 1520 RaiseSoapFault(soap, … … 1766 1792 { 1767 1793 ISession *p = session; 1768 WEBDEBUG((" * %s: created session object with comptr 0x%lX, MOR = %s\n", __FUNCTION__, p, _pISession->getWSDLID().c_str()));1794 WEBDEBUG((" * %s: created session object with comptr %#p, MOR = %s\n", __FUNCTION__, p, _pISession->getWSDLID().c_str())); 1769 1795 } 1770 1796 } while (0); … … 1794 1820 1795 1821 uintptr_t ulp = (uintptr_t)pObject; 1796 // WEBDEBUG((" %s: looking up 0x%lX\n", __FUNCTION__, ulp));1822 // WEBDEBUG((" %s: looking up %#lx\n", __FUNCTION__, ulp)); 1797 1823 ManagedObjectsMapByPtr::iterator it = _pp->_mapManagedObjectsByPtr.find(ulp); 1798 1824 if (it != _pp->_mapManagedObjectsByPtr.end()) 1799 1825 { 1800 1826 ManagedObjectRef *pRef = it->second; 1801 WEBDEBUG((" %s: found existing ref %s (%s) for COM obj 0x%lX\n", __FUNCTION__, pRef->getWSDLID().c_str(), pRef->getInterfaceName(), ulp));1827 WEBDEBUG((" %s: found existing ref %s (%s) for COM obj %#lx\n", __FUNCTION__, pRef->getWSDLID().c_str(), pRef->getInterfaceName(), ulp)); 1802 1828 return pRef; 1803 1829 } … … 1934 1960 session.touch(); 1935 1961 1936 WEBDEBUG((" * %s: MOR created for %s*= 0x%lX (IUnknown*=0x%lX; COM refcount now %RI32/%RI32), new ID is %llX; now %lld objects total\n",1962 WEBDEBUG((" * %s: MOR created for %s*=%#p (IUnknown*=%#p; COM refcount now %RI32/%RI32), new ID is %llX; now %lld objects total\n", 1937 1963 __FUNCTION__, 1938 1964 pcszInterface, … … 2083 2109 } while (0); 2084 2110 2085 WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));2111 WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); 2086 2112 if (FAILED(rc)) 2087 2113 return SOAP_FAULT; … … 2127 2153 } while (0); 2128 2154 2129 WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));2155 WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); 2130 2156 if (FAILED(rc)) 2131 2157 return SOAP_FAULT; … … 2215 2241 } while (0); 2216 2242 2217 WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));2243 WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); 2218 2244 if (FAILED(rc)) 2219 2245 return SOAP_FAULT; … … 2244 2270 } while (0); 2245 2271 2246 WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));2272 WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); 2247 2273 if (FAILED(rc)) 2248 2274 return SOAP_FAULT; … … 2281 2307 } while (0); 2282 2308 2283 WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc));2309 WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); 2284 2310 if (FAILED(rc)) 2285 2311 return SOAP_FAULT; -
trunk/src/VBox/Main/webservice/vboxweb.h
r43136 r44414 3 3 * header file for "real" web server code. 4 4 * 5 * Copyright (C) 2006-201 1Oracle Corporation5 * Copyright (C) 2006-2013 Oracle Corporation 6 6 * 7 7 * This file is part of VirtualBox Open Source Edition (OSE), as … … 72 72 void RaiseSoapInvalidObjectFault(struct soap *soap, WSDLT_ID obj); 73 73 74 void RaiseSoapRuntimeFault2(struct soap *soap, HRESULT apirc, IUnknown *pObj, const com::Guid &iid); 75 76 /** 77 * Template function called everywhere from methodmaps.cpp which calls 78 * RaiseSoapRuntimeFault2() with the correct COM interface ID. 79 * @param soap 80 * @param apirc 81 * @param pObj 82 */ 83 template <class T> 84 void RaiseSoapRuntimeFault(struct soap *soap, HRESULT apirc, const ComPtr<T> &pObj) 85 { 86 RaiseSoapRuntimeFault2(soap, apirc, pObj, COM_IIDOF(T)); 87 } 74 void RaiseSoapRuntimeFault(struct soap *soap, const char *pcszMethodName, HRESULT apirc, IUnknown *pObj, const com::Guid &iid); 88 75 89 76 /**************************************************************************** … … 99 86 std::string Base64EncodeByteArray(ComSafeArrayIn(BYTE, aData)); 100 87 101 void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData) );88 void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData), const char *pszMethodName, IUnknown *pObj, const com::Guid &iid); 102 89 /**************************************************************************** 103 90 * -
trunk/src/VBox/Main/webservice/websrv-cpp.xsl
r43136 r44414 12 12 generated for the webservice. 13 13 14 Copyright (C) 2007-201 2Oracle Corporation14 Copyright (C) 2007-2013 Oracle Corporation 15 15 16 16 This file is part of VirtualBox Open Source Edition (OSE), as … … 87 87 const char *g_pcszDoneConvertingComOutputBack = " done converting COM output \"%s\" back to caller format\n"; 88 88 const char *g_pcszEntering = "-- entering %s\n"; 89 const char *g_pcszLeaving = "-- leaving %s, rc: 0x%lX(%d)\n";89 const char *g_pcszLeaving = "-- leaving %s, rc: %#lx (%d)\n"; 90 90 91 91 // generated string constants for all interface names … … 534 534 --> 535 535 <xsl:template name="emitInputArgConverter"> 536 <xsl:param name="ifname" /> 537 <xsl:param name="object" /> <!-- normally "pObj" --> 536 538 <xsl:param name="method" /> 539 <xsl:param name="methodname" /> 537 540 <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" --> 538 541 <xsl:param name="name" /> … … 547 550 <xsl:value-of select="concat('com::SafeArray<BYTE> comcall_',$name, ';')" /> 548 551 <xsl:call-template name="emitNewlineIndent8" /> 549 <xsl:value-of select="concat('Base64DecodeByteArray(soap, ',$structprefix,$name,', ComSafeArrayAsOutParam(comcall_',$name, ') );')" />552 <xsl:value-of select="concat('Base64DecodeByteArray(soap, ',$structprefix,$name,', ComSafeArrayAsOutParam(comcall_',$name, '), "', $ifname, '::', $methodname, '", ', $object, ', COM_IIDOF(', $ifname, '));')" /> 550 553 </xsl:when> 551 554 … … 779 782 --> 780 783 <xsl:template name="emitComCall"> 781 <xsl:param name="object" /> <!-- normally "pObj->" --> 784 <xsl:param name="ifname" /> 785 <xsl:param name="object" /> <!-- normally "pObj" --> 782 786 <xsl:param name="methodname" /> 783 787 <xsl:param name="attrname" /> <!-- with attributes only --> … … 787 791 <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls --> 788 792 789 <xsl:variable name="comMethodName">790 <xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template>791 </xsl:variable>792 793 793 <xsl:call-template name="emitNewlineIndent8" /> 794 <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, "', $ comMethodName, '"));')" />794 <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, "', $methodname, '"));')" /> 795 795 <xsl:call-template name="emitNewlineIndent8" /> 796 <xsl:value-of select="concat('rc = ', $object, '->', $ comMethodName, '(')" />796 <xsl:value-of select="concat('rc = ', $object, '->', $methodname, '(')" /> 797 797 <xsl:if test="$attrtype"> 798 798 <xsl:choose> … … 857 857 <xsl:text>{</xsl:text> 858 858 <xsl:call-template name="emitNewlineIndent8" /> 859 <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, rc, ', $object, ');')" />859 <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, "', $ifname, '::', $methodname,'", rc, ', $object, ', COM_IIDOF(', $ifname, '));')" /> 860 860 <xsl:call-template name="emitNewlineIndent8" /> 861 861 <xsl:text> break;</xsl:text> … … 1068 1068 <!-- actual COM method call --> 1069 1069 <xsl:call-template name="emitComCall"> 1070 <xsl:with-param name="ifname" select="$ifname" /> 1070 1071 <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" /> 1071 1072 <xsl:with-param name="object" select="$object" /> … … 1103 1104 1104 1105 <xsl:call-template name="emitInputArgConverter"> 1106 <xsl:with-param name="ifname" select="$ifname" /> 1105 1107 <xsl:with-param name="method" select="concat($ifname, '::', $settername)" /> 1108 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" /> 1109 <xsl:with-param name="object" select="$object" /> 1106 1110 <xsl:with-param name="name" select="$attrname" /> 1107 1111 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" /> … … 1110 1114 </xsl:call-template> 1111 1115 <xsl:call-template name="emitComCall"> 1116 <xsl:with-param name="ifname" select="$ifname" /> 1112 1117 <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" /> 1113 1118 <xsl:with-param name="object" select="$object" /> … … 1378 1383 <xsl:when test="$dir='in'"> 1379 1384 <xsl:call-template name="emitInputArgConverter"> 1385 <xsl:with-param name="ifname" select="$ifname" /> 1380 1386 <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" /> 1387 <xsl:with-param name="methodname"> 1388 <xsl:call-template name="capitalize"> 1389 <xsl:with-param name="str" select="$methodname" /> 1390 </xsl:call-template> 1391 </xsl:with-param> 1392 <xsl:with-param name="object" select='"pObj"' /> 1381 1393 <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" /> 1382 1394 <xsl:with-param name="name" select="@name" /> … … 1405 1417 <!-- actual COM method call --> 1406 1418 <xsl:call-template name="emitComCall"> 1419 <xsl:with-param name="ifname" select="$ifname" /> 1407 1420 <xsl:with-param name="object" select='"pObj"' /> 1408 1421 <xsl:with-param name="methodname"> -
trunk/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl
r43103 r44414 10 10 generated for the webservice. 11 11 12 Copyright (C) 2006-201 0Oracle Corporation12 Copyright (C) 2006-2013 Oracle Corporation 13 13 14 14 This file is part of VirtualBox Open Source Edition (OSE), as … … 82 82 83 83 // forward declarations 84 84 class _vbox__InvalidObjectFault; 85 85 class _vbox__RuntimeFault; 86 86
Note:
See TracChangeset
for help on using the changeset viewer.