[JBossWS] - JBoss wstool generate incorrect WSDL file
by mendaye
Hello All:
I am using JBOSS 4.0.4 to do web services development. I have created WSDL and all other XML file for my EJB end-point using JBoss wstool. I have successfully deployed and tested this Web Service. However, it worked fine when the rutun type of the methods are Java primitave types. For some reason it doesn't work for Java Collection type (ArrayList, Hashtable, Hashmap) - I get exception from JBoss Server "XML document structures must start and end within the same entity" - I look deep into WSDL file, it seems the complex data type generated for these collection classes and custom object is wrong. I have attached the code, WSDL and other XML file. I am not sure if I miss something here. Please help!!!
JBoss ant task
| <taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
| <classpath refid="base.libraries"/>
| <classpath refid="client.classpath"/>
| <classpath path="${api.classpath.dir}"/>
| <classpath path="${db.classpath.dir}"/>
| <!-- <classpath path="${util.classpath.dir}"/> -->
| </taskdef>
| <wstools dest="${dest.dir}" config="${cnfg.dir}/wstools-config.xml"/>
|
wstools-config.xml file
|
| <?xml version="1.0" encoding="UTF-8"?>
| <configuration
| xmlns="http://www.jboss.org/jbossws-tools"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://www.jboss.org/jbossws-tools
| http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
| <java-wsdl>
| <service name="PVNGDeviceService" style="document"
| endpoint="com.panduit.pvng.service.api.db.interfaces.DeviceEndpoint"/>
| <namespaces
| target-namespace="http://db.panduit.com/dbaccess"
| type-namespace="http://db.panduit.com/dbaccess/types"/>
| <mapping file="jaxrpc-mapping.xml"/>
| <webservices ejb-link="PVNGDevice"/>
| </java-wsdl>
| </configuration>
|
|
Generated WSDL file - Please look at the bold part for complex data type.
| <?xml version="1.0" encoding="UTF-8"?>
| <definitions name='PVNGDeviceService' targetNamespace='http://db.panduit.com/dbaccess' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://db.panduit.com/dbaccess/types' xmlns:ns2='http://util.java/jaws' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://db.panduit.com/dbaccess' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <schema targetNamespace='http://db.panduit.com/dbaccess/types' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://util.java/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://db.panduit.com/dbaccess/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <import namespace='http://util.java/jaws'/>
| <complexType name='getAllHashValues'>
| <sequence>
| <element name='String_1' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <complexType name='getAllHashValuesResponse'>
| <sequence>
| <element name='result' nillable='true' type='ns2:Hashtable'/>
| </sequence>
| </complexType>
| <complexType name='getAllNames'>
| <sequence>
| <element name='String_1' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <complexType name='getAllNamesResponse'>
| <sequence>
| <element name='result' nillable='true' type='ns2:Vector'/>
| </sequence>
| </complexType>
| <complexType name='getAllValues'>
| <sequence>
| <element name='String_1' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <complexType name='getAllValuesResponse'>
| <sequence>
| <element name='result' nillable='true' type='ns2:HashMap'/>
| </sequence>
| </complexType>
| <complexType name='PVNGAPIException'>
| <sequence>
| <element name='errorMessage' nillable='true' type='string'/>
| <element name='methodName' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <complexType name='getNames'>
| <sequence/>
| </complexType>
| <complexType name='getNamesResponse'>
| <sequence>
| <element name='result' nillable='true' type='ns2:ArrayList'/>
| </sequence>
| </complexType>
| <element name='getAllHashValues' type='tns:getAllHashValues'/>
| <element name='getAllHashValuesResponse' type='tns:getAllHashValuesResponse'/>
| <element name='getAllNames' type='tns:getAllNames'/>
| <element name='getAllNamesResponse' type='tns:getAllNamesResponse'/>
| <element name='getAllValues' type='tns:getAllValues'/>
| <element name='getAllValuesResponse' type='tns:getAllValuesResponse'/>
| <element name='PVNGAPIException' type='tns:PVNGAPIException'/>
| <element name='getNames' type='tns:getNames'/>
| <element name='getNamesResponse' type='tns:getNamesResponse'/>
| </schema>
| <schema targetNamespace='http://util.java/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://db.panduit.com/dbaccess/types' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://util.java/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <import namespace='http://db.panduit.com/dbaccess/types'/>
| <complexType name='ArrayList'>
| <sequence>
| <element name='empty' type='boolean'/>
| </sequence>
| </complexType>
| <complexType name='HashMap'>
| <sequence>
| <element name='empty' type='boolean'/>
| </sequence>
| </complexType>
| <complexType name='Hashtable'>
| <sequence>
| <element name='empty' type='boolean'/>
| </sequence>
| </complexType>
| <complexType name='Vector'>
| <sequence>
| <element name='empty' type='boolean'/>
| <element name='size' type='int'/>
| </sequence>
| </complexType>
| </schema>
| </types>
| <message name='DeviceEndpoint_getAllHashValues'>
| <part element='ns1:getAllHashValues' name='parameters'/>
| </message>
| <message name='DeviceEndpoint_getAllHashValuesResponse'>
| <part element='ns1:getAllHashValuesResponse' name='result'/>
| </message>
| <message name='PVNGAPIException'>
| <part element='ns1:PVNGAPIException' name='PVNGAPIException'/>
| </message>
| <message name='DeviceEndpoint_getAllNames'>
| <part element='ns1:getAllNames' name='parameters'/>
| </message>
| <message name='DeviceEndpoint_getAllNamesResponse'>
| <part element='ns1:getAllNamesResponse' name='result'/>
| </message>
| <message name='DeviceEndpoint_getAllValues'>
| <part element='ns1:getAllValues' name='parameters'/>
| </message>
| <message name='DeviceEndpoint_getAllValuesResponse'>
| <part element='ns1:getAllValuesResponse' name='result'/>
| </message>
| <message name='DeviceEndpoint_getNames'>
| <part element='ns1:getNames' name='parameters'/>
| </message>
| <message name='DeviceEndpoint_getNamesResponse'>
| <part element='ns1:getNamesResponse' name='result'/>
| </message>
| <portType name='DeviceEndpoint'>
| <operation name='getAllHashValues'>
| <input message='tns:DeviceEndpoint_getAllHashValues'/>
| <output message='tns:DeviceEndpoint_getAllHashValuesResponse'/>
| <fault message='tns:PVNGAPIException' name='PVNGAPIException'/>
| </operation>
| <operation name='getAllNames'>
| <input message='tns:DeviceEndpoint_getAllNames'/>
| <output message='tns:DeviceEndpoint_getAllNamesResponse'/>
| <fault message='tns:PVNGAPIException' name='PVNGAPIException'/>
| </operation>
| <operation name='getAllValues'>
| <input message='tns:DeviceEndpoint_getAllValues'/>
| <output message='tns:DeviceEndpoint_getAllValuesResponse'/>
| <fault message='tns:PVNGAPIException' name='PVNGAPIException'/>
| </operation>
| <operation name='getNames'>
| <input message='tns:DeviceEndpoint_getNames'/>
| <output message='tns:DeviceEndpoint_getNamesResponse'/>
| <fault message='tns:PVNGAPIException' name='PVNGAPIException'/>
| </operation>
| </portType>
| <binding name='DeviceEndpointBinding' type='tns:DeviceEndpoint'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='getAllHashValues'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| <fault name='PVNGAPIException'>
| <soap:fault name='PVNGAPIException' use='literal'/>
| </fault>
| </operation>
| <operation name='getAllNames'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| <fault name='PVNGAPIException'>
| <soap:fault name='PVNGAPIException' use='literal'/>
| </fault>
| </operation>
| <operation name='getAllValues'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| <fault name='PVNGAPIException'>
| <soap:fault name='PVNGAPIException' use='literal'/>
| </fault>
| </operation>
| <operation name='getNames'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| <fault name='PVNGAPIException'>
| <soap:fault name='PVNGAPIException' use='literal'/>
| </fault>
| </operation>
| </binding>
| <service name='PVNGDeviceService'>
| <port binding='tns:DeviceEndpointBinding' name='DeviceEndpointPort'>
| <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
| </port>
| </service>
| </definitions>
|
EJB endpoint remote interface that return collection Vector, ArratList, Hashtable etc..
|
| public interface DeviceEndpoint extends Remote {
| public ArrayList<String> getNames() throws RemoteException, PVNGAPIException;
| public Vector<String> getAllNames(String s) throws RemoteException, PVNGAPIException;
| public HashMap <String, ArrayList> getAllValues(String s) throws RemoteException, PVNGAPIException;
| public Hashtable <String, ArrayList> getAllHashValues(String s) throws RemoteException, PVNGAPIException;
|
|
Please let me know if there is any workaround to this issue.
Regards,
Surafel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081896#4081896
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081896
17 years, 3 months
[JBossWS] - Accessing a Java JBossWS WebService from VBScript not workin
by gbc@gmx.de
Hello,
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081893#4081893
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081893
17 years, 3 months
[JBossWS] - Re: Secure Webservice
by rbellia
I have the same probelm with JBoss AS 4.2.1 ...
The endpoint:
| @Stateless @WebService
| @RolesAllowed({"clerk"})
| public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
|
| @Resource SessionContext sessionCtx;
|
| public Integer sum(Integer a, Integer b) {
| System.out.println("who is it ? " + sessionCtx.getCallerPrincipal());
| return a + b;
| }
|
| }
|
The client:
| CalculatorBeanService service = new CalculatorBeanService();
| CalculatorBean port = service.getCalculatorBeanPort();
| BindingProvider bp = (BindingProvider) port;
| bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/CalculatorBeanService/CalculatorBean");
| bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user1");
| bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password1");
|
| // TODO initialize WS operation arguments here
| java.lang.Integer result = port.sum(4002, 450);
| System.out.println("Result = "+result);
|
The exception:
javax.xml.ws.soap.SOAPFaultException: Authorization failure
|
The security domain works fine if I use a remote EJB client.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081727#4081727
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081727
17 years, 3 months