diff options
Diffstat (limited to 'src/VBox/Main/webservice')
22 files changed, 555 insertions, 767 deletions
diff --git a/src/VBox/Main/webservice/MANIFEST.MF.in b/src/VBox/Main/webservice/MANIFEST.MF.in index 89d7a5b2..3d04734c 100644 --- a/src/VBox/Main/webservice/MANIFEST.MF.in +++ b/src/VBox/Main/webservice/MANIFEST.MF.in @@ -22,7 +22,7 @@ Import-Package: javax.validation.constraints;version="1.0", javax.xml.ws.soap,javax.xml.ws.handler,javax.xml.ws.http, javax.xml.ws.wsaddressing,javax.xml.parsers,javax.xml.stream, javax.xml.transform,javax.xml.transform.dom, - javax.xml.transform.stream,org.w2c.dom,org.xml.sax,javax.xml.bind, + javax.xml.transform.stream,org.w3c.dom,org.xml.sax,javax.xml.bind, javax.xml.bind.annotation,javax.xml.bind.attachment, javax.xml.bind.helpers,javax.xml.bind.util, org.virtualbox@VBOX_API_SUFFIX@;version="@VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@" diff --git a/src/VBox/Main/webservice/Makefile.kmk b/src/VBox/Main/webservice/Makefile.kmk index 17e50bcf..abc15123 100644 --- a/src/VBox/Main/webservice/Makefile.kmk +++ b/src/VBox/Main/webservice/Makefile.kmk @@ -6,7 +6,7 @@ # # -# Copyright (C) 2007-2012 Oracle Corporation +# Copyright (C) 2007-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -151,6 +151,9 @@ BLDDIRS += $(VBOXWEB_OUT_DIR) # The webservice location VBOX_PATH_WEBSERVICE := $(PATH_SUB_CURRENT) +# The IDL subdirectory (contains some XSLT files) +VBOX_PATH_IDL := $(abspath $(PATH_SUB_CURRENT)/../idl) + # If this is set, all webservice files are considered out-of-date every time # this makefile is touched. Otherwise, set this to empty. RECOMPILE_ON_MAKEFILE_CURRENT := $(MAKEFILE_CURRENT) @@ -167,8 +170,8 @@ VBOXWEB_IDL_SRC_STRIPPED := $(VBOX_XIDL_FILE) # platform-specific XIDL file generated from $(VBOXWEB_IDL_SRC_STRIPPED): VBOXWEB_IDL_SRC := $(VBOXWEB_OUT_DIR)/VirtualBox.xidl -VBOXWEB_WSDL = $(VBOX_PATH_SDK)/bindings/webservice/vboxweb.wsdl -VBOXWEBSERVICE_WSDL = $(VBOX_PATH_SDK)/bindings/webservice/vboxwebService.wsdl +VBOXWEB_WSDL = $(VBOXWEB_OUT_DIR)/vboxweb.wsdl +VBOXWEBSERVICE_WSDL = $(VBOXWEB_OUT_DIR)/vboxwebService.wsdl VBOXWEB_TYPEMAP := $(VBOXWEB_OUT_DIR)/typemap.dat @@ -249,6 +252,8 @@ ifdef VBOX_GSOAP_INSTALLED $(VBOXWEB_OUT_DIR)/soapC-18.cpp \ $(VBOXWEB_OUT_DIR)/soapC-19.cpp \ $(VBOXWEB_OUT_DIR)/soapC-20.cpp + vboxsoap_CXXFLAGS += \ + $(VBOX_GCC_Wno-vla) endif vboxsoap_CLEAN := $(vboxsoap_SOURCES) # lazy bird vboxsoap_SOURCES += \ @@ -331,6 +336,7 @@ VBOX_JWSDOC_JAR = $(VBoxJWs-inst-jar_0_OUTDIR)/vboxjws-doc.jar VBOX_JWSSRC_JAR = $(VBoxJWs-inst-jar_0_OUTDIR)/vboxjws-src.jar VBOX_JWS_TARGET := $(PATH_TARGET)/vboxjws-gen VBOX_JWS_GEN = $(VBOX_JWS_TARGET)/jwsgen +VBOX_JWS_GEN_RAWSRC = $(VBOX_JWS_GEN)/merged.file VBOX_JWS_JDEST := $(VBOX_JWS_TARGET)/jdest VBOX_JWSDOC_JDEST := $(VBOX_JWS_TARGET)/jdest-doc VBOX_GLUE_XSLT_DIR := $(PATH_ROOT)/src/VBox/Main/glue @@ -362,27 +368,58 @@ VBoxJWs-inst-jar_CLEAN = \ $(VBOX_JWSDOC_JDEST)/*/*/*/*.html \ ) VBoxJWs-inst-jar_BLDDIRS += $(VBOX_JWS_GEN)/java +VBoxJWs-inst-jar_GENERATEDSOURCES = $(addprefix $(VBoxJWs-inst-jar_BLDDIRS)/,$(VBoxJWS_VBOX_JWSGLUEFILES)) + +VBoxJWSGlue_KMK = $(PATH_OUT)/vboxjwsglue.kmk +include $(VBoxJWSGlue_KMK) -$(VBOX_JWS_GEN)/jwsglue.list: \ +$(VBoxJWSGlue_KMK).ts +| $(VBoxJWSGlue_KMK): $(VBOXWEB_IDL_SRC_ORIG) $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl + $(call MSG_GENERATE,,$(VBoxJWSGlue_KMK)) + $(QUIET)$(RM) -f $@ + $(QUIET)$(MKDIR) -p $(@D) + $(QUIET)$(VBOX_XSLTPROC) \ + --stringparam filelistonly VBoxJWS_VBOX_JWSGLUEFILES \ + --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \ + --stringparam G_vboxGlueStyle jaxws \ + --stringparam G_vboxDirPrefix org/virtualbox$(VBOX_API_SUFFIX)/ \ + -o $@ $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $< + $(QUIET)$(CP) --changed -fv $@ $(VBoxJWSGlue_KMK) + +$(VBOX_JWS_GEN_RAWSRC) \ ++| $(VBoxJWs-inst-jar_GENERATEDSOURCES): \ $(VBOXWEB_IDL_SRC_ORIG) \ $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl \ - $(VBOX_FILESPLIT) \ - $(VBOXWEBSERVICE_WSDL) \ - $(VBOXWEB_WSDL) \ - | $(VBOX_JWS_GEN)/java/ + $(VBOX_FILESPLIT) $(call MSG_L1,Generating JAX-WS Java glue files from XIDL) - $(QUIET)$(RM) -f $(wildcard $(VBOX_JWS_GEN)/java/*/*/*.java) $(wildcard $(VBOX_JWS_GEN)/java/*/*/*/*.java) + $(QUIET)$(RM) -f $(filter-out $(VBoxJWs-inst-jar_GENERATEDSOURCES),$(wildcard $(VBOX_JWS_GEN)/java/*/*/*.java)) + $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(VBOX_XSLTPROC) \ + --stringparam filelistonly "" \ --stringparam G_vboxApiSuffix $(VBOX_API_SUFFIX) \ --stringparam G_vboxGlueStyle jaxws \ --stringparam G_vboxDirPrefix org/virtualbox$(VBOX_API_SUFFIX)/ \ - -o $(VBOX_JWS_GEN)/merged.file $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $< + -o $(VBOX_JWS_GEN_RAWSRC) $(VBOX_GLUE_XSLT_DIR)/glue-java.xsl $< $(QUIET)$(MKDIR) -p $(VBOX_JWS_GEN)/java/org/virtualbox$(VBOX_API_SUFFIX) - $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JWS_GEN)/merged.file $(VBOX_JWS_GEN)/java - $(call MSG_GENERATE,,$@,JAX-WS for Java 1.6 bindings using $(VBOXWEBSERVICE_WSDL)) + $(QUIET)$(VBOX_FILESPLIT) $(VBOX_JWS_GEN_RAWSRC) $(VBOX_JWS_GEN)/java + +## @todo somehow also find out the authoritative list of files generated by +# wsimport (before running it), then we could rely on proper dependencies +# instead of creating jwsglue.list. Would allow avoiding a lot of unnecessary +# compilation with incremental builds, when almost nothing changed in the IDL +# file. Currently everything is recompiled if only one file is changed. +$(VBOX_JWS_GEN)/jwsglue.list.ts +| $(VBOX_JWS_GEN)/jwsglue.list: \ + $(VBOXWEB_IDL_SRC) \ + $(VBOX_FILESPLIT) \ + $(VBOXWEBSERVICE_WSDL) \ + $(VBOXWEB_WSDL) \ + $(VBoxJWs-inst-jar_GENERATEDSOURCES) \ + | $(VBOX_JWS_GEN)/java/ + $(QUIET)$(RM) -f $(wildcard $(VBOX_JWS_GEN)/java/*/*/*/*.java) + $(call MSG_GENERATE,,$(VBOX_JWS_GEN)/jwsglue.list,JAX-WS for Java 1.6 bindings using $(VBOXWEBSERVICE_WSDL)) $(VBOX_WSIMPORT) -Xnocompile -p $(VBOX_JAVA_PACKAGE).jaxws -d $(VBOX_JWS_GEN)/java $(VBOXWEBSERVICE_WSDL) - $(QUIET)echo $(VBOX_JWS_GEN)/java/*/*/*.java > $@ + $(QUIET)echo $(VBoxJWs-inst-jar_GENERATEDSOURCES) > $@ $(QUIET)echo $(VBOX_JWS_GEN)/java/*/*/*/*.java >> $@ + $(QUIET)$(CP) --changed -fv $@ $(VBOX_JWS_GEN)/jwsglue.list $$(VBOX_JWS_JAR): $(VBOX_JWS_GEN)/jwsglue.list $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $(VBOX_JWS_GEN)/MANIFEST.MF | $$(dir $$@) $(call MSG_TOOL,javac,$(notdir $@),jwsgen.list,) @@ -483,7 +520,7 @@ $$(VBOX_JWSSRC_JAR): $$(VBOX_JWS_JAR) | $$(dir $$@) endif # VBOX_GSOAP_INSTALLED -ifdef VBOX_ONLY_SDK +if defined(VBOX_ONLY_SDK) && "$(KBUILD_TARGET)" != "win" # # Globals relevant to the SDK. # @@ -495,12 +532,6 @@ ifdef VBOX_ONLY_SDK VBOXWEB_JAXWSSAMPLE = $(VBOXWEB_SAMPLES_JAXWS_DIR)/clienttest.java VBOXWEB_METRICSAMPLE = $(VBOXWEB_SAMPLES_JAXWS_DIR)/metrictest.java - VBOXWEB_GLUE_JAVA_TMP = $(VBOXWEB_OUT_DIR)/glue-jaxws.java.tmp - VBOXWEB_PATH_SDK_GLUE_JAVA = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/src - VBOXWEB_JAVALIB = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/lib - VBOXWEB_JAVA15_JAR = $(VBOXWEB_JAVALIB)/vboxws_java15.jar - VBOXWEB_JAVA16_JAR = $(VBOXWEB_JAVALIB)/vboxws_java16.jar - define find_java_files $(shell find $(1) -name \*.java) endef @@ -533,12 +564,14 @@ ifdef VBOX_ONLY_SDK samples/python/Makefile.glue=>python/lib/Makefile \ $(PATH_ROOT)/COPYING.LIB=>java/jax-ws/COPYING.LIB -endif # VBOX_ONLY_SDK + INSTALLS += vboxwebinst_wsdl + vboxwebinst_wsdl_INST = $(INST_SDK)bindings/webservice/ + vboxwebinst_wsdl_MODE = a+r,u+w + vboxwebinst_wsdl_SOURCES = \ + $(VBOXWEB_WSDL)=>vboxweb.wsdl \ + $(VBOXWEBSERVICE_WSDL)=>vboxwebService.wsdl -## @todo VBOXWEB_WSDL and VBOXWEBSERVICE_WSDL should be an install target. -VBOXWEB_OTHERS += \ - $(VBOXWEB_WSDL) \ - $(VBOXWEBSERVICE_WSDL) +endif # VBOX_ONLY_SDK # # Update the OTHERS and OTHER_CLEAN lists with VBOXWEB_OTHERS and some more stuff. @@ -549,6 +582,8 @@ VBOXWEB_OTHERS += \ OTHERS += $(VBOXWEB_OTHERS) OTHER_CLEAN += \ $(VBOXWEB_OTHERS) \ + $(VBOXWEB_WSDL) \ + $(VBOXWEBSERVICE_WSDL) \ $(VBOXWEB_TYPEMAP) \ $(VBOXWEB_IDL_SRC) @@ -559,16 +594,14 @@ $(VBOXWEB_IDL_SRC): $(VBOXWEB_IDL_SRC_STRIPPED) $(VBOX_PATH_WEBSERVICE)/platform $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/platform-xidl.xsl $< # generate WSDL from main XIDL file -$(VBOXWEB_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) ## @todo | $$(dir $$@) +$(VBOXWEB_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-wsdl.xsl) $(QUIET)$(RM) -f -- $@ - $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl.xsl $< -$(VBOXWEBSERVICE_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl-service.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) ## @todo | $$(dir $$@) +$(VBOXWEBSERVICE_WSDL): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl-service.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-wsdl-service.xsl) $(QUIET)$(RM) -f -- $@ - $(QUIET)$(MKDIR) -p $(@D) $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl-service.xsl $< ifdef VBOX_ONLY_SDK @@ -584,7 +617,7 @@ $(VBOXWEB_WS_PYTHON): $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $(QUIET)$(RM) -f -- $@ $(QUIET)$(MKDIR) -p $(@D) # Try both w/o and with --file option - $(QUIET)$(REDIRECT) -C $(@D) -- bash -c "$(VBOX_WSDL2PY) -b $(VBOXWEBSERVICE_WSDL) || $(VBOX_WSDL2PY) -b --file $(VBOXWEBSERVICE_WSDL)" + $(QUIET)$(REDIRECT) -C $(@D) -- $(SHELL) -c "$(VBOX_WSDL2PY) -b $(VBOXWEBSERVICE_WSDL) || $(VBOX_WSDL2PY) -b --file $(VBOXWEBSERVICE_WSDL)" $(QUIET)$(APPEND) $@ '' $(VBOXWEB_WS_PERL): $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) @@ -605,19 +638,19 @@ $(VBOXWEB_WS_PHP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-php.xsl endif # VBOX_ONLY_SDK # generate typemap.dat (used by wsdl2h) from main XIDL file -$(VBOXWEB_TYPEMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-typemap.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) +$(VBOXWEB_TYPEMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-typemap.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-typemap.xsl) $(QUIET)$(RM) -f -- $@ $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-typemap.xsl $< # generate gsoap pseudo-C header file from that WSDL; once via XSLT... -$(VBOXWEB_GSOAPH_FROM_XSLT): $(VBOXWEB_WSDL) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl2gsoapH.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) +$(VBOXWEB_GSOAPH_FROM_XSLT): $(VBOXWEB_WSDL) $(VBOX_PATH_WEBSERVICE)/websrv-wsdl2gsoapH.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_WSDL) using websrv-wsdl2gsoapH.xsl) $(QUIET)$(RM) -f -- $@ $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-wsdl2gsoapH.xsl $< VBOX_NSMAP = $(VBOXWEB_OUT_DIR)/vboxwebsrv.nsmap -$(VBOX_NSMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-nsmap.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) +$(VBOX_NSMAP): $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-nsmap.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-nsmap.xsl) $(QUIET)$(RM) -f -- $@ $(QUIET)$(VBOX_XSLTPROC) $(VBOXWEB_XSLTPROC_VERBOSE) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-nsmap.xsl $< @@ -710,14 +743,14 @@ endif # VBOX_GSOAP_INSTALLED # generate method maps in server: map wsdl operations to com/xpcom method calls -$(VBOXWEB_OUT_DIR)/methodmaps.cpp: $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-cpp.xsl $(VBOX_PATH_WEBSERVICE)/websrv-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) +$(VBOXWEB_OUT_DIR)/methodmaps.cpp: $(VBOXWEB_IDL_SRC) $(VBOX_PATH_WEBSERVICE)/websrv-cpp.xsl $(VBOX_PATH_IDL)/typemap-shared.inc.xsl $(RECOMPILE_ON_MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_GENERATE,,$@,$(VBOXWEB_IDL_SRC) using websrv-cpp.xsl) $(QUIET)$(VBOX_XSLTPROC) -o $@ $(VBOX_PATH_WEBSERVICE)/websrv-cpp.xsl $< # generate C file which contains vboxweb.wsdl $$(VBOXWEB_OUT_DIR)/vboxweb-wsdl.c: $(VBOXWEB_WSDL) $(VBOX_BIN2C) $(call MSG_TOOL,bin2c,vboxweb-wsdl,$<,$@) - $(QUIET)$(VBOX_BIN2C) -export -ascii VBoxWebWSDL $< $@ + $(QUIET)$(VBOX_BIN2C) -ascii VBoxWebWSDL $< $@ ifdef VBOX_ONLY_SDK diff --git a/src/VBox/Main/webservice/platform-xidl.xsl b/src/VBox/Main/webservice/platform-xidl.xsl index 48dce42a..066a5fe9 100644 --- a/src/VBox/Main/webservice/platform-xidl.xsl +++ b/src/VBox/Main/webservice/platform-xidl.xsl @@ -8,7 +8,7 @@ is identical to the original except that all <if...> sections are resolved (for easier processing). - Copyright (C) 2006-2011 Oracle Corporation + Copyright (C) 2006-2012 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/samples/java/jax-ws/Makefile b/src/VBox/Main/webservice/samples/java/jax-ws/Makefile index fd8d7921..97cbb6ed 100644 --- a/src/VBox/Main/webservice/samples/java/jax-ws/Makefile +++ b/src/VBox/Main/webservice/samples/java/jax-ws/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2008 Oracle Corporation +# Copyright (C) 2008-2010 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/samples/java/jax-ws/Makefile.glue b/src/VBox/Main/webservice/samples/java/jax-ws/Makefile.glue index c7aea553..2a9f95bc 100644 --- a/src/VBox/Main/webservice/samples/java/jax-ws/Makefile.glue +++ b/src/VBox/Main/webservice/samples/java/jax-ws/Makefile.glue @@ -1,5 +1,5 @@ # -# Copyright (C) 2008 Oracle Corporation +# Copyright (C) 2008-2010 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/samples/php/clienttest.php b/src/VBox/Main/webservice/samples/php/clienttest.php index 648662c4..3b6d8051 100644 --- a/src/VBox/Main/webservice/samples/php/clienttest.php +++ b/src/VBox/Main/webservice/samples/php/clienttest.php @@ -57,7 +57,7 @@ foreach ($machines as $machine) { $console = $session->console; $display = $console->display; - list($screenWidth, $screenHeight, $screenBpp) = $display->getScreenResolution(0 /* First screen */); + list($screenWidth, $screenHeight, $screenBpp, $screenX, $screenY) = $display->getScreenResolution(0 /* First screen */); $imageraw = $display->takeScreenShotToArray(0 /* First screen */, $screenWidth, $screenHeight); echo "Screenshot size: " . sizeof($imageraw) . "\n"; diff --git a/src/VBox/Main/webservice/samples/python/Makefile b/src/VBox/Main/webservice/samples/python/Makefile index 7aa5cb3b..5e8a15bb 100644 --- a/src/VBox/Main/webservice/samples/python/Makefile +++ b/src/VBox/Main/webservice/samples/python/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2008 Oracle Corporation +# Copyright (C) 2008-2010 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/samples/python/Makefile.glue b/src/VBox/Main/webservice/samples/python/Makefile.glue index 8465ca7b..102d5fb4 100644 --- a/src/VBox/Main/webservice/samples/python/Makefile.glue +++ b/src/VBox/Main/webservice/samples/python/Makefile.glue @@ -1,5 +1,5 @@ # -# Copyright (C) 2008 Oracle Corporation +# Copyright (C) 2008-2010 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/samples/python/clienttest.py b/src/VBox/Main/webservice/samples/python/clienttest.py index 50e5d103..bcb2b815 100755 --- a/src/VBox/Main/webservice/samples/python/clienttest.py +++ b/src/VBox/Main/webservice/samples/python/clienttest.py @@ -37,6 +37,7 @@ def enumToString(constants, enum, elem): def main(argv): from vboxapi import VirtualBoxManager + # This is a VirtualBox COM/XPCOM API client, no data needed. wrapper = VirtualBoxManager(None, None) # Get the VirtualBox manager @@ -50,12 +51,27 @@ def main(argv): vboxConstants = wrapper.constants # Enumerate all defined machines - for mach in vbox.machines: + for mach in wrapper.getArray(vbox, 'machines'): try: - - # Print some basic information - print "Machine name: %s [%s]" %(mach.name,mach.id) + # Be prepared for failures - the VM can be inaccessible + vmname = '<inaccessible>' + try: + vmname = mach.name + except Exception, e: + None + vmid = ''; + try: + vmid = mach.id + except Exception, e: + None + + # Print some basic VM information even if there were errors + print "Machine name: %s [%s]" %(vmname,vmid) + if vmname == '<inaccessible>' or vmid == '': + continue + + # Print some basic VM information print " State: %s" %(enumToString(vboxConstants, "MachineState", mach.state)) print " Session state: %s" %(enumToString(vboxConstants, "SessionState", mach.sessionState)) @@ -82,10 +98,10 @@ def main(argv): # Get the VM's display object display = console.display - # Get the VM's current display resolution + bit depth + # Get the VM's current display resolution + bit depth + position screenNum = 0 # From first screen - (screenX, screenY, screenBPP) = display.getScreenResolution(screenNum) - print " Display (%d): %dx%d, %d BPP" %(screenNum, screenX, screenY, screenBPP) + (screenW, screenH, screenBPP, screenX, screenY) = display.getScreenResolution(screenNum) + print " Display (%d): %dx%d, %d BPP at %d,%d" %(screenNum, screenW, screenH, screenBPP, screenX, screenY) # We're done -- don't forget to unlock the machine! session.unlockMachine() diff --git a/src/VBox/Main/webservice/split-soapC.cpp b/src/VBox/Main/webservice/split-soapC.cpp index 10f5ee1b..d491235b 100644 --- a/src/VBox/Main/webservice/split-soapC.cpp +++ b/src/VBox/Main/webservice/split-soapC.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/webservice/vboxweb.cpp b/src/VBox/Main/webservice/vboxweb.cpp index 33394f21..5debb965 100644 --- a/src/VBox/Main/webservice/vboxweb.cpp +++ b/src/VBox/Main/webservice/vboxweb.cpp @@ -5,7 +5,7 @@ * (plus static gSOAP server code) to implement the actual webservice * server, to which clients can connect. * - * Copyright (C) 2007-2012 Oracle Corporation + * Copyright (C) 2007-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -25,8 +25,8 @@ #include <VBox/com/string.h> #include <VBox/com/ErrorInfo.h> #include <VBox/com/errorprint.h> -#include <VBox/com/EventQueue.h> #include <VBox/com/listeners.h> +#include <VBox/com/NativeEventQueue.h> #include <VBox/VBoxAuth.h> #include <VBox/version.h> #include <VBox/log.h> @@ -72,8 +72,8 @@ RT_C_DECLS_BEGIN // declarations for the generated WSDL text -extern DECLIMPORT(const unsigned char) g_abVBoxWebWSDL[]; -extern DECLIMPORT(const unsigned) g_cbVBoxWebWSDL; +extern const unsigned char g_abVBoxWebWSDL[]; +extern const unsigned g_cbVBoxWebWSDL; RT_C_DECLS_END @@ -450,9 +450,9 @@ public: * first call or when all existing threads are busy. * @param s Socket from soap_accept() which has work to do. */ - uint32_t add(int s) + size_t add(SOAP_SOCKET s) { - uint32_t cItems; + size_t cItems; util::AutoWriteLock qlock(m_mutex COMMA_LOCKVAL_SRC_POS); // if no threads have yet been created, or if all threads are busy, @@ -492,7 +492,7 @@ public: * @param cThreads out: total no. of SOAP threads running * @return */ - int get(size_t &cIdleThreads, size_t &cThreads) + SOAP_SOCKET get(size_t &cIdleThreads, size_t &cThreads) { while (1) { @@ -502,7 +502,7 @@ public: util::AutoWriteLock qlock(m_mutex COMMA_LOCKVAL_SRC_POS); if (m_llSocketsQ.size()) { - int socket = m_llSocketsQ.front(); + SOAP_SOCKET socket = m_llSocketsQ.front(); m_llSocketsQ.pop_front(); cIdleThreads = --m_cIdleThreads; cThreads = m_llAllThreads.size(); @@ -542,7 +542,7 @@ public: // A std::list abused as a queue; this contains the actual jobs to do, // each int being a socket from soap_accept() - std::list<int> m_llSocketsQ; + std::list<SOAP_SOCKET> m_llSocketsQ; }; /** @@ -731,7 +731,7 @@ struct CRYPTO_dynlock_value static unsigned long CRYPTO_id_function() { - return RTThreadNativeSelf(); + return (unsigned long)RTThreadNativeSelf(); } static void CRYPTO_locking_function(int mode, int n, const char * /*file*/, int /*line*/) @@ -855,7 +855,7 @@ void doQueuesLoop() soap.bind_flags |= SO_REUSEADDR; // avoid EADDRINUSE on bind() - int m, s; // master and slave sockets + SOAP_SOCKET m, s; // master and slave sockets m = soap_bind(&soap, g_pcszBindToHost ? g_pcszBindToHost : "localhost", // safe default host g_uBindToPort, // port @@ -1231,7 +1231,7 @@ int main(int argc, char *argv[]) return RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot start watchdog thread: %Rrc", rc); } - com::EventQueue *pQ = com::EventQueue::getMainEventQueue(); + com::NativeEventQueue *pQ = com::NativeEventQueue::getMainEventQueue(); for (;;) { // we have to process main event queue @@ -1436,60 +1436,85 @@ std::string Base64EncodeByteArray(ComSafeArrayIn(BYTE, aData)) return aStr.c_str(); } -#define DECODE_STR_MAX 0x100000 -void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData)) + +#define DECODE_STR_MAX _1M +void Base64DecodeByteArray(struct soap *soap, const std::string& aStr, ComSafeArrayOut(BYTE, aData), const WSDLT_ID &idThis, const char *pszMethodName, IUnknown *pObj, const com::Guid &iid) { const char* pszStr = aStr.c_str(); ssize_t cbOut = RTBase64DecodedSize(pszStr, NULL); - if(cbOut > DECODE_STR_MAX) + if (cbOut > DECODE_STR_MAX) { WebLog("Decode string too long.\n"); - RaiseSoapRuntimeFault(soap, VERR_BUFFER_OVERFLOW, (ComPtr<IUnknown>)NULL); + RaiseSoapRuntimeFault(soap, idThis, pszMethodName, E_INVALIDARG, pObj, iid); } com::SafeArray<BYTE> result(cbOut); int rc = RTBase64Decode(pszStr, result.raw(), cbOut, NULL, NULL); if (FAILED(rc)) { - WebLog("String Decoding Failed. ERROR: 0x%lX\n", rc); - RaiseSoapRuntimeFault(soap, rc, (ComPtr<IUnknown>)NULL); + WebLog("String Decoding Failed. Error code: %Rrc\n", rc); + RaiseSoapRuntimeFault(soap, idThis, pszMethodName, E_INVALIDARG, pObj, iid); } result.detachTo(ComSafeArrayOutArg(aData)); } /** - * Raises a SOAP runtime fault. Implementation for the RaiseSoapRuntimeFault template - * function in vboxweb.h. + * Raises a SOAP runtime fault. * + * @param soap + * @param idThis + * @param pcszMethodName + * @param apirc * @param pObj + * @param iid */ -void RaiseSoapRuntimeFault2(struct soap *soap, - HRESULT apirc, - IUnknown *pObj, - const com::Guid &iid) +void RaiseSoapRuntimeFault(struct soap *soap, + const WSDLT_ID &idThis, + const char *pcszMethodName, + HRESULT apirc, + IUnknown *pObj, + const com::Guid &iid) { com::ErrorInfo info(pObj, iid.ref()); WEBDEBUG((" error, raising SOAP exception\n")); - WebLog("API return code: 0x%08X (%Rhrc)\n", apirc, apirc); - WebLog("COM error info result code: 0x%lX\n", info.getResultCode()); - WebLog("COM error info text: %ls\n", info.getText().raw()); + WebLog("API method name: %s\n", pcszMethodName); + WebLog("API return code: %#10lx (%Rhrc)\n", apirc, apirc); + if (info.isFullAvailable() || info.isBasicAvailable()) + { + const com::ErrorInfo *pInfo = &info; + do + { + WebLog("COM error info result code: %#10lx (%Rhrc)\n", pInfo->getResultCode(), pInfo->getResultCode()); + WebLog("COM error info text: %ls\n", pInfo->getText().raw()); - // allocated our own soap fault struct - _vbox__RuntimeFault *ex = soap_new__vbox__RuntimeFault(soap, 1); - // some old vbox methods return errors without setting an error in the error info, - // so use the error info code if it's set and the HRESULT from the method otherwise - if (S_OK == (ex->resultCode = info.getResultCode())) - ex->resultCode = apirc; - ex->text = ConvertComString(info.getText()); - ex->component = ConvertComString(info.getComponent()); - ex->interfaceID = ConvertComString(info.getInterfaceID()); + pInfo = pInfo->getNext(); + } + while (pInfo); + } // compose descriptive message - com::Utf8StrFmt str("VirtualBox error: %s (0x%lX)", ex->text.c_str(), ex->resultCode); + com::Utf8Str str = com::Utf8StrFmt("VirtualBox error: rc=%#lx", apirc); + if (info.isFullAvailable() || info.isBasicAvailable()) + { + const com::ErrorInfo *pInfo = &info; + do + { + str += com::Utf8StrFmt(" %ls (%#lx)", pInfo->getText().raw(), pInfo->getResultCode()); + pInfo = pInfo->getNext(); + } + while (pInfo); + } + + // allocate our own soap fault struct + _vbox__RuntimeFault *ex = soap_new__vbox__RuntimeFault(soap, 1); + ComPtr<IVirtualBoxErrorInfo> pVirtualBoxErrorInfo; + info.getVirtualBoxErrorInfo(pVirtualBoxErrorInfo); + ex->resultCode = apirc; + ex->returnval = createOrFindRefFromComPtr(idThis, "IVirtualBoxErrorInfo", pVirtualBoxErrorInfo); RaiseSoapFault(soap, str.c_str(), @@ -1680,7 +1705,11 @@ int WebServiceSession::authenticate(const char *pcszUsername, RTLDRMOD hlibAuth = 0; do { - rc = RTLdrLoad(filename.c_str(), &hlibAuth); + if (RTPathHavePath(filename.c_str())) + rc = RTLdrLoad(filename.c_str(), &hlibAuth); + else + rc = RTLdrLoadAppPriv(filename.c_str(), &hlibAuth); + if (RT_FAILURE(rc)) { WEBDEBUG(("%s() Failed to load external authentication library. Error code: %Rrc\n", __FUNCTION__, rc)); @@ -1765,7 +1794,7 @@ int WebServiceSession::authenticate(const char *pcszUsername, if (g_fVerbose) { ISession *p = session; - WEBDEBUG((" * %s: created session object with comptr 0x%lX, MOR = %s\n", __FUNCTION__, p, _pISession->getWSDLID().c_str())); + WEBDEBUG((" * %s: created session object with comptr %#p, MOR = %s\n", __FUNCTION__, p, _pISession->getWSDLID().c_str())); } } while (0); } @@ -1793,12 +1822,12 @@ ManagedObjectRef* WebServiceSession::findRefFromPtr(const IUnknown *pObject) Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread()); uintptr_t ulp = (uintptr_t)pObject; - // WEBDEBUG((" %s: looking up 0x%lX\n", __FUNCTION__, ulp)); + // WEBDEBUG((" %s: looking up %#lx\n", __FUNCTION__, ulp)); ManagedObjectsMapByPtr::iterator it = _pp->_mapManagedObjectsByPtr.find(ulp); if (it != _pp->_mapManagedObjectsByPtr.end()) { ManagedObjectRef *pRef = it->second; - WEBDEBUG((" %s: found existing ref %s (%s) for COM obj 0x%lX\n", __FUNCTION__, pRef->getWSDLID().c_str(), pRef->getInterfaceName(), ulp)); + WEBDEBUG((" %s: found existing ref %s (%s) for COM obj %#lx\n", __FUNCTION__, pRef->getWSDLID().c_str(), pRef->getInterfaceName(), ulp)); return pRef; } @@ -1933,7 +1962,7 @@ ManagedObjectRef::ManagedObjectRef(WebServiceSession &session, session.touch(); - 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", + WEBDEBUG((" * %s: MOR created for %s*=%#p (IUnknown*=%#p; COM refcount now %RI32/%RI32), new ID is %llX; now %lld objects total\n", __FUNCTION__, pcszInterface, pobjInterface, @@ -2082,7 +2111,7 @@ int __vbox__IManagedObjectRef_USCOREgetInterfaceName( } while (0); - WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc)); + WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); if (FAILED(rc)) return SOAP_FAULT; return SOAP_OK; @@ -2126,7 +2155,7 @@ int __vbox__IManagedObjectRef_USCORErelease( delete pRef; } while (0); - WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc)); + WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); if (FAILED(rc)) return SOAP_FAULT; return SOAP_OK; @@ -2214,7 +2243,7 @@ int __vbox__IWebsessionManager_USCORElogon( rc = E_FAIL; } while (0); - WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc)); + WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); if (FAILED(rc)) return SOAP_FAULT; return SOAP_OK; @@ -2243,7 +2272,7 @@ int __vbox__IWebsessionManager_USCOREgetSessionObject( } while (0); - WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc)); + WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); if (FAILED(rc)) return SOAP_FAULT; return SOAP_OK; @@ -2280,7 +2309,7 @@ int __vbox__IWebsessionManager_USCORElogoff( } } while (0); - WEBDEBUG(("-- leaving %s, rc: 0x%lX\n", __FUNCTION__, rc)); + WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc)); if (FAILED(rc)) return SOAP_FAULT; return SOAP_OK; diff --git a/src/VBox/Main/webservice/vboxweb.h b/src/VBox/Main/webservice/vboxweb.h index 0309c393..7cc2f55a 100644 --- a/src/VBox/Main/webservice/vboxweb.h +++ b/src/VBox/Main/webservice/vboxweb.h @@ -2,7 +2,7 @@ * vboxweb.h: * header file for "real" web server code. * - * Copyright (C) 2006-2011 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -71,20 +71,7 @@ extern const WSDLT_ID g_EmptyWSDLID; void RaiseSoapInvalidObjectFault(struct soap *soap, WSDLT_ID obj); -void RaiseSoapRuntimeFault2(struct soap *soap, HRESULT apirc, IUnknown *pObj, const com::Guid &iid); - -/** - * Template function called everywhere from methodmaps.cpp which calls - * RaiseSoapRuntimeFault2() with the correct COM interface ID. - * @param soap - * @param apirc - * @param pObj - */ -template <class T> -void RaiseSoapRuntimeFault(struct soap *soap, HRESULT apirc, const ComPtr<T> &pObj) -{ - RaiseSoapRuntimeFault2(soap, apirc, pObj, COM_IIDOF(T)); -} +void RaiseSoapRuntimeFault(struct soap *soap, const WSDLT_ID &idThis, const char *pcszMethodName, HRESULT apirc, IUnknown *pObj, const com::Guid &iid); /**************************************************************************** * @@ -98,7 +85,7 @@ std::string ConvertComString(const com::Guid &bstr); std::string Base64EncodeByteArray(ComSafeArrayIn(BYTE, aData)); -void Base64DecodeByteArray(struct soap *soap, std::string& aStr, ComSafeArrayOut(BYTE, aData)); +void Base64DecodeByteArray(struct soap *soap, const std::string& aStr, ComSafeArrayOut(BYTE, aData), const WSDLT_ID &idThis, const char *pszMethodName, IUnknown *pObj, const com::Guid &iid); /**************************************************************************** * * managed object reference classes diff --git a/src/VBox/Main/webservice/websrv-cpp.xsl b/src/VBox/Main/webservice/websrv-cpp.xsl index 1700e5af..32372e77 100644 --- a/src/VBox/Main/webservice/websrv-cpp.xsl +++ b/src/VBox/Main/webservice/websrv-cpp.xsl @@ -11,7 +11,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2007-2012 Oracle Corporation + Copyright (C) 2007-2014 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -39,7 +39,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-cpp.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- collect all interfaces with "wsmap='suppress'" in a global variable for quick lookup --> @@ -65,7 +65,6 @@ #include <VBox/com/array.h> #include <VBox/com/ErrorInfo.h> #include <VBox/com/errorprint.h> -#include <VBox/com/EventQueue.h> #include <VBox/VBoxAuth.h> #include <iprt/assert.h> @@ -86,7 +85,7 @@ const char *g_pcszDoneCallingComMethod = " done calling COM method\n"; const char *g_pcszConvertComOutputBack = " convert COM output \"%s\" back to caller format\n"; const char *g_pcszDoneConvertingComOutputBack = " done converting COM output \"%s\" back to caller format\n"; const char *g_pcszEntering = "-- entering %s\n"; -const char *g_pcszLeaving = "-- leaving %s, rc: 0x%lX (%d)\n"; +const char *g_pcszLeaving = "-- leaving %s, rc: %#lx (%d)\n"; // generated string constants for all interface names const char *g_pcszIUnknown = "IUnknown"; @@ -273,17 +272,19 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:call-template name="emitNewline" /> <xsl:for-each select="//interface[@name=$structname]/attribute"> - <xsl:value-of select="concat(' // -- ', $structname, '.', @name)" /> - <xsl:call-template name="emitNewline" /> - <!-- recurse! --> - <xsl:call-template name="emitGetAttributeComCall"> - <xsl:with-param name="ifname" select="$structname" /> - <xsl:with-param name="object" select="'in'" /> - <xsl:with-param name="attrname" select="@name" /> - <xsl:with-param name="attrtype" select="@type" /> - <xsl:with-param name="callerprefix" select="concat('out', '.')" /> - </xsl:call-template> - <xsl:call-template name="emitNewline" /> + <xsl:if test="not(@wsmap = 'suppress')"> + <xsl:value-of select="concat(' // -- ', $structname, '.', @name)" /> + <xsl:call-template name="emitNewline" /> + <!-- recurse! --> + <xsl:call-template name="emitGetAttributeComCall"> + <xsl:with-param name="ifname" select="$structname" /> + <xsl:with-param name="object" select="'in'" /> + <xsl:with-param name="attrname" select="@name" /> + <xsl:with-param name="attrtype" select="@type" /> + <xsl:with-param name="callerprefix" select="concat('out', '.')" /> + </xsl:call-template> + <xsl:call-template name="emitNewline" /> + </xsl:if> </xsl:for-each> <xsl:call-template name="emitEpilogue"><xsl:with-param name="fSkipHRESULT" select="'1'"/></xsl:call-template> @@ -360,7 +361,7 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls --> <xsl:param name="inptr" /> <!-- whether to add INPTR to BSTR (Dmitry template magic) --> - <!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl --> + <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl --> <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" /> <xsl:choose> @@ -533,7 +534,10 @@ const char *g_pcszIUnknown = "IUnknown"; so we can then pass them to the actual COM method call. --> <xsl:template name="emitInputArgConverter"> + <xsl:param name="ifname" /> + <xsl:param name="object" /> <!-- normally "pObj" --> <xsl:param name="method" /> + <xsl:param name="methodname" /> <xsl:param name="structprefix" /> <!-- with WSDL document style: req element prefix, like "vbox__IVirtualBox_USCOREcreateMachineRequestElement->" --> <xsl:param name="name" /> <xsl:param name="type" /> @@ -546,7 +550,7 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:when test="$safearray='yes' and $type='octet'"> <xsl:value-of select="concat('com::SafeArray<BYTE> comcall_',$name, ';')" /> <xsl:call-template name="emitNewlineIndent8" /> - <xsl:value-of select="concat('Base64DecodeByteArray(soap, ',$structprefix,$name,', ComSafeArrayAsOutParam(comcall_',$name, '));')" /> + <xsl:value-of select="concat('Base64DecodeByteArray(soap, ',$structprefix,$name,', ComSafeArrayAsOutParam(comcall_',$name, '), idThis, "', $ifname, '::', $methodname, '", ', $object, ', COM_IIDOF(', $ifname, '));')" /> </xsl:when> <xsl:when test="$safearray='yes'"> @@ -596,6 +600,10 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:call-template name="emitNewlineIndent8" /> <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" /> </xsl:when> + <xsl:when test="$type='long long'"> + <xsl:call-template name="emitNewlineIndent8" /> + <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" /> + </xsl:when> <xsl:when test="$type='boolean'"> <xsl:call-template name="emitNewlineIndent8" /> <xsl:value-of select="concat(' comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" /> @@ -778,7 +786,8 @@ const char *g_pcszIUnknown = "IUnknown"; emits the actual method call with the arguments. --> <xsl:template name="emitComCall"> - <xsl:param name="object" /> <!-- normally "pObj->" --> + <xsl:param name="ifname" /> + <xsl:param name="object" /> <!-- normally "pObj" --> <xsl:param name="methodname" /> <xsl:param name="attrname" /> <!-- with attributes only --> <xsl:param name="attrtype" /> <!-- with attributes only --> @@ -786,14 +795,10 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:param name="attrdir" /> <!-- with attributes only: "in" or "return" --> <xsl:param name="varprefix" /> <!-- only with nested get-attribute calls --> - <xsl:variable name="comMethodName"> - <xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template> - </xsl:variable> - <xsl:call-template name="emitNewlineIndent8" /> - <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, "', $comMethodName, '"));')" /> + <xsl:value-of select="concat('WEBDEBUG((g_pcszCallingComMethod, "', $methodname, '"));')" /> <xsl:call-template name="emitNewlineIndent8" /> - <xsl:value-of select="concat('rc = ', $object, '->', $comMethodName, '(')" /> + <xsl:value-of select="concat('rc = ', $object, '->', $methodname, '(')" /> <xsl:if test="$attrtype"> <xsl:choose> <xsl:when test="$attrdir='in'"> @@ -856,7 +861,7 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:call-template name="emitNewlineIndent8" /> <xsl:text>{</xsl:text> <xsl:call-template name="emitNewlineIndent8" /> - <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, rc, ', $object, ');')" /> + <xsl:value-of select="concat(' RaiseSoapRuntimeFault(soap, idThis, "', $ifname, '::', $methodname,'", rc, ', $object, ', COM_IIDOF(', $ifname, '));')" /> <xsl:call-template name="emitNewlineIndent8" /> <xsl:text> break;</xsl:text> <xsl:call-template name="emitNewlineIndent8" /> @@ -984,7 +989,7 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:call-template name="emitNewlineIndent8" /> <xsl:value-of select="'{'" /> <xsl:call-template name="emitNewlineIndent8" /> - <!-- look up C++ glue type from IDL type from table array in websrv-shared.inc.xsl --> + <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl --> <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" /> <xsl:choose> <xsl:when test="//interface[@name=$type]"> @@ -1067,6 +1072,7 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable> <!-- actual COM method call --> <xsl:call-template name="emitComCall"> + <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="methodname" select="concat('COMGETTER(', $upperattrname, ')')" /> <xsl:with-param name="object" select="$object" /> <xsl:with-param name="attrname" select="$attrname" /> @@ -1102,13 +1108,17 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:variable name="upperattrname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable> <xsl:call-template name="emitInputArgConverter"> + <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="method" select="concat($ifname, '::', $settername)" /> + <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" /> + <xsl:with-param name="object" select="$object" /> <xsl:with-param name="name" select="$attrname" /> <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" /> <xsl:with-param name="type" select="$attrtype" /> <xsl:with-param name="safearray" select="$attrsafearray" /> </xsl:call-template> <xsl:call-template name="emitComCall"> + <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="methodname" select="concat('COMSETTER(', $upperattrname, ')')" /> <xsl:with-param name="object" select="$object" /> <xsl:with-param name="attrname" select="$attrname" /> @@ -1272,7 +1282,10 @@ const char *g_pcszIUnknown = "IUnknown"; <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" --> <xsl:choose> <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> - <xsl:value-of select="concat('// Skipping attribute ', $attrtype, ' for it is of suppressed type ', $attrtype)" /> + <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is of suppressed type ', $attrtype)" /> + </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:value-of select="concat('// Skipping attribute ', $attrname, ' for it is suppressed')" /> </xsl:when> <xsl:otherwise> <xsl:choose> @@ -1321,6 +1334,9 @@ const char *g_pcszIUnknown = "IUnknown"; or (param[@mod='ptr'])" > <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('Skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <xsl:variable name="fHasReturnParms" select="param[@dir='return']" /> <xsl:variable name="fHasOutParms" select="param[@dir='out']" /> @@ -1377,7 +1393,14 @@ const char *g_pcszIUnknown = "IUnknown"; <xsl:choose> <xsl:when test="$dir='in'"> <xsl:call-template name="emitInputArgConverter"> + <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="method" select="concat($ifname, '::', $methodname)" /> + <xsl:with-param name="methodname"> + <xsl:call-template name="capitalize"> + <xsl:with-param name="str" select="$methodname" /> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="object" select='"pObj"' /> <xsl:with-param name="structprefix" select="concat($G_requestElementVarName, '->')" /> <xsl:with-param name="name" select="@name" /> <xsl:with-param name="type" select="@type" /> @@ -1404,6 +1427,7 @@ const char *g_pcszIUnknown = "IUnknown"; </xsl:for-each> <!-- actual COM method call --> <xsl:call-template name="emitComCall"> + <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="object" select='"pObj"' /> <xsl:with-param name="methodname"> <xsl:call-template name="capitalize"> diff --git a/src/VBox/Main/webservice/websrv-nsmap.xsl b/src/VBox/Main/webservice/websrv-nsmap.xsl index d9524ea0..05b8e168 100644 --- a/src/VBox/Main/webservice/websrv-nsmap.xsl +++ b/src/VBox/Main/webservice/websrv-nsmap.xsl @@ -9,7 +9,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2006-2010 Oracle Corporation + Copyright (C) 2006-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -35,7 +35,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-typemap.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- - - - - - - - - - - - - - - - - - - - - - - root match diff --git a/src/VBox/Main/webservice/websrv-php.xsl b/src/VBox/Main/webservice/websrv-php.xsl index 28773502..42591dca 100644 --- a/src/VBox/Main/webservice/websrv-php.xsl +++ b/src/VBox/Main/webservice/websrv-php.xsl @@ -11,7 +11,7 @@ Contributed by James Lucas (mjlucas at eng.uts.edu.au). - Copyright (C) 2008-2010 Oracle Corporation + Copyright (C) 2008-2014 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -29,7 +29,7 @@ encoding="utf-8" indent="no"/> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <xsl:variable name="G_setSuppressedInterfaces" select="//interface[@wsmap='suppress']" /> @@ -119,17 +119,18 @@ <xsl:param name="attrtype" /> <xsl:param name="attrsafearray" /> <xsl:variable name="fname"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template> </xsl:variable> - public function <xsl:value-of select="$fname"/>() { - $request = new stdClass(); - $request->_this = $this->handle; - $response = $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request)); - <xsl:text>return </xsl:text> - <xsl:call-template name="emitOutParam"> - <xsl:with-param name="type" select="$attrtype" /> - <xsl:with-param name="value" select="concat('$response->','returnval')" /> - <xsl:with-param name="safearray" select="@safearray"/> - </xsl:call-template><xsl:text>;</xsl:text> - } + public function <xsl:value-of select="$fname"/>() + { + $request = new stdClass(); + $request->_this = $this->handle; + $response = $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request)); + <xsl:text>return </xsl:text> + <xsl:call-template name="emitOutParam"> + <xsl:with-param name="type" select="$attrtype" /> + <xsl:with-param name="value" select="concat('$response->','returnval')" /> + <xsl:with-param name="safearray" select="@safearray"/> + </xsl:call-template><xsl:text>;</xsl:text> + } </xsl:template> <xsl:template name="emitSetAttribute"> @@ -138,18 +139,23 @@ <xsl:param name="attrtype" /> <xsl:param name="attrsafearray" /> <xsl:variable name="fname"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname"/></xsl:call-template></xsl:variable> - public function <xsl:value-of select="$fname"/>($value) { - $request = new stdClass(); - $request->_this = $this->handle; - if (is_null($value) || is_scalar($value)) { + public function <xsl:value-of select="$fname"/>($value) + { + $request = new stdClass(); + $request->_this = $this->handle; +<xsl:choose> +<xsl:when test="$attrsafearray='yes'"> if (is_array($value) || is_null($value) || is_scalar($value))</xsl:when> +<xsl:otherwise> if (is_null($value) || is_scalar($value))</xsl:otherwise> +</xsl:choose> + { $request-><xsl:value-of select="$attrname"/> = $value; - } - else - { + } + else + { $request-><xsl:value-of select="$attrname"/> = $value->handle; - } - $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request)); - } + } + $this->connection->__soapCall('<xsl:value-of select="$ifname"/>_<xsl:value-of select="$fname"/>', array((array)$request)); + } </xsl:template> <xsl:template name="interface"> @@ -158,15 +164,15 @@ <xsl:variable name="extends"><xsl:value-of select="@extends" /></xsl:variable> <xsl:text> /** -* Generated VBoxWebService Interface Wrapper -*/ + * Generated VBoxWebService Interface Wrapper + */ </xsl:text> <xsl:choose> - <xsl:when test="($extends = '$unknown') or ($extends = '$dispatched') or ($extends = '$errorinfo')"> - <xsl:value-of select="concat('class ', $ifname, ' extends VBox_ManagedObject { ')" /> + <xsl:when test="($extends = '$unknown') or ($extends = '$errorinfo')"> + <xsl:value-of select="concat('class ', $ifname, ' extends VBox_ManagedObject { ')" /> </xsl:when> <xsl:when test="//interface[@name=$extends]"> - <xsl:value-of select="concat('class ', $ifname, ' extends ', $extends, ' { ')" /> + <xsl:value-of select="concat('class ', $ifname, ' extends ', $extends, ' { ')" /> </xsl:when> </xsl:choose> <xsl:for-each select="method"> @@ -181,6 +187,7 @@ <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable> <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable> <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable> + <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable> <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" --> <xsl:choose> <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> @@ -200,6 +207,7 @@ <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="attrname" select="$attrname" /> <xsl:with-param name="attrtype" select="$attrtype" /> + <xsl:with-param name="attrsafearray" select="$attrsafearray" /> </xsl:call-template> <!-- bb) emit a set method if the attribute is read/write --> <xsl:if test="not($attrreadonly='yes')"> @@ -207,23 +215,25 @@ <xsl:with-param name="ifname" select="$ifname" /> <xsl:with-param name="attrname" select="$attrname" /> <xsl:with-param name="attrtype" select="$attrtype" /> + <xsl:with-param name="attrsafearray" select="$attrsafearray" /> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:for-each> <xsl:text>} - </xsl:text> +</xsl:text> </xsl:template> <xsl:template name="collection"> <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable> <xsl:text> /** -* Generated VBoxWebService Managed Object Collection -*/</xsl:text> -class <xsl:value-of select="$ifname"/>Collection extends VBox_ManagedObjectCollection { - protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; + * Generated VBoxWebService Managed Object Collection + */</xsl:text> +class <xsl:value-of select="$ifname"/>Collection extends VBox_ManagedObjectCollection +{ + protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; } </xsl:template> @@ -231,21 +241,20 @@ class <xsl:value-of select="$ifname"/>Collection extends VBox_ManagedObjectColle <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable> <xsl:text> /** -* Generated VBoxWebService Struct -*/</xsl:text> -class <xsl:value-of select="$ifname"/> extends VBox_Struct { - <xsl:for-each select="attribute"> - protected $<xsl:value-of select="@name"/>; - </xsl:for-each> - public function __construct($connection, $values) { - $this->connection = $connection; - <xsl:for-each select="attribute"> - $this-><xsl:value-of select="@name"/> = $values-><xsl:value-of select="@name"/><xsl:text>;</xsl:text> - </xsl:for-each> - } + * Generated VBoxWebService Struct + */</xsl:text> +class <xsl:value-of select="$ifname"/> extends VBox_Struct +{ +<xsl:for-each select="attribute"> protected $<xsl:value-of select="@name"/>; +</xsl:for-each> + public function __construct($connection, $values) + { + $this->connection = $connection; +<xsl:for-each select="attribute"> $this-><xsl:value-of select="@name"/> = $values-><xsl:value-of select="@name"/>; +</xsl:for-each> } - <xsl:for-each select="attribute"> - public function <xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>() { +<xsl:for-each select="attribute"> public function <xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="@name"/></xsl:call-template>() + { <xsl:text>return </xsl:text> <xsl:call-template name="emitOutParam"> <xsl:with-param name="type" select="@type" /> @@ -253,36 +262,33 @@ class <xsl:value-of select="$ifname"/> extends VBox_Struct { <xsl:with-param name="safearray" select="@safearray"/> </xsl:call-template>; } - </xsl:for-each> - -} +</xsl:for-each>} </xsl:template> <xsl:template name="structcollection"> <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable> <xsl:text> /** -* Generated VBoxWebService Struct Collection -*/</xsl:text> -class <xsl:value-of select="$ifname"/>Collection extends VBox_StructCollection { - protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; + * Generated VBoxWebService Struct Collection + */</xsl:text> +class <xsl:value-of select="$ifname"/>Collection extends VBox_StructCollection +{ + protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; } </xsl:template> <xsl:template name="genreq"> - <xsl:param name="wsmap" /> - <xsl:text>$request = new stdClass()</xsl:text>; - <xsl:if test="$wsmap='managed'"> - $request->_this = $this->handle; - </xsl:if> - <xsl:for-each select="param[@dir='in']"> - $request-><xsl:value-of select="@name" /> = $arg_<xsl:value-of select="@name" /><xsl:text>;</xsl:text> - </xsl:for-each> - $response = $this->connection->__soapCall('<xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>', array((array)$request)); - <!-- return needs to be the first one --> - return <xsl:if test="param[@dir='out']"> - <xsl:text>array(</xsl:text> - </xsl:if> + <xsl:param name="wsmap" /> + <xsl:text> $request = new stdClass(); +</xsl:text> + <xsl:if test="$wsmap='managed'"> $request->_this = $this->handle;</xsl:if> + <xsl:for-each select="param[@dir='in']"> + $request-><xsl:value-of select="@name" /> = $arg_<xsl:value-of select="@name" /><xsl:text>;</xsl:text> + </xsl:for-each> + $response = $this->connection->__soapCall('<xsl:value-of select="../@name"/>_<xsl:value-of select="@name"/>', array((array)$request)); + return <xsl:if test="param[@dir='out']"> + <xsl:text>array(</xsl:text> + </xsl:if> <xsl:for-each select="param[@dir='return']"> <xsl:call-template name="emitOutParam"> <xsl:with-param name="type" select="@type" /> @@ -310,26 +316,27 @@ class <xsl:value-of select="$ifname"/>Collection extends VBox_StructCollection { </xsl:template> <xsl:template name="method" > - <xsl:param name="wsmap" /> - public function <xsl:value-of select="@name"/><xsl:text>(</xsl:text> - <xsl:for-each select="param[@dir='in']"> - <xsl:if test="not(position()=1)"> - <xsl:text>, </xsl:text> - </xsl:if> - <xsl:value-of select="concat('$arg_',@name)"/> - </xsl:for-each><xsl:text>) { </xsl:text> - <xsl:call-template name="genreq"><xsl:with-param name="wsmap" select="$wsmap" /></xsl:call-template> - <xsl:text> } </xsl:text> + <xsl:param name="wsmap" /> + public function <xsl:value-of select="@name"/><xsl:text>(</xsl:text> + <xsl:for-each select="param[@dir='in']"> + <xsl:if test="not(position()=1)"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:value-of select="concat('$arg_',@name)"/> + </xsl:for-each> <xsl:text>) { </xsl:text> + <xsl:call-template name="genreq"><xsl:with-param name="wsmap" select="$wsmap" /></xsl:call-template> + <xsl:text> } </xsl:text> </xsl:template> <xsl:template name="enum"> <xsl:text> /** -* Generated VBoxWebService ENUM -*/</xsl:text> -class <xsl:value-of select="@name"/> extends VBox_Enum { - public $NameMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')"><xsl:value-of select="@value"/> => '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>); - public $ValueMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')">'<xsl:value-of select="@name"/>' => <xsl:value-of select="@value"/><xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>); + * Generated VBoxWebService ENUM + */</xsl:text> +class <xsl:value-of select="@name"/> extends VBox_Enum +{ + public $NameMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')"><xsl:value-of select="@value"/> => '<xsl:value-of select="@name"/>'<xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>); + public $ValueMap = array(<xsl:for-each select="const"><xsl:if test="not(@wsmap='suppress')">'<xsl:value-of select="@name"/>' => <xsl:value-of select="@value"/><xsl:if test="not(position()=last())">, </xsl:if></xsl:if></xsl:for-each>); } </xsl:template> @@ -337,22 +344,23 @@ class <xsl:value-of select="@name"/> extends VBox_Enum { <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable> <xsl:text> /** -* Generated VBoxWebService Enum Collection -*/</xsl:text> -class <xsl:value-of select="$ifname"/>Collection extends VBox_EnumCollection { - protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; + * Generated VBoxWebService Enum Collection + */</xsl:text> +class <xsl:value-of select="$ifname"/>Collection extends VBox_EnumCollection +{ + protected $_interfaceName = "<xsl:value-of select="$ifname"/>"; } </xsl:template> <xsl:template name="comResultCodes"> - const <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>; + const <xsl:value-of select="@name"/> = <xsl:value-of select="@value"/>; </xsl:template> <xsl:template match="/"> <xsl:text><?php /* - * Copyright (C) 2008-2010 Oracle Corporation + * Copyright (C) 2008-2014 Oracle Corporation * * This file is part of a free software library; you can redistribute * it and/or modify it under the terms of the GNU Lesser General @@ -407,44 +415,50 @@ class VBox_ManagedObject throw new Exception("Attribute does not exist"); } - public function getHandle() - { - return $this->handle; - } - - public function cast($class) - { - if (is_subclass_of($class, 'VBox_ManagedObject')) - { - return new $class($this->connection, $this->handle); - } - throw new Exception('Cannot cast VBox_ManagedObject to non-child class VBox_ManagedObject'); - } - - public function releaseRemote() - { - try - { - $request = new stdClass(); - $request->_this = $this->handle; - $this->connection->__soapCall('IManagedObjectRef_release', array((array)$request)); - } catch (Exception $ex) {} - } + public function getHandle() + { + return $this->handle; + } + + public function cast($class) + { + if (is_subclass_of($class, 'VBox_ManagedObject')) + { + return new $class($this->connection, $this->handle); + } + throw new Exception('Cannot cast VBox_ManagedObject to non-child class VBox_ManagedObject'); + } + + public function releaseRemote() + { + try + { + $request = new stdClass(); + $request->_this = $this->handle; + $this->connection->__soapCall('IManagedObjectRef_release', array((array)$request)); + } + catch (Exception $ex) + { + } + } } -abstract class VBox_Collection implements ArrayAccess, Iterator, Countable { +abstract class VBox_Collection implements ArrayAccess, Iterator, Countable +{ protected $_connection; protected $_values; protected $_objects; protected $_interfaceName; - public function __construct($soap, array $values = array()) { + public function __construct($soap, array $values = array()) + { $this->_connection = $soap; $this->_values = $values; $this->_soapToObject(); } - protected function _soapToObject() { + protected function _soapToObject() + { $this->_objects = array(); foreach($this->_values as $value) { @@ -453,7 +467,8 @@ abstract class VBox_Collection implements ArrayAccess, Iterator, Countable { } /** ArrayAccess Functions **/ - public function offsetSet($offset, $value) { + public function offsetSet($offset, $value) + { if ($value instanceof $this->_interfaceName) { if ($offset) @@ -471,60 +486,72 @@ abstract class VBox_Collection implements ArrayAccess, Iterator, Countable { } } - public function offsetExists($offset) { + public function offsetExists($offset) + { return isset($this->_objects[$offset]); } - public function offsetUnset($offset) { + public function offsetUnset($offset) + { unset($this->_objects[$offset]); } - public function offsetGet($offset) { + public function offsetGet($offset) + { return isset($this->_objects[$offset]) ? $this->_objects[$offset] : null; } /** Iterator Functions **/ - public function rewind() { + public function rewind() + { reset($this->_objects); } - public function current() { + public function current() + { return current($this->_objects); } - public function key() { + public function key() + { return key($this->_objects); } - public function next() { + public function next() + { return next($this->_objects); } - public function valid() { + public function valid() + { return ($this->current() !== false); } /** Countable Functions **/ - public function count() { + public function count() + { return count($this->_objects); } } -class VBox_ManagedObjectCollection extends VBox_Collection { +class VBox_ManagedObjectCollection extends VBox_Collection +{ protected $_interfaceName = 'VBox_ManagedObject'; // Result is undefined if this is called AFTER any call to VBox_Collection::offsetSet or VBox_Collection::offsetUnset - public function setInterfaceName($interface) { - if (!is_subclass_of($interface, 'VBox_ManagedObject')) - { - throw new Exception('Cannot set collection interface to non-child class of VBox_ManagedObject'); - } - $this->_interfaceName = $interface; - $this->_soapToObject(); + public function setInterfaceName($interface) + { + if (!is_subclass_of($interface, 'VBox_ManagedObject')) + { + throw new Exception('Cannot set collection interface to non-child class of VBox_ManagedObject'); + } + $this->_interfaceName = $interface; + $this->_soapToObject(); } } -abstract class VBox_Struct { +abstract class VBox_Struct +{ protected $connection; public function __get($attr) @@ -537,7 +564,8 @@ abstract class VBox_Struct { } } -abstract class VBox_StructCollection extends VBox_Collection { +abstract class VBox_StructCollection extends VBox_Collection +{ public function __construct($soap, array $values = array()) { @@ -549,33 +577,36 @@ abstract class VBox_StructCollection extends VBox_Collection { } } -abstract class VBox_Enum { - protected $_handle; - - public function __construct($connection, $handle) - { - if (is_string($handle)) - $this->_handle = $this->ValueMap[$handle]; - else - $this->_handle = $handle; - } - - public function __toString() - { - return (string)$this->NameMap[$this->_handle]; - } +abstract class VBox_Enum +{ + protected $_handle; + + public function __construct($connection, $handle) + { + if (is_string($handle)) + $this->_handle = $this->ValueMap[$handle]; + else + $this->_handle = $handle; + } + + public function __toString() + { + return (string)$this->NameMap[$this->_handle]; + } } -abstract class VBox_EnumCollection extends VBox_Collection { +abstract class VBox_EnumCollection extends VBox_Collection +{ } </xsl:text> <xsl:text> /** -* VirtualBox COM result codes -*/ -class VirtualBox_COM_result_codes { + * VirtualBox COM result codes + */ +class VirtualBox_COM_result_codes +{ </xsl:text> <xsl:for-each select="/idl/library/result"> <xsl:call-template name="comResultCodes"/> @@ -587,7 +618,7 @@ class VirtualBox_COM_result_codes { <xsl:call-template name="interface"/> <xsl:call-template name="collection"/> </xsl:for-each> - <xsl:for-each select="//interface[@wsmap='struct']"> + <xsl:for-each select="//interface[@wsmap='struct']"> <xsl:call-template name="interfacestruct"/> <xsl:call-template name="structcollection"/> </xsl:for-each> diff --git a/src/VBox/Main/webservice/websrv-python.xsl b/src/VBox/Main/webservice/websrv-python.xsl index d1dcff79..01984595 100644 --- a/src/VBox/Main/webservice/websrv-python.xsl +++ b/src/VBox/Main/webservice/websrv-python.xsl @@ -9,7 +9,7 @@ VirtualBox.xidl. This Python file represents our web service API. Depends on WSDL file for actual SOAP bindings. - Copyright (C) 2008-2010 Oracle Corporation + Copyright (C) 2008-2014 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -27,7 +27,7 @@ encoding="utf-8" indent="no"/> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <xsl:variable name="G_setSuppressedInterfaces" select="//interface[@wsmap='suppress']" /> @@ -51,7 +51,6 @@ <xsl:when test="$type='result'">UnsignedInt</xsl:when> <xsl:when test="$type='octet'">Octet</xsl:when> <xsl:when test="$type='$unknown'">IUnknown</xsl:when> - <xsl:when test="$type='$dispatched'">IUnknown</xsl:when> <xsl:otherwise><xsl:value-of select="$type" /></xsl:otherwise> </xsl:choose> </xsl:template> @@ -148,7 +147,7 @@ class <xsl:value-of select="$cname"/>: <xsl:param name="base" /> <xsl:choose> - <xsl:when test="($base = '$unknown') or ($base = '$dispatched')"> + <xsl:when test="($base = '$unknown')"> <xsl:value-of select="'IUnknown'"/> </xsl:when> <xsl:when test="($base = '$errorinfo') "> @@ -468,7 +467,7 @@ class <xsl:value-of select="@name"/>: </xsl:template> <xsl:template match="/"> -<xsl:text># Copyright (C) 2008-2011 Oracle Corporation +<xsl:text># Copyright (C) 2008-2014 Oracle Corporation # # This file is part of a free software library; you can redistribute # it and/or modify it under the terms of the GNU Lesser General diff --git a/src/VBox/Main/webservice/websrv-shared.inc.xsl b/src/VBox/Main/webservice/websrv-shared.inc.xsl deleted file mode 100644 index b31eb72c..00000000 --- a/src/VBox/Main/webservice/websrv-shared.inc.xsl +++ /dev/null @@ -1,359 +0,0 @@ -<!-- - websrv-shared.inc.xsl: - this gets included from the other websrv-*.xsl XSLT stylesheets - so we can share some definitions that must be the same for - all of them (like method prefixes/suffices). - See webservice/Makefile.kmk for an overview of all the things - generated for the webservice. - - Copyright (C) 2006-2010 Oracle Corporation - - This file is part of VirtualBox Open Source Edition (OSE), as - available from http://www.virtualbox.org. This file is free software; - you can redistribute it and/or modify it under the terms of the GNU - General Public License (GPL) as published by the Free Software - Foundation, in version 2 as it comes in the "COPYING" file of the - VirtualBox OSE distribution. VirtualBox OSE is distributed in the - hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ---> - - -<xsl:stylesheet - version="1.0" - targetNamespace="http://schemas.xmlsoap.org/wsdl/" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:vbox="http://www.virtualbox.org/"> - -<xsl:variable name="G_xsltIncludeFilename" select="'websrv-shared.inc.xsl'" /> - -<!-- target namespace; this must match the xmlns:vbox in stylesheet opening tags! --> -<xsl:variable name="G_targetNamespace" - select='"http://www.virtualbox.org/"' /> -<xsl:variable name="G_targetNamespaceSeparator" - select='""' /> - -<!-- ENCODING SCHEME - - See: http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/ - - Essentially "document" style means that each SOAP message is a complete and - self-explanatory document that does not rely on outside information for - validation. - - By contrast, the (older) "RPC" style allows for much shorter SOAP messages - that do not contain validation info like all types that are used, but then - again, caller and receiver must have agreed on a valid format in some other way. - With RPC, WSDL typically looks like this: - - <message name="myMethodRequest"> - <part name="x" type="xsd:int"/> - <part name="y" type="xsd:float"/> - </message> - - This is why today "document" style is preferred. However, with document style, - one _cannot_ use "type" in <part> elements. Instead, one must use "element" - attributes that refer to <element> items in the type section. Like this: - - <types> - <schema> - <element name="xElement" type="xsd:int"/> - <element name="yElement" type="xsd:float"/> - </schema> - </types> - - <message name="myMethodRequest"> - <part name="x" element="xElement"/> - <part name="y" element="yElement"/> - </message> - - The "encoded" and "literal" sub-styles then only determine whether the - individual types in the soap messages carry additional information in - attributes. "Encoded" was only used with RPC styles, really, and even that - is not widely supported any more. - ---> -<!-- These are the settings: all the other XSLTs react on this and are supposed - to be able to generate both valid RPC and document-style code. The only - allowed values are 'rpc' or 'document'. --> -<xsl:variable name="G_basefmt" - select='"document"' /> -<xsl:variable name="G_parmfmt" - select='"literal"' /> -<!-- <xsl:variable name="G_basefmt" - select='"rpc"' /> -<xsl:variable name="G_parmfmt" - select='"encoded"' /> --> - -<!-- with document style, this is how we name the request and return element structures --> -<xsl:variable name="G_requestElementVarName" - select='"req"' /> -<xsl:variable name="G_responseElementVarName" - select='"resp"' /> -<!-- this is how we name the result parameter in messages --> -<xsl:variable name="G_result" - select='"returnval"' /> - -<!-- we represent interface attributes by creating "get" and "set" methods; these - are the prefixes we use for that --> -<xsl:variable name="G_attributeGetPrefix" - select='"get"' /> -<xsl:variable name="G_attributeSetPrefix" - select='"set"' /> -<!-- separator between class name and method/attribute name; would be "::" in C++ - but i'm unsure whether WSDL appreciates that (WSDL only) --> -<xsl:variable name="G_classSeparator" - select='"_"' /> -<!-- for each interface method, we need to create both a "request" and a "response" - message; these are the suffixes we append to the method names for that --> -<xsl:variable name="G_methodRequest" - select='"RequestMsg"' /> -<xsl:variable name="G_methodResponse" - select='"ResultMsg"' /> -<!-- suffix for element declarations that describe request message parameters (WSDL only) --> -<xsl:variable name="G_requestMessageElementSuffix" - select='""' /> -<!-- suffix for element declarations that describe request message parameters (WSDL only) --> -<xsl:variable name="G_responseMessageElementSuffix" - select='"Response"' /> -<!-- suffix for portType names (WSDL only) --> -<xsl:variable name="G_portTypeSuffix" - select='"PortType"' /> -<!-- suffix for binding names (WSDL only) --> -<xsl:variable name="G_bindingSuffix" - select='"Binding"' /> -<!-- schema type to use for object references; while it is theoretically - possible to use a self-defined type (e.g. some vboxObjRef type that's - really an int), gSOAP gets a bit nasty and creates complicated structs - for function parameters when these types are used as output parameters. - So we just use "int" even though it's not as lucid. - One setting is for the WSDL emitter, one for the C++ emitter --> -<!-- -<xsl:variable name="G_typeObjectRef" - select='"xsd:unsignedLong"' /> -<xsl:variable name="G_typeObjectRef_gsoapH" - select='"ULONG64"' /> -<xsl:variable name="G_typeObjectRef_CPP" - select='"WSDLT_ID"' /> ---> -<xsl:variable name="G_typeObjectRef" - select='"xsd:string"' /> -<xsl:variable name="G_typeObjectRef_gsoapH" - select='"std::string"' /> -<xsl:variable name="G_typeObjectRef_CPP" - select='"std::string"' /> -<!-- and what to call first the object parameter --> -<xsl:variable name="G_nameObjectRef" - select='"_this"' /> -<!-- gSOAP encodes underscores with USCORE so this is used in our C++ code --> -<xsl:variable name="G_nameObjectRefEncoded" - select='"_USCOREthis"' /> - -<!-- type to represent enums within C++ COM callers --> -<xsl:variable name="G_funcPrefixInputEnumConverter" - select='"EnumSoap2Com_"' /> -<xsl:variable name="G_funcPrefixOutputEnumConverter" - select='"EnumCom2Soap_"' /> - -<!-- type to represent structs within C++ COM callers --> -<xsl:variable name="G_funcPrefixOutputStructConverter" - select='"StructCom2Soap_"' /> - -<xsl:variable name="G_aSharedTypes"> - <type idlname="octet" xmlname="unsignedByte" cname="unsigned char" gluename="BYTE" javaname="byte" /> - <type idlname="boolean" xmlname="boolean" cname="bool" gluename="BOOL" javaname="Boolean" /> - <type idlname="short" xmlname="short" cname="short" gluename="SHORT" javaname="Short" /> - <type idlname="unsigned short" xmlname="unsignedShort" cname="unsigned short" gluename="USHORT" javaname="Integer" /> - <type idlname="long" xmlname="int" cname="int" gluename="LONG" javaname="Integer" /> - <type idlname="unsigned long" xmlname="unsignedInt" cname="unsigned int" gluename="ULONG" javaname="Long" /> - <type idlname="long long" xmlname="long" cname="LONG64" gluename="LONG64" javaname="Long" /> - <type idlname="unsigned long long" xmlname="unsignedLong" cname="ULONG64" gluename="ULONG64" javaname="BigInteger" /> - <type idlname="double" xmlname="double" cname="double" gluename="" javaname="Double" /> - <type idlname="float" xmlname="float" cname="float" gluename="" javaname="Float" /> - <type idlname="wstring" xmlname="string" cname="std::string" gluename="" javaname="String" /> - <type idlname="uuid" xmlname="string" cname="std::string" gluename="" javaname="String" /> - <type idlname="result" xmlname="unsignedInt" cname="unsigned int" gluename="HRESULT" javaname="Long" /> -</xsl:variable> - -<!-- - warning: - --> - -<xsl:template name="warning"> - <xsl:param name="msg" /> - - <xsl:message terminate="no"> - <xsl:value-of select="concat('[', $G_xsltFilename, '] Warning in ', $msg)" /> - </xsl:message> -</xsl:template> - -<!-- - fatalError: - --> - -<xsl:template name="fatalError"> - <xsl:param name="msg" /> - - <xsl:message terminate="yes"> - <xsl:value-of select="concat('[', $G_xsltFilename, '] Error in ', $msg)" /> - </xsl:message> -</xsl:template> - -<!-- - debugMsg - --> - -<xsl:template name="debugMsg"> - <xsl:param name="msg" /> - - <xsl:if test="$G_argDebug"> - <xsl:message terminate="no"> - <xsl:value-of select="concat('[', $G_xsltFilename, '] ', $msg)" /> - </xsl:message> - </xsl:if> -</xsl:template> - -<!-- - uncapitalize - --> - -<xsl:template name="uncapitalize"> - <xsl:param name="str" select="."/> - <xsl:value-of select=" - concat( - translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), - substring($str,2) - ) - "/> -</xsl:template> -<!-- - uncapitalize in the way JAX-WS understands, see #2910 - --> - -<xsl:template name="uncapitalize2"> - <xsl:param name="str" select="."/> - <xsl:variable name="strlen"> - <xsl:value-of select="string-length($str)"/> - </xsl:variable> - <xsl:choose> - <xsl:when test="$strlen>1"> - <xsl:choose> - <xsl:when test="contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ',substring($str,1,1)) - and - contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ',substring($str,2,1))"> - <xsl:variable name="cdr"> - <xsl:call-template name="uncapitalize2"> - <xsl:with-param name="str" select="substring($str,2)"/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select=" - concat( - translate(substring($str,1,1), - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - 'abcdefghijklmnopqrstuvwxyz'), - $cdr - ) - "/> - </xsl:when> - <xsl:otherwise> - <!--<xsl:value-of select="concat(substring($str,1,1),$cdr)"/>--> - <xsl:value-of select="$str"/> - </xsl:otherwise> - </xsl:choose> - </xsl:when> - <xsl:when test="$strlen=1"> - <xsl:value-of select=" - translate($str, - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', - 'abcdefghijklmnopqrstuvwxyz') - "/> - </xsl:when> - <xsl:otherwise> - </xsl:otherwise> - </xsl:choose> -</xsl:template> -<!-- - capitalize - --> - -<xsl:template name="capitalize"> - <xsl:param name="str" select="."/> - <xsl:value-of select=" - concat( - translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'), - substring($str,2) - ) - "/> -</xsl:template> - -<!-- - makeGetterName: - --> -<xsl:template name="makeGetterName"> - <xsl:param name="attrname" /> - <xsl:variable name="capsname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable> - <xsl:value-of select="concat($G_attributeGetPrefix, $capsname)" /> -</xsl:template> - -<!-- - makeSetterName: - --> -<xsl:template name="makeSetterName"> - <xsl:param name="attrname" /> - <xsl:variable name="capsname"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$attrname" /></xsl:call-template></xsl:variable> - <xsl:value-of select="concat($G_attributeSetPrefix, $capsname)" /> -</xsl:template> - -<!-- - makeJaxwsMethod: compose idevInterfaceMethod out of IDEVInterface::method - --> -<xsl:template name="makeJaxwsMethod"> - <xsl:param name="ifname" /> - <xsl:param name="methodname" /> - <xsl:variable name="uncapsif"><xsl:call-template name="uncapitalize2"><xsl:with-param name="str" select="$ifname" /></xsl:call-template></xsl:variable> - <xsl:variable name="capsmethod"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template></xsl:variable> - <xsl:value-of select="concat($uncapsif, $capsmethod)" /> -</xsl:template> - - -<!-- - makeJaxwsMethod2: compose iInterfaceMethod out of IInterface::method - --> -<xsl:template name="makeJaxwsMethod2"> - <xsl:param name="ifname" /> - <xsl:param name="methodname" /> - <xsl:variable name="uncapsif"><xsl:call-template name="uncapitalize"><xsl:with-param name="str" select="$ifname" /></xsl:call-template></xsl:variable> - <xsl:variable name="capsmethod"><xsl:call-template name="capitalize"><xsl:with-param name="str" select="$methodname" /></xsl:call-template></xsl:variable> - <xsl:value-of select="concat($uncapsif, $capsmethod)" /> -</xsl:template> - -<!-- - emitNewline: - --> -<xsl:template name="emitNewline"> - <xsl:text> -</xsl:text> -</xsl:template> - -<!-- - emitNewlineIndent8: - --> -<xsl:template name="emitNewlineIndent8"> - <xsl:text> - </xsl:text> -</xsl:template> - -<!-- - escapeUnderscores - --> -<xsl:template name="escapeUnderscores"> - <xsl:param name="string" /> - <xsl:if test="contains($string, '_')"> - <xsl:value-of select="substring-before($string, '_')" />_USCORE<xsl:call-template name="escapeUnderscores"><xsl:with-param name="string"><xsl:value-of select="substring-after($string, '_')" /></xsl:with-param></xsl:call-template> - </xsl:if> - <xsl:if test="not(contains($string, '_'))"><xsl:value-of select="$string" /> - </xsl:if> -</xsl:template> - -</xsl:stylesheet> diff --git a/src/VBox/Main/webservice/websrv-typemap.xsl b/src/VBox/Main/webservice/websrv-typemap.xsl index 97efefa1..714c42b8 100644 --- a/src/VBox/Main/webservice/websrv-typemap.xsl +++ b/src/VBox/Main/webservice/websrv-typemap.xsl @@ -8,7 +8,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2006-2010 Oracle Corporation + Copyright (C) 2006-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -34,7 +34,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-typemap.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- - - - - - - - - - - - - - - - - - - - - - - root match diff --git a/src/VBox/Main/webservice/websrv-wsdl-service.xsl b/src/VBox/Main/webservice/websrv-wsdl-service.xsl index e9d6e66c..e5c1ea3f 100644 --- a/src/VBox/Main/webservice/websrv-wsdl-service.xsl +++ b/src/VBox/Main/webservice/websrv-wsdl-service.xsl @@ -9,7 +9,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2006-2010 Oracle Corporation + Copyright (C) 2006-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -45,7 +45,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-wsdl-service.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- collect all interfaces with "wsmap='suppress'" in a global variable for quick lookup --> diff --git a/src/VBox/Main/webservice/websrv-wsdl.xsl b/src/VBox/Main/webservice/websrv-wsdl.xsl index 88ac6dc7..5508cd1f 100644 --- a/src/VBox/Main/webservice/websrv-wsdl.xsl +++ b/src/VBox/Main/webservice/websrv-wsdl.xsl @@ -9,7 +9,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2006-2010 Oracle Corporation + Copyright (C) 2006-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -93,6 +93,7 @@ targetNamespace="http://schemas.xmlsoap.org/wsdl/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:vbox="http://www.virtualbox.org/" xmlns:exsl="http://exslt.org/common" @@ -117,7 +118,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-wsdl.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- collect all interfaces with "wsmap='suppress'" in a global variable for quick lookup --> @@ -146,7 +147,7 @@ <xsl:param name="methodname" /> <xsl:param name="type" /> <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('......emitConvertedType: type="', $type, '"')" /></xsl:call-template> - <!-- look up XML Schema type from IDL type from table array in websrv-shared.inc.xsl --> + <!-- look up XML Schema type from IDL type from table array in typemap-shared.inc.xsl --> <xsl:variable name="xmltypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@xmlname" /> <xsl:choose> <xsl:when test="$type=$G_typeIsGlobalRequestElementMarker"><xsl:value-of select="concat('vbox:', $ifname, $G_classSeparator, $methodname, $G_requestMessageElementSuffix)" /></xsl:when> @@ -162,7 +163,7 @@ <!-- otherwise test for an interface with this name --> <xsl:when test="//interface[@name=$type]"> <!-- the type is one of our own interfaces: then it must have a wsmap attr --> - <xsl:variable name="wsmap" select="(//interface[@name=$type]/@wsmap) | (//collection[@name=$type]/@wsmap)" /> + <xsl:variable name="wsmap" select="//interface[@name=$type]/@wsmap" /> <xsl:choose> <xsl:when test="not($wsmap)"> <xsl:call-template name="fatalError"> @@ -185,9 +186,6 @@ </xsl:otherwise> </xsl:choose> </xsl:when> - <xsl:when test="//collection[@name=$type]"> - <xsl:value-of select="concat('vbox:ArrayOf', //collection[@name=$type]/@type)" /> - </xsl:when> <xsl:otherwise> <xsl:call-template name="fatalError"> <xsl:with-param name="msg" select="concat('emitConvertedType: Unknown type "', $type, '" used in method "', $ifname, '::', $methodname, '".')" /> @@ -460,7 +458,7 @@ <xsl:param name="_params" /> <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages --> - <message> + <wsdl:message> <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_methodRequest)" /></xsl:attribute> <xsl:call-template name="convertTypeAndEmitPartOrElement"> @@ -469,10 +467,10 @@ <xsl:with-param name="name" select="'parameters'" /> <xsl:with-param name="type" select="$G_typeIsGlobalRequestElementMarker" /> <xsl:with-param name="safearray" select="'no'" /> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> --> </xsl:call-template> - </message> + </wsdl:message> </xsl:template> <!-- @@ -485,7 +483,7 @@ <xsl:param name="_params" /> <!-- set of parameter elements --> <xsl:param name="_resulttype" /> <!-- for attribute getter methods only --> - <message> + <wsdl:message> <xsl:attribute name="name"><xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute> <!-- <xsl:variable name="cOutParams" select="count($_params[@dir='out']) + count($_params[@dir='return'])" /> --> @@ -495,10 +493,10 @@ <xsl:with-param name="name" select="'parameters'" /> <xsl:with-param name="type" select="$G_typeIsGlobalResponseElementMarker" /> <xsl:with-param name="safearray" select="'no'" /> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> --> </xsl:call-template> - </message> + </wsdl:message> </xsl:template> <!-- @@ -543,13 +541,13 @@ <xsl:with-param name="_methodname" select="$attrSetter" /> <xsl:with-param name="_params" select="/.." /> <!-- empty set --> <xsl:with-param name="_valuetype" select="$attrtype" /> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> </xsl:call-template> <xsl:call-template name="emitResultMessage"> <xsl:with-param name="_ifname" select="$ifname" /> <xsl:with-param name="_methodname" select="$attrSetter" /> <xsl:with-param name="_params" select="/.." /> <!-- empty set --> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> </xsl:call-template> </xsl:template> @@ -566,7 +564,7 @@ <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....emitInOutOperation ', $_ifname, '::', $_methodname)" /></xsl:call-template> - <operation> + <wsdl:operation> <xsl:attribute name="name"> <xsl:value-of select="concat($_ifname, '_', $_methodname)" /> </xsl:attribute> @@ -577,7 +575,7 @@ <xsl:attribute name="style"><xsl:value-of select="$G_basefmt" /></xsl:attribute> </soap:operation> </xsl:if> - <input> + <wsdl:input> <xsl:choose> <xsl:when test="$_fSoap"> <soap:body> @@ -589,10 +587,10 @@ <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodRequest" /></xsl:attribute> </xsl:otherwise> </xsl:choose> - </input> + </wsdl:input> <xsl:choose> <xsl:when test="$_resulttype"> - <output> + <wsdl:output> <xsl:choose> <xsl:when test="$_fSoap"> <soap:body> @@ -604,11 +602,11 @@ <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute> </xsl:otherwise> </xsl:choose> - </output> + </wsdl:output> </xsl:when> <xsl:otherwise> <!-- <xsl:if test="count($_params[@dir='out'] | $_params[@dir='return']) > 0"> --> - <output> + <wsdl:output> <xsl:choose> <xsl:when test="$_fSoap"> <soap:body> @@ -620,29 +618,29 @@ <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute> </xsl:otherwise> </xsl:choose> - </output> + </wsdl:output> <!-- </xsl:if> --> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="not($_fSoap)"> - <fault name="InvalidObjectFault" message="vbox:InvalidObjectFaultMsg" /> - <fault name="RuntimeFault" message="vbox:RuntimeFaultMsg" /> + <wsdl:fault name="InvalidObjectFault" message="vbox:InvalidObjectFaultMsg" /> + <wsdl:fault name="RuntimeFault" message="vbox:RuntimeFaultMsg" /> </xsl:when> <xsl:otherwise> - <fault name="InvalidObjectFault"> + <wsdl:fault name="InvalidObjectFault"> <soap:fault name="InvalidObjectFault"> <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute> </soap:fault> - </fault> - <fault name="RuntimeFault"> + </wsdl:fault> + <wsdl:fault name="RuntimeFault"> <soap:fault name="RuntimeFault"> <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute> </soap:fault> - </fault> + </wsdl:fault> </xsl:otherwise> </xsl:choose> - </operation> + </wsdl:operation> </xsl:template> <!-- @@ -694,7 +692,10 @@ <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" --> <xsl:choose> <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> - <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment> + </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment> </xsl:when> <xsl:otherwise> <xsl:choose> @@ -735,6 +736,9 @@ or (param[@mod='ptr'])" > <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <!-- always emit a request message --> <xsl:call-template name="emitRequestMessage"> @@ -742,7 +746,7 @@ <xsl:with-param name="_wsmap" select="$wsmap" /> <xsl:with-param name="_methodname" select="$methodname" /> <xsl:with-param name="_params" select="param" /> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> </xsl:call-template> <!-- emit a second "result" message only if the method has "out" arguments or a return value --> <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> --> @@ -751,7 +755,7 @@ <xsl:with-param name="_wsmap" select="$wsmap" /> <xsl:with-param name="_methodname" select="@name" /> <xsl:with-param name="_params" select="param" /> - <xsl:with-param name="elname" select="'part'" /> <!-- "part" or "element" --> + <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" --> </xsl:call-template> <!-- </xsl:if> --> </xsl:otherwise> @@ -776,7 +780,10 @@ <xsl:choose> <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" --> <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> - <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment> + </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment> </xsl:when> <xsl:otherwise> <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable> @@ -810,6 +817,9 @@ or (param[@mod='ptr'])" > <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <xsl:call-template name="emitInOutOperation"> <xsl:with-param name="_ifname" select="$ifname" /> @@ -836,7 +846,10 @@ <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" --> <xsl:choose> <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> - <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment> + </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment> </xsl:when> <xsl:otherwise> <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable> @@ -869,6 +882,9 @@ or (param[@mod='ptr'])" > <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <xsl:call-template name="emitInOutOperation"> <xsl:with-param name="_ifname" select="$ifname" /> @@ -956,10 +972,9 @@ and emit complexTypes for all method arguments and return values. --> <xsl:template match="library"> - <definitions + <wsdl:definitions name="VirtualBox" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> - <xsl:attribute name="xmlns">http://schemas.xmlsoap.org/wsdl/</xsl:attribute> <xsl:attribute name="targetNamespace"><xsl:value-of select="$G_targetNamespace" /></xsl:attribute> <!-- at top of WSDL file, dump a <types> section with user-defined types --> <xsl:comment> @@ -969,7 +984,7 @@ * ****************************************************** </xsl:comment> - <types> + <wsdl:types> <xsd:schema> <xsl:attribute name="targetNamespace"><xsl:value-of select='$G_targetNamespace' /></xsl:attribute> @@ -1024,40 +1039,6 @@ </xsd:complexType> </xsl:for-each> - <!-- type-define all collections as arrays (complexTypes) --> - <xsl:comment> - ****************************************************** - * collections as arrays - ****************************************************** -</xsl:comment> - <xsl:for-each select="//collection"> - <xsl:variable name="type" select="@type" /> - <xsl:variable name="ifwsmap" select="//interface[@name=$type]/@wsmap" /> - <xsl:comment><xsl:value-of select="concat(' collection ', @name, ' as array (wsmap: ', $ifwsmap, '): ')" /></xsl:comment> - <xsd:complexType> - <xsl:attribute name="name"><xsl:value-of select="concat('ArrayOf', @type)" /></xsl:attribute> - <xsd:sequence> - <xsl:choose> - <xsl:when test="($ifwsmap='managed') or ($ifwsmap='explicit')"> - <xsd:element name="array" minOccurs="0" maxOccurs="unbounded"> - <xsl:attribute name="type"><xsl:value-of select="$G_typeObjectRef" /></xsl:attribute> - </xsd:element> - </xsl:when> - <xsl:when test="$ifwsmap='struct'"> - <xsd:element name="array" minOccurs="0" maxOccurs="unbounded"> - <xsl:attribute name="type"><xsl:value-of select="concat('vbox:', @type)" /></xsl:attribute> - </xsd:element> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="fatalError"> - <xsl:with-param name="msg" select="concat('library template: collection "', @name, '" uses interface with unsupported wsmap attribute value "', $ifwsmap, '"')" /> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsd:sequence> - </xsd:complexType> - </xsl:for-each> - <!-- for WSDL 'document' style, we need to emit elements since we can't refer to types in message parts as with RPC style --> <xsl:if test="$G_basefmt='document'"> @@ -1086,6 +1067,9 @@ <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )"> <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="@readonly='yes'"> @@ -1135,6 +1119,9 @@ or (param[@mod='ptr'])" > <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment> </xsl:when> + <xsl:when test="@wsmap = 'suppress'"> + <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment> + </xsl:when> <xsl:otherwise> <!-- always emit a request message --> <xsl:call-template name="emitRequestElements"> @@ -1182,9 +1169,11 @@ <xsd:complexType> <xsd:sequence> <xsd:element name="resultCode" type="xsd:int" /> - <xsd:element name="interfaceID" type="xsd:string" /> - <xsd:element name="component" type="xsd:string" /> - <xsd:element name="text" type="xsd:string" /> + <xsd:element name="returnval"> + <xsl:attribute name="type"> + <xsl:value-of select="$G_typeObjectRef" /> + </xsl:attribute> + </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> @@ -1193,14 +1182,14 @@ </xsd:schema> - </types> + </wsdl:types> - <message name="InvalidObjectFaultMsg"> - <part name="fault" element="vbox:InvalidObjectFault" /> - </message> - <message name="RuntimeFaultMsg"> - <part name="fault" element="vbox:RuntimeFault" /> - </message> + <wsdl:message name="InvalidObjectFaultMsg"> + <wsdl:part name="fault" element="vbox:InvalidObjectFault" /> + </wsdl:message> + <wsdl:message name="RuntimeFaultMsg"> + <wsdl:part name="fault" element="vbox:RuntimeFault" /> + </wsdl:message> <xsl:comment> ****************************************************** @@ -1241,7 +1230,7 @@ ****************************************************** </xsl:comment> - <portType> + <wsdl:portType> <xsl:attribute name="name"><xsl:copy-of select="'vbox'" /><xsl:value-of select="$G_portTypeSuffix" /></xsl:attribute> <xsl:for-each select="//interface"> @@ -1261,7 +1250,7 @@ </xsl:call-template> </xsl:if> </xsl:for-each> - </portType> + </wsdl:portType> <xsl:comment> ****************************************************** @@ -1271,7 +1260,7 @@ ****************************************************** </xsl:comment> - <binding> + <wsdl:binding> <xsl:attribute name="name"><xsl:value-of select="concat('vbox', $G_bindingSuffix)" /></xsl:attribute> <xsl:attribute name="type"><xsl:value-of select="concat('vbox:vbox', $G_portTypeSuffix)" /></xsl:attribute> @@ -1297,9 +1286,9 @@ </xsl:call-template> </xsl:if> </xsl:for-each> - </binding> + </wsdl:binding> - </definitions> + </wsdl:definitions> </xsl:template> diff --git a/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl b/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl index d40ba83c..bdbce0e6 100644 --- a/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl +++ b/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl @@ -9,7 +9,7 @@ See webservice/Makefile.kmk for an overview of all the things generated for the webservice. - Copyright (C) 2006-2010 Oracle Corporation + Copyright (C) 2006-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -43,7 +43,7 @@ <xsl:variable name="G_xsltFilename" select="'websrv-wsdl2gsoapH.xsl'" /> -<xsl:include href="websrv-shared.inc.xsl" /> +<xsl:include href="../idl/typemap-shared.inc.xsl" /> <!-- collect all interfaces with "wsmap='suppress'" in a global variable for quick lookup --> @@ -81,7 +81,7 @@ ****************************************************************************/ // forward declarations - class _vbox__InvalidObjectFault; +class _vbox__InvalidObjectFault; class _vbox__RuntimeFault; struct SOAP_ENV__Detail diff --git a/src/VBox/Main/webservice/webtest.cpp b/src/VBox/Main/webservice/webtest.cpp index 89c8064a..78834c50 100644 --- a/src/VBox/Main/webservice/webtest.cpp +++ b/src/VBox/Main/webservice/webtest.cpp @@ -3,7 +3,7 @@ * demo webservice client in C++. This mimics some of the * functionality of VBoxManage for testing purposes. * - * Copyright (C) 2006-2012 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -57,6 +57,8 @@ static void usage(int exitcode) " - IPerformanceCollector:\n" " - webtest setupmetrics <pcref>: IPerformanceCollector::setupMetrics()\n" " - webtest querymetricsdata <pcref>: IPerformanceCollector::QueryMetricsData()\n" + " - IVirtualBoxErrorInfo:\n" + " - webtest errorinfo <eiref>: various IVirtualBoxErrorInfo getters\n" " - All managed object references:\n" " - webtest getif <ref>: report interface of object.\n" " - webtest release <ref>: IUnknown::Release().\n"; @@ -75,7 +77,7 @@ int main(int argc, char* argv[]) const char *pcszArgEndpoint = "http://localhost:18083/"; int ap; - for (ap = 1; ap <= argc; ap++) + for (ap = 1; ap < argc; ap++) { if (argv[ap][0] == '-') { @@ -84,7 +86,7 @@ int main(int argc, char* argv[]) else if (!strcmp(argv[ap], "-c")) { ap++; - if (ap > argc) + if (ap >= argc) usage(1); pcszArgEndpoint = argv[ap]; fSSL = !strncmp(pcszArgEndpoint, "https://", 8); @@ -452,6 +454,47 @@ int main(int argc, char* argv[]) } } } + else if (!strcmp(pcszMode, "errorinfo")) + { + if (argc < 2 + ap) + std::cout << "Not enough arguments for \"" << pcszMode << "\" mode.\n"; + else + { + _vbox__IVirtualBoxErrorInfo_USCOREgetResultCode req; + req._USCOREthis = argv[ap + 1]; + _vbox__IVirtualBoxErrorInfo_USCOREgetResultCodeResponse resp; + if (!(soaprc = soap_call___vbox__IVirtualBoxErrorInfo_USCOREgetResultCode(&soap, + pcszArgEndpoint, + NULL, + &req, + &resp))) + { + std::cout << "ErrorInfo ResultCode: " << std::hex << resp.returnval << "\n"; + + _vbox__IVirtualBoxErrorInfo_USCOREgetText req2; + req2._USCOREthis = argv[ap + 1]; + _vbox__IVirtualBoxErrorInfo_USCOREgetTextResponse resp2; + if (!(soaprc = soap_call___vbox__IVirtualBoxErrorInfo_USCOREgetText(&soap, + pcszArgEndpoint, + NULL, + &req2, + &resp2))) + { + std::cout << "ErrorInfo Text: " << resp2.returnval << "\n"; + + _vbox__IVirtualBoxErrorInfo_USCOREgetNext req3; + req3._USCOREthis = argv[ap + 1]; + _vbox__IVirtualBoxErrorInfo_USCOREgetNextResponse resp3; + if (!(soaprc = soap_call___vbox__IVirtualBoxErrorInfo_USCOREgetNext(&soap, + pcszArgEndpoint, + NULL, + &req3, + &resp3))) + std::cout << "Next ErrorInfo: " << resp3.returnval << "\n"; + } + } + } + } else if (!strcmp(pcszMode, "release")) { if (argc < 2 + ap) @@ -478,22 +521,18 @@ int main(int argc, char* argv[]) && (soap.fault->detail) ) { + // generic fault message whether the fault is known or not + std::cerr << "Generic fault message:\n"; + soap_print_fault(&soap, stderr); // display the SOAP fault message on the stderr stream + if (soap.fault->detail->vbox__InvalidObjectFault) { - std::cout << "Bad object ID: " << soap.fault->detail->vbox__InvalidObjectFault->badObjectID << "\n"; + std::cerr << "Bad object ID: " << soap.fault->detail->vbox__InvalidObjectFault->badObjectID << "\n"; } else if (soap.fault->detail->vbox__RuntimeFault) { - std::cout << "Result code: 0x" << std::hex << soap.fault->detail->vbox__RuntimeFault->resultCode << "\n"; - std::cout << "Text: " << std::hex << soap.fault->detail->vbox__RuntimeFault->text << "\n"; - std::cout << "Component: " << std::hex << soap.fault->detail->vbox__RuntimeFault->component << "\n"; - std::cout << "Interface ID: " << std::hex << soap.fault->detail->vbox__RuntimeFault->interfaceID << "\n"; - } - else - { - // generic fault - std::cerr << "Generic fault message:\n"; - soap_print_fault(&soap, stderr); // display the SOAP fault message on the stderr stream + std::cerr << "Result code: 0x" << std::hex << soap.fault->detail->vbox__RuntimeFault->resultCode << "\n"; + std::cerr << "ErrorInfo: " << soap.fault->detail->vbox__RuntimeFault->returnval << "\n"; } } else |