Changeset 20851 in vbox
- Timestamp:
- Jun 23, 2009 3:34:25 PM (15 years ago)
- Location:
- trunk/src/VBox/Main/webservice
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/webservice/glue-jaxws.xsl
r20844 r20851 289 289 </xsl:call-template> 290 290 </xsl:variable> 291 <xsl:value-of select="concat('new ', $gluetype, '(', $value,', port)')" /> 291 <!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then --> 292 <xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value,', port) : null')" /> 292 293 </xsl:otherwise> 293 294 </xsl:choose> -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r18265 r20851 1107 1107 */ 1108 1108 int ManagedObjectRef::findRefFromId(const WSDLT_ID &id, 1109 ManagedObjectRef **pRef) 1109 ManagedObjectRef **pRef, 1110 bool fNullAllowed) 1110 1111 { 1111 1112 int rc = 0; … … 1113 1114 do 1114 1115 { 1116 // allow NULL (== empty string) input reference, which should return a NULL pointer 1117 if (!id.length() && fNullAllowed) 1118 { 1119 *pRef = NULL; 1120 return 0; 1121 } 1122 1115 1123 uint64_t sessid; 1116 1124 uint64_t objid; … … 1179 1187 do { 1180 1188 ManagedObjectRef *pRef; 1181 if (!ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef ))1189 if (!ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false)) 1182 1190 resp->returnval = pRef->getInterfaceName(); 1183 1191 … … 1210 1218 do { 1211 1219 ManagedObjectRef *pRef; 1212 if ((rc = ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef )))1220 if ((rc = ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false))) 1213 1221 { 1214 1222 RaiseSoapInvalidObjectFault(soap, req->_USCOREthis); -
trunk/src/VBox/Main/webservice/vboxweb.h
r16301 r20851 186 186 187 187 static int findRefFromId(const WSDLT_ID &id, 188 ManagedObjectRef **pRef); 188 ManagedObjectRef **pRef, 189 bool fNullAllowed); 189 190 190 191 static ManagedObjectRef* findFromPtr(ComPtr<IUnknown> pcu); … … 204 205 * 205 206 * @param soap 206 * @param id in teger managed object reference, as passed in by web service client207 * @param pComPtr reference to COM pointer object that receives the com pointer,207 * @param id in: integer managed object reference, as passed in by web service client 208 * @param pComPtr out: reference to COM pointer object that receives the com pointer, 208 209 * if SOAP_OK is returned 210 * @param fNullAllowed in: if true, then this func returns a NULL COM pointer if an 211 * empty MOR is passed in (i.e. NULL pointers are allowed). If false, 212 * then this fails; this will be false when called for the "this" 213 * argument of method calls, which really shouldn't be NULL. 209 214 * @return error code or SOAP_OK if no error 210 215 */ … … 212 217 int findComPtrFromId(struct soap *soap, 213 218 const WSDLT_ID &id, 214 ComPtr<T> &pComPtr) 219 ComPtr<T> &pComPtr, 220 bool fNullAllowed) 215 221 { 216 222 int rc; 217 223 ManagedObjectRef *pRef; 218 if ((rc = ManagedObjectRef::findRefFromId(id, &pRef )))224 if ((rc = ManagedObjectRef::findRefFromId(id, &pRef, fNullAllowed))) 219 225 RaiseSoapInvalidObjectFault(soap, id); 220 226 else … … 247 253 const ComPtr<T> &pc) 248 254 { 255 // NULL comptr should return NULL MOR 256 if (pc.isNull()) 257 { 258 WEBDEBUG((" createOrFindRefFromComPtr(): returning empty MOR for NULL COM pointer\n")); 259 return ""; 260 } 261 249 262 WebServiceSession* pSession; 250 263 if ((pSession = WebServiceSession::findSessionFromRef(idParent))) -
trunk/src/VBox/Main/webservice/websrv-cpp.xsl
r16602 r20851 626 626 </xsl:when> 627 627 <xsl:when test="($wsmap='managed')"> 628 <xsl:text> // look up managed object reference for method call</xsl:text> 629 <xsl:call-template name="emitNewlineIndent8" /> 630 <xsl:value-of select="concat('ComPtr<', $ifname, '> pObj;')" /> 631 <xsl:call-template name="emitNewlineIndent8" /> 632 <xsl:value-of select="concat('if (!', $G_requestElementVarName, ')')" /> 633 <xsl:call-template name="emitNewlineIndent8" /> 634 <xsl:text>{</xsl:text> 635 <xsl:call-template name="emitNewlineIndent8" /> 636 <xsl:text> RaiseSoapInvalidObjectFault(soap, "");</xsl:text> 637 <xsl:call-template name="emitNewlineIndent8" /> 638 <xsl:text> break;</xsl:text> 639 <xsl:call-template name="emitNewlineIndent8" /> 640 <xsl:text>}</xsl:text> 641 <xsl:call-template name="emitNewlineIndent8" /> 642 <xsl:value-of select="concat('const WSDLT_ID &idThis = ', $structprefix, $G_nameObjectRefEncoded, ';')" /> 643 <xsl:call-template name="emitNewlineIndent8" /> 644 <xsl:value-of select="'if ((rc = findComPtrFromId(soap, idThis, pObj)))'" /> 645 <xsl:call-template name="emitNewlineIndent8" /> 646 <xsl:text> break;</xsl:text> 647 <xsl:call-template name="emitNewline" /> 628 <xsl:text> // look up managed object reference for method call </xsl:text> 629 <xsl:value-of select="concat(' ComPtr<', $ifname, '> pObj; ')" /> 630 <xsl:value-of select="concat(' if (!', $G_requestElementVarName, ') ')" /> 631 <xsl:text> { </xsl:text> 632 <xsl:text> RaiseSoapInvalidObjectFault(soap, ""); </xsl:text> 633 <xsl:text> break; </xsl:text> 634 <xsl:text> } </xsl:text> 635 <xsl:value-of select="concat(' const WSDLT_ID &idThis = ', $structprefix, $G_nameObjectRefEncoded, '; ')" /> 636 <xsl:value-of select="' if ((rc = findComPtrFromId(soap, idThis, pObj, false))) '" /> 637 <xsl:text> break; </xsl:text> 648 638 </xsl:when> 649 639 </xsl:choose> … … 687 677 <xsl:value-of select="' ComPtr<IUnknown> tmpObject;'" /> 688 678 <xsl:call-template name="emitNewlineIndent8" /> 689 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject )))')" />679 <xsl:value-of select="concat(' if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" /> 690 680 <xsl:call-template name="emitNewlineIndent8" /> 691 681 <xsl:text> break;</xsl:text> … … 740 730 <xsl:value-of select="concat(' comcall_', $name, ';')" /> 741 731 <xsl:call-template name="emitNewlineIndent8" /> 742 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,' )))')" />732 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" /> 743 733 <xsl:call-template name="emitNewlineIndent8" /> 744 734 <xsl:text> break</xsl:text> … … 758 748 <xsl:value-of select="concat(' comcall_', $name, ';')" /> 759 749 <xsl:call-template name="emitNewlineIndent8" /> 760 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,' )))')" />750 <xsl:value-of select="concat('if ((rc = findComPtrFromId(soap, ', $structprefix, $name, ', comcall_', $name,', true)))')" /> 761 751 <xsl:call-template name="emitNewlineIndent8" /> 762 752 <xsl:text> break</xsl:text>
Note:
See TracChangeset
for help on using the changeset viewer.