[groovy-user] Unable to load WSDL from local file into WSClient (the VirtualBox SDK blues)

113 views
Skip to first unread message

nabblee

unread,
Aug 27, 2009, 12:15:05 PM8/27/09
to us...@groovy.codehaus.org

I'm trying to use Groovy to access Sun VirtualBox's SDK. I've had no luck
with the COM object, because Scriptom doesn't recognize the type (13) of the
variants contained in the SafeArray:

ERROR org.codehaus.groovy.scriptom.UnsupportedVariantTypeException: 13 (d)
at groovysh_evaluate.run (groovysh_evaluate:6)
...

I have no idea what type 13 is.

Undeterred, I decided to try their Java sample code in Groovy. However, I
get an NPE on their first line, deep within CXF.

IWebsessionManager mgr = new
IWebsessionManager("http://localhost:18083/");

yields

java.lang.NullPointerException
at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:65)
at org.virtualbox_3_0.VboxService.<init>(VboxService.java:37)
at
com.sun.xml.ws.commons.virtualbox_3_0.PortPool.getPort(IWebsessionManager.java:122)
at
com.sun.xml.ws.commons.virtualbox_3_0.IWebsessionManager.connect(IWebsessionManager.java:176)
at
com.sun.xml.ws.commons.virtualbox_3_0.IWebsessionManager.<init>(IWebsessionManager.java:156)
at vboxCOMsdkTest.run(vboxCOMsdkTest.groovy:8)

Not to be intimidated, I make sure that soapUI can make calls to the SDK.
Defending its record as the most easy-going piece of software ever created,
of course soapUI is able to call the VBox SDK. So, I know it's working.
I'm not sure why their Java class is failing to construct.

Well, fine, if soapUI can do it, I'm sure WSClient can. So, I create a
WSClient proxy. Unfortunately, VBox doesn't serve its WSDL over HTTP. It
is only available on the file system, and, worse yet, it is comprised of two
files. So, I hunted and hunted to finally figure out how to give WSClient a
local WSDL file, rather than a URL. What I came up with is

def wsdl = "file:///C:/Program Files/Sun/xVM
VirtualBox/sdk/bindings/webservice/vboxwebService.wsdl"
def proxy = new WSClient(wsdl.toString(), this.class.classLoader)
proxy.initialize()

Unfortunately, that gives another NPE:

java.lang.NullPointerException
at groovyx.net.ws.WSClient.getWsdl(WSClient.java:180)
at groovyx.net.ws.WSClient.initialize(WSClient.java:146)
at groovyx.net.ws.WSClient$initialize.call(Unknown Source)
at vboxCOMsdkTest.run(vboxCOMsdkTest.groovy:16)

So, I don't know if this is a problem with loading a local WSDL file, the
fact that there is an import within the WSDL file, or some other goofiness
along the lines of the other two problems with this SDK.

I have attached the WSDL files. Can anyone tell me what's wrong with these
WSDLs, from WSClient's perspective?

At the end of the day, though, I would be happy to access this SDK in any
way that works. If anyone knows why the first two attempts failed, I would
appreciate your input. If soapUI didn't work, I would suspect that
something's wrong with the SDK after three different failures. But soapUI
can do it. Why can't Groovy?

Thanks,
Lee Grey http://www.nabble.com/file/p25173211/vboxwebService.wsdl
vboxwebService.wsdl http://www.nabble.com/file/p25173211/vboxweb.wsdl
vboxweb.wsdl
--
View this message in context: http://www.nabble.com/Unable-to-load-WSDL-from-local-file-into-WSClient-%28the-VirtualBox-SDK-blues%29-tp25173211p25173211.html
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


nabblee

unread,
Aug 27, 2009, 2:19:10 PM8/27/09
to us...@groovy.codehaus.org

yields

Thanks,
Lee Grey
http://www.nabble.com/file/p25173211/vboxwsdl.zip vboxwsdl.zip

nabblee

unread,
Sep 2, 2009, 11:00:31 AM9/2/09
to us...@groovy.codehaus.org

Having gotten no response on the three Groovy failures encountered in this
post, would the appropriate next step be to file bug reports? I just don't
know if the problem is within GroovyWS or with my lack of knowledge on how
to load the large, multi-file, local disk WSDL.

Would the UnsupportedVariantTypeException from Scriptom be considered a bug?

Thanks,
Lee

