Accessing a Java JBossWS WebService from VBScript not workin
gbc1 Sep 6, 2007 6:28 PMHello,
I ran into the situation to call a Java WebService from within a .vbs file. I created a simple WebService and after searching the net and the forum I ended up with this. My method is being called at least, but my .vbs variable is null afterward. I have no clue what to do next...
After first failing, I already installed MS SoapToolkit 2.0 and my .vbs is now:
Option Explicit Dim c, wsdl wsdl = "http://localhost:8080/SimpleWebServices/SimpleWeb?wsdl" set c = CreateObject("MSSOAP.SOAPClient") c.mssoapinit(wsdl) c.isAlive
My WebService:
@Stateless @WebService @WebContext(contextRoot="/SimpleWebServices") @SOAPBinding(style = SOAPBinding.Style.RPC) public class SimpleWeb implements SimpleWebInterface { @Logger Log log; @WebMethod public void isAlive() { System.out.println("SimpleWeb.isAlive()"); } }
I'm using Java 1.5, JBoss 4.2 GA (with JBosWS1.2.1GA) and JBoss Seam 2.0 Beta1 (well, shouldn't matter in this case imho, because the WebService isn't a Seam component)
My standard-jaxws-endpoint-config.xml:
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd"> <endpoint-config> <config-name>Seam WebService Endpoint</config-name> <pre-handler-chains> <javaee:handler-chain> <javaee:protocol-bindings> ##SOAP11_HTTP </javaee:protocol-bindings> <javaee:handler> <javaee:handler-name> SOAP Request Handler </javaee:handler-name> <javaee:handler-class> org.jboss.seam.webservice.SOAPRequestHandler </javaee:handler-class> </javaee:handler> </javaee:handler-chain> </pre-handler-chains> </endpoint-config> </jaxws-config>
Finaly here's the generated wsdl:
<definitions name='SimpleWebService' targetNamespace='http://webservice.simple/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://webservice.simple/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <types></types> <message name='SimpleWeb_isAliveResponse'></message> <message name='SimpleWeb_isAlive'></message> <portType name='SimpleWeb'> <operation name='isAlive'> <input message='tns:SimpleWeb_isAlive'></input> <output message='tns:SimpleWeb_isAliveResponse'></output> </operation> </portType> <binding name='SimpleWebBinding' type='tns:SimpleWeb'> <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='isAlive'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webservice.simple/' use='literal'/> </input> <output> <soap:body namespace='http://webservice.simple/' use='literal'/> </output> </operation> </binding> <service name='SimpleWebService'> <port binding='tns:SimpleWebBinding' name='SimpleWebPort'> <soap:address location='http://localhost:8080/SimpleWebServices/SimpleWeb'/> </port> </service> </definitions>
Executing my .vbs script gives following output
C:\Data\PrintServerProcessor>cscript PrintServerProcesser.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. C:\Data\PrintServerProcessor\PrintServerProcesser.vbs(17, 1) (null): Unspecified error
Looking into JBoss Log after switching to TRACE level for JBossWS I saw that calls are going in and out and my method is being called:
2007-09-07 00:10:45,828 TRACE [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] BEFORE handleRequest - org.jboss.seam.webservice.SOAPRequestHandler@1fe0dcb <SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'> <SOAP-ENV:Header/> <SOAP-ENV:Body> <m:isAlive xmlns:m='http://webservice.simple/'/> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 2007-09-07 00:10:45,828 TRACE [org.jboss.ws.core.CommonMessageContext] put: APPLICATION:org.jboss.ws.allow.expand.dom=true 2007-09-07 00:10:45,828 TRACE [org.jboss.ws.core.CommonMessageContext] get(javax.xml.ws.handler.message.outbound): APPLICATION:javax.xml.ws.handler.message.outbound=false 2007-09-07 00:10:45,828 TRACE [org.jboss.ws.core.CommonMessageContext] get(javax.xml.ws.servlet.request): APPLICATION:javax.xml.ws.servlet.request=org.apache.catalina.connector.RequestFacade@20e54a 2007-09-07 00:10:45,859 TRACE [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] AFTER handleRequest - org.jboss.seam.webservice.SOAPRequestHandler@1fe0dcb: unchanged 2007-09-07 00:10:45,859 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] Exit: handleIn BoundMessage with status: true 2007-09-07 00:10:45,859 TRACE [org.jboss.ws.core.CommonMessageContext] put: APPLICATION:org.jboss.ws.allow.expand.dom=true 2007-09-07 00:10:45,875 DEBUG [org.jboss.ws.integration.jboss42.ServiceEndpointInvokerEJB3] invokeServiceEndpoint: isAlive 2007-09-07 00:10:45,875 DEBUG [org.jboss.ws.core.EndpointInvocation] getRequestPayload 2007-09-07 00:10:46,000 INFO [STDOUT] SimpleWeb.isAlive() 2007-09-07 00:10:46,000 DEBUG [org.jboss.ws.core.EndpointInvocation] setReturnValue: null
Using @Oneway as suggest in a Thread does not work because my .vbs gives error that ResponseType is empty.
Well, I guess, the wsdl or the answer is not parsed correctly because it's empty or something like that, as c is getting null (should not happen ;-). What do I miss/did wrong?
I would appriciate any help. Thank you!
Greetz, GHad