From fb123f93f9f5ce42c8e5785d2f8e0edaf951740e Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Wed, 26 Mar 2014 19:21:20 +0000 Subject: Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2. --- src/VBox/Main/webservice/MANIFEST.MF.in | 2 +- src/VBox/Main/webservice/Makefile.kmk | 103 ++++-- src/VBox/Main/webservice/platform-xidl.xsl | 2 +- .../Main/webservice/samples/java/jax-ws/Makefile | 2 +- .../webservice/samples/java/jax-ws/Makefile.glue | 2 +- .../Main/webservice/samples/php/clienttest.php | 2 +- src/VBox/Main/webservice/samples/python/Makefile | 2 +- .../Main/webservice/samples/python/Makefile.glue | 2 +- .../Main/webservice/samples/python/clienttest.py | 30 +- src/VBox/Main/webservice/split-soapC.cpp | 2 +- src/VBox/Main/webservice/vboxweb.cpp | 123 ++++--- src/VBox/Main/webservice/vboxweb.h | 19 +- src/VBox/Main/webservice/websrv-cpp.xsl | 78 +++-- src/VBox/Main/webservice/websrv-nsmap.xsl | 4 +- src/VBox/Main/webservice/websrv-php.xsl | 339 ++++++++++--------- src/VBox/Main/webservice/websrv-python.xsl | 9 +- src/VBox/Main/webservice/websrv-shared.inc.xsl | 359 --------------------- src/VBox/Main/webservice/websrv-typemap.xsl | 4 +- src/VBox/Main/webservice/websrv-wsdl-service.xsl | 4 +- src/VBox/Main/webservice/websrv-wsdl.xsl | 161 +++++---- src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl | 6 +- src/VBox/Main/webservice/webtest.cpp | 67 +++- 22 files changed, 555 insertions(+), 767 deletions(-) delete mode 100644 src/VBox/Main/webservice/websrv-shared.inc.xsl (limited to 'src/VBox/Main/webservice') 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 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 = '' + 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 == '' 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 #include #include -#include #include +#include #include #include #include @@ -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 m_llSocketsQ; + std::list 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)NULL); + RaiseSoapRuntimeFault(soap, idThis, pszMethodName, E_INVALIDARG, pObj, iid); } com::SafeArray 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)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 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 -void RaiseSoapRuntimeFault(struct soap *soap, HRESULT apirc, const ComPtr &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 @@ - + @@ -65,7 +65,6 @@ #include #include #include -#include #include #include @@ -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"; - - - - - - - - - - - + + + + + + + + + + + + + @@ -360,7 +361,7 @@ const char *g_pcszIUnknown = "IUnknown"; - + @@ -533,7 +534,10 @@ const char *g_pcszIUnknown = "IUnknown"; so we can then pass them to the actual COM method call. --> + + + @@ -546,7 +550,7 @@ const char *g_pcszIUnknown = "IUnknown"; - + @@ -596,6 +600,10 @@ const char *g_pcszIUnknown = "IUnknown"; + + + + @@ -778,7 +786,8 @@ const char *g_pcszIUnknown = "IUnknown"; emits the actual method call with the arguments. --> - + + @@ -786,14 +795,10 @@ const char *g_pcszIUnknown = "IUnknown"; - - - - - + - + @@ -856,7 +861,7 @@ const char *g_pcszIUnknown = "IUnknown"; { - + break; @@ -984,7 +989,7 @@ const char *g_pcszIUnknown = "IUnknown"; - + @@ -1067,6 +1072,7 @@ const char *g_pcszIUnknown = "IUnknown"; + @@ -1102,13 +1108,17 @@ const char *g_pcszIUnknown = "IUnknown"; + + + + @@ -1272,7 +1282,10 @@ const char *g_pcszIUnknown = "IUnknown"; - + + + + @@ -1321,6 +1334,9 @@ const char *g_pcszIUnknown = "IUnknown"; or (param[@mod='ptr'])" > + + + @@ -1377,7 +1393,14 @@ const char *g_pcszIUnknown = "IUnknown"; + + + + + + + @@ -1404,6 +1427,7 @@ const char *g_pcszIUnknown = "IUnknown"; + 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 @@ - + @@ -200,6 +207,7 @@ + @@ -207,23 +215,25 @@ + } - + /** -* Generated VBoxWebService Managed Object Collection -*/ -class Collection extends VBox_ManagedObjectCollection { - protected $_interfaceName = ""; + * Generated VBoxWebService Managed Object Collection + */ +class Collection extends VBox_ManagedObjectCollection +{ + protected $_interfaceName = ""; } @@ -231,21 +241,20 @@ class Collection extends VBox_ManagedObjectColle /** -* Generated VBoxWebService Struct -*/ -class extends VBox_Struct { - - protected $; - - public function __construct($connection, $values) { - $this->connection = $connection; - - $this-> = $values->; - - } + * Generated VBoxWebService Struct + */ +class extends VBox_Struct +{ + protected $; + + public function __construct($connection, $values) + { + $this->connection = $connection; + $this-> = $values->; + } - - public function () { + public function () + { return @@ -253,36 +262,33 @@ class extends VBox_Struct { ; } - - -} +} /** -* Generated VBoxWebService Struct Collection -*/ -class Collection extends VBox_StructCollection { - protected $_interfaceName = ""; + * Generated VBoxWebService Struct Collection + */ +class Collection extends VBox_StructCollection +{ + protected $_interfaceName = ""; } - - $request = new stdClass(); - - $request->_this = $this->handle; - - - $request-> = $arg_; - - $response = $this->connection->__soapCall('_', array((array)$request)); - - return - array( - + + $request = new stdClass(); + + $request->_this = $this->handle; + + $request-> = $arg_; + + $response = $this->connection->__soapCall('_', array((array)$request)); + return + array( + @@ -310,26 +316,27 @@ class Collection extends VBox_StructCollection { - - public function ( - - - , - - - ) { - - } + + public function ( + + + , + + + ) { + + } /** -* Generated VBoxWebService ENUM -*/ -class extends VBox_Enum { - public $NameMap = array( => '', ); - public $ValueMap = array('' => , ); + * Generated VBoxWebService ENUM + */ +class extends VBox_Enum +{ + public $NameMap = array( => '', ); + public $ValueMap = array('' => , ); } @@ -337,22 +344,23 @@ class extends VBox_Enum { /** -* Generated VBoxWebService Enum Collection -*/ -class Collection extends VBox_EnumCollection { - protected $_interfaceName = ""; + * Generated VBoxWebService Enum Collection + */ +class Collection extends VBox_EnumCollection +{ + protected $_interfaceName = ""; } - const = ; + const = ; <?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 +{ } /** -* VirtualBox COM result codes -*/ -class VirtualBox_COM_result_codes { + * VirtualBox COM result codes + */ +class VirtualBox_COM_result_codes +{ @@ -587,7 +618,7 @@ class VirtualBox_COM_result_codes { - + 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"/> - + @@ -51,7 +51,6 @@ UnsignedInt Octet IUnknown - IUnknown @@ -148,7 +147,7 @@ class : - + @@ -468,7 +467,7 @@ class : -# Copyright (C) 2008-2011 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 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _USCORE - - - - - - 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 @@ - + 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 @@ - + @@ -146,7 +147,7 @@ - + @@ -162,7 +163,7 @@ - + @@ -185,9 +186,6 @@ - - - @@ -460,7 +458,7 @@ - + @@ -469,10 +467,10 @@ - + - + - + @@ -495,10 +493,10 @@ - + - + - + - + @@ -566,7 +564,7 @@ - + @@ -577,7 +575,7 @@ - + @@ -589,10 +587,10 @@ vbox: - + - + @@ -604,11 +602,11 @@ vbox: - + - + @@ -620,29 +618,29 @@ vbox: - + - - + + - + - - + + - + - + - + + + + @@ -735,6 +736,9 @@ or (param[@mod='ptr'])" > + + + @@ -742,7 +746,7 @@ - + @@ -751,7 +755,7 @@ - + @@ -776,7 +780,10 @@ - + + + + @@ -810,6 +817,9 @@ or (param[@mod='ptr'])" > + + + @@ -836,7 +846,10 @@ - + + + + @@ -869,6 +882,9 @@ or (param[@mod='ptr'])" > + + + @@ -956,10 +972,9 @@ and emit complexTypes for all method arguments and return values. --> - - http://schemas.xmlsoap.org/wsdl/ @@ -969,7 +984,7 @@ * ****************************************************** - + @@ -1024,40 +1039,6 @@ - - - ****************************************************** - * collections as arrays - ****************************************************** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1086,6 +1067,9 @@ + + + @@ -1135,6 +1119,9 @@ or (param[@mod='ptr'])" > + + + @@ -1182,9 +1169,11 @@ - - - + + + + + @@ -1193,14 +1182,14 @@ - + - - - - - - + + + + + + ****************************************************** @@ -1241,7 +1230,7 @@ ****************************************************** - + @@ -1261,7 +1250,7 @@ - + ****************************************************** @@ -1271,7 +1260,7 @@ ****************************************************** - + @@ -1297,9 +1286,9 @@ - + - + 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 @@ - + @@ -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 : IPerformanceCollector::setupMetrics()\n" " - webtest querymetricsdata : IPerformanceCollector::QueryMetricsData()\n" + " - IVirtualBoxErrorInfo:\n" + " - webtest errorinfo : various IVirtualBoxErrorInfo getters\n" " - All managed object references:\n" " - webtest getif : report interface of object.\n" " - webtest release : 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 -- cgit v1.2.1