> http://www.nabble.com/file/p25173211/vboxwsdl.zip vboxwsdl.zip
>

--
View this message in context: http://www.nabble.com/Unable-to-load-WSDL-from-local-file-into-WSClient-%28the-VirtualBox-SDK-blues%29-tp25173211p25259282.html

tog

unread,
Sep 3, 2009, 4:27:05 AM9/3/09
to us...@groovy.codehaus.org
Hi

I just did a simple test embedding the content of vboxwebService.wsdl
in vboxweb.wsdl and it worked using this script:

mport groovyx.net.ws.WSClient

@Grab(group='org.codehaus.groovy.modules', module='groovyws',
version='0.5.1-SNAPSHOT')
def getProxy(wsdl, classLoader) {
new WSClient(wsdl, classLoader)
}

def url = 'file:///Users/alleon/groovy/groovywstest/vboxweb.wsdl'
proxy = getProxy(url, this.class.classLoader)
proxy.initialize()


Cheers
Guillaume

--
PGP KeyID: 1024D/69B00854 subkeys.pgp.net

http://cheztog.blogspot.com

nabblee

unread,
Sep 3, 2009, 9:47:46 PM9/3/09
to us...@groovy.codehaus.org

Hmm... I just tried to reproduce that, but I have not had the same success.

First of all, Grape failed:
Error grabbing Grapes -- [unresolved dependency:
org.codehaus.groovy.modules#groovyws;0.5.1-SNAPSHOT: not found]

So, I downloaded and copied groovyws-0.5.1-20090716.160141-3.jar into my
.groovy/lib directory. I commented out the @Grab line and tried again. I
couldn't even come close until I had copied the entire contents of
apache-cxf-2.2.3/lib into .groovy/lib.

I don't know if the problem is with my environment or with the way I
"embedded" vboxwebService.wsdl into vboxweb.wsdl, but here's what I get in
groovyconsole:

Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in
URL
[jar:file:/C:/Documents%20and%20Settings/lgrey/.groovy/lib/cxf-2.2.3.jar!/META-INF/cxf/cxf.fixml]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
exception; nested exception is java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.cxf.wsdl.WSDLManager' defined in URL
[jar:file:/C:/Documents%20and%20Settings/lgrey/.groovy/lib/cxf-2.2.3.jar!/META-INF/cxf/cxf.fixml]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw
exception; nested exception is java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:826)

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)

at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)

at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:885)

at
org.apache.cxf.bus.spring.BusExtensionPostProcessor$1.findExtension(BusExtensionPostProcessor.java:70)

at org.apache.cxf.bus.CXFBusImpl.getExtension(CXFBusImpl.java:73)

at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:67)

at org.apache.cxf.endpoint.ClientImpl.<init>(ClientImpl.java:146)

at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:253)

at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:196)

at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:175)

at
groovyx.net.ws.AbstractCXFWSClient.createClient(AbstractCXFWSClient.java:187)

at groovyx.net.ws.WSClient.initialize(WSClient.java:107)

at groovyx.net.ws.IWSClient$initialize$0.call(Unknown Source)

at vboxWSsdkTest.run(vboxWSsdkTest.groovy:10)

Caused by: org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor
threw exception; nested exception is java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)

at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)

at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)

... 21 more

Caused by: java.lang.ClassCastException:
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to
javax.xml.parsers.DocumentBuilderFactory

at
org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties(PropertiesLoaderUtils.java:71)

at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:224)

at
org.apache.cxf.wsdl11.WSDLManagerImpl.registerInitialExtensions(WSDLManagerImpl.java:219)

at org.apache.cxf.wsdl11.WSDLManagerImpl.<init>(WSDLManagerImpl.java:109)

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)

... 23 more


Would you mind sending a copy of the combined WSDL file that worked for you,
so I can see how you combined them?

Do you have any idea what the exception means? I don't think I should have
to include all the CXF jars, so I think there's something very wrong with my
environment. I'm quite lost here. No idea why this is such a problem for
me. Thanks for testing the WSDL for me. If you have any idea how I can
recreate your success, I would be very grateful.

Thanks,
Lee

--
View this message in context: http://www.nabble.com/Unable-to-load-WSDL-from-local-file-into-WSClient-%28the-VirtualBox-SDK-blues%29-tp25173211p25286947.html

Reply all
Reply to author
Forward
0 new messages