7 Replies Latest reply on Oct 17, 2005 6:38 PM by yi_zhang

    Document-literal not working with JBoss 4.0.3?

    yi_zhang

      In one of the earlier posts, it was mentioned that "Starting from jboss-4.0.3 we will have doc/lit parameter wrapping. So you would
      be able to use the same SEI for rpc/lit and doc/lit". But I could not get it to work.

      I have a very simple web service that works with "rpc/lit". Then I used JWSDP 1.6 to re-generate the WSDL and JAXRPC mapping files for "doc/lit" and got the following error on 4.0.3:

      22:02:47,661 WARN [TypeMappingDescription] Class not found: com.intuit.spc.getPatch
      22:02:47,661 WARN [TypeMappingDescription] Class not found: com.intuit.spc.getPatchResponse
      endpoint: org.jboss.webservice.client.CallImpl@115273a
      22:02:47,739 ERROR [PortProxy] Port error
      java.lang.IllegalStateException: Cannot obtain type mapping meta data for: {http://spc.intuit.com/oi/messaging/ws/types}getPatch
      at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:154)
      at $Proxy1.getPatch(Unknown Source)
      at com.intuit.offeringIntegration.messaging.ws.GetPatchTest.testGetPatch(GetPatchTest.java:34)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)

      Am I missing something? Any help is appreciated!

      Yi
      [/img]

        • 1. Re: Document-literal not working with JBoss 4.0.3?

          wscompile generates other classes that should be in your bin folder, package with them.

          • 2. Re: Document-literal not working with JBoss 4.0.3?
            yi_zhang

            Alon,

            Thanks for the response. I did package all the generated source files from wscompile with my deployment. From the JBoss console, m web service is deployed successfuly and I can get the WSDL via a browser. Here is my JUnit test:

            public void testGetPatch() throws Exception
            {
            URL url = new URL("http://localhost:8080/spc-oi-getPatchWS-1/GetPatch?wsdl");
            QName serviceName = new QName("http://spc.intuit.com/oi/messaging/ws", "GetPatchService");
            ServiceFactory factory = ServiceFactory.newInstance();
            Service service = factory.createService(url, serviceName);
            GetPatch endpoint = (GetPatch) service.getPort(GetPatch.class);
            System.out.println("endpoint: " + endpoint.toString());
            String response = endpoint.getPatch("client1", "channelGetPath");
            System.out.print("Got response: " + response);
            }

            Could it be the test code?

            Thanks,
            Yi

            • 3. Re: Document-literal not working with JBoss 4.0.3?

              1. try to modify the log4j config in the conf folder to work in debug mode , and to follow the exception in the verbosed log file that will be created.

              2. please attach your wsCompile params, config.xml , wsdd , mappings ,wsdl

              • 4. Re: Document-literal not working with JBoss 4.0.3?
                yi_zhang

                Hi Alon,

                Thanks for the suggestions. Here are the files and information as you requested:

                wscompile params (I'm using 1.6):

                wscompile -cp target/classes -gen:server -f:documentliteral -f:wsi -keep -d target/classes -nd src/resources/META-INF/wsdl -s src/java -mapping src/resources/META-INF/GetPathService_JAXRPC_Mapping.xml config.xml
                


                The WSDL file:
                <?xml version="1.0" encoding="UTF-8"?>
                <definitions name="GetPatchService" targetNamespace="http://spc.intuit.com/oi/messaging/ws" xmlns:tns="http://spc.intuit.com/oi/messaging/ws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://spc.intuit.com/oi/messaging/ws/types" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
                 <types>
                 <schema targetNamespace="http://spc.intuit.com/oi/messaging/ws/types" xmlns:tns="http://spc.intuit.com/oi/messaging/ws/types" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.w3.org/2001/XMLSchema">
                
                 <element name="getPatch">
                 <complexType>
                 <sequence>
                 <element name="String_1" type="string" nillable="true"/>
                 <element name="String_2" type="string" nillable="true"/>
                 </sequence>
                 </complexType>
                 </element>
                 <element name="getPatchResponse">
                 <complexType>
                 <sequence>
                 <element name="result" type="string" nillable="true"/>
                 </sequence>
                 </complexType>
                 </element>
                 </schema>
                 </types>
                 <message name="GetPatch_getPatch">
                 <part name="parameters" element="ns2:getPatch"/>
                 </message>
                 <message name="GetPatch_getPatchResponse">
                 <part name="result" element="ns2:getPatchResponse"/>
                 </message>
                 <portType name="GetPatch">
                 <operation name="getPatch">
                 <input message="tns:GetPatch_getPatch"/>
                 <output message="tns:GetPatch_getPatchResponse"/>
                 </operation>
                 </portType>
                 <binding name="GetPatchBinding" type="tns:GetPatch">
                 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
                 <operation name="getPatch">
                 <soap:operation soapAction=""/>
                 <input>
                 <soap:body use="literal"/>
                 </input>
                 <output>
                 <soap:body use="literal"/>
                 </output>
                 </operation>
                 </binding>
                 <service name="GetPatchService">
                 <port name="GetPatchPort" binding="tns:GetPatchBinding">
                 <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
                 </port>
                 </service>
                </definitions>
                


                The JAXRPC mapping file:
                <?xml version="1.0" encoding="UTF-8"?>
                <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
                 <package-mapping>
                 <package-type>com.intuit.offeringIntegration.messaging.ws</package-type>
                 <namespaceURI>http://spc.intuit.com/oi/messaging/ws/types</namespaceURI>
                 </package-mapping>
                 <package-mapping>
                 <package-type>com.intuit.offeringIntegration.messaging.ws</package-type>
                 <namespaceURI>http://spc.intuit.com/oi/messaging/ws</namespaceURI>
                 </package-mapping>
                 <java-xml-type-mapping>
                 <java-type>com.intuit.offeringIntegration.messaging.ws.GetPatch_getPatch_RequestStruct</java-type>
                 <root-type-qname xmlns:typeNS="http://spc.intuit.com/oi/messaging/ws/types">typeNS:getPatch</root-type-qname>
                 <qname-scope>complexType</qname-scope>
                 <variable-mapping>
                 <java-variable-name>String_1</java-variable-name>
                 <xml-element-name>String_1</xml-element-name>
                 </variable-mapping>
                 <variable-mapping>
                 <java-variable-name>String_2</java-variable-name>
                 <xml-element-name>String_2</xml-element-name>
                 </variable-mapping>
                 </java-xml-type-mapping>
                 <java-xml-type-mapping>
                 <java-type>com.intuit.offeringIntegration.messaging.ws.GetPatch_getPatch_ResponseStruct</java-type>
                 <root-type-qname xmlns:typeNS="http://spc.intuit.com/oi/messaging/ws/types">typeNS:getPatchResponse</root-type-qname>
                 <qname-scope>complexType</qname-scope>
                 <variable-mapping>
                 <java-variable-name>result</java-variable-name>
                 <xml-element-name>result</xml-element-name>
                 </variable-mapping>
                 </java-xml-type-mapping>
                 <service-interface-mapping>
                 <service-interface>com.intuit.offeringIntegration.messaging.ws.GetPatchService</service-interface>
                 <wsdl-service-name xmlns:serviceNS="http://spc.intuit.com/oi/messaging/ws">serviceNS:GetPatchService</wsdl-service-name>
                 <port-mapping>
                 <port-name>GetPatchPort</port-name>
                 <java-port-name>GetPatchPort</java-port-name>
                 </port-mapping>
                 </service-interface-mapping>
                 <service-endpoint-interface-mapping>
                 <service-endpoint-interface>com.intuit.offeringIntegration.messaging.ws.GetPatch</service-endpoint-interface>
                 <wsdl-port-type xmlns:portTypeNS="http://spc.intuit.com/oi/messaging/ws">portTypeNS:GetPatch</wsdl-port-type>
                 <wsdl-binding xmlns:bindingNS="http://spc.intuit.com/oi/messaging/ws">bindingNS:GetPatchBinding</wsdl-binding>
                 <service-endpoint-method-mapping>
                 <java-method-name>getPatch</java-method-name>
                 <wsdl-operation>getPatch</wsdl-operation>
                 <wrapped-element/>
                 <method-param-parts-mapping>
                 <param-position>0</param-position>
                 <param-type>java.lang.String</param-type>
                 <wsdl-message-mapping>
                 <wsdl-message xmlns:wsdlMsgNS="http://spc.intuit.com/oi/messaging/ws">wsdlMsgNS:GetPatch_getPatch</wsdl-message>
                 <wsdl-message-part-name>String_1</wsdl-message-part-name>
                 <parameter-mode>IN</parameter-mode>
                 </wsdl-message-mapping>
                 </method-param-parts-mapping>
                 <method-param-parts-mapping>
                 <param-position>1</param-position>
                 <param-type>java.lang.String</param-type>
                 <wsdl-message-mapping>
                 <wsdl-message xmlns:wsdlMsgNS="http://spc.intuit.com/oi/messaging/ws">wsdlMsgNS:GetPatch_getPatch</wsdl-message>
                 <wsdl-message-part-name>String_2</wsdl-message-part-name>
                 <parameter-mode>IN</parameter-mode>
                 </wsdl-message-mapping>
                 </method-param-parts-mapping>
                 <wsdl-return-value-mapping>
                 <method-return-value>java.lang.String</method-return-value>
                 <wsdl-message xmlns:wsdlMsgNS="http://spc.intuit.com/oi/messaging/ws">wsdlMsgNS:GetPatch_getPatchResponse</wsdl-message>
                 <wsdl-message-part-name>result</wsdl-message-part-name>
                 </wsdl-return-value-mapping>
                 </service-endpoint-method-mapping>
                 </service-endpoint-interface-mapping>
                </java-wsdl-mapping>
                

                The JBoss generated WSDD file:
                 <deployment
                 xmlns='http://xml.apache.org/axis/wsdd/'
                 xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
                 xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
                 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
                 xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
                
                <service name='spc-oi-getPatchWS-1.0.jar#GetPatchService/GetPatch' style='document' use='literal' provider='Handler'>
                
                 <parameter name='webserviceID' value='spc-oi-getPatchWS-1.0.jar#GetPatchService/GetPatch' />
                 <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB' />
                
                 <operation name='getPatch' qname='ns1:getPatch' returnQName='ns2:getPatchResponse' returnType='ns2:getPatchResponse' xmlns:ns1='http://spc.intuit.com/oi/messaging/ws' xmlns:ns2='http://spc.intuit.com/oi/messaging/ws/types' >
                 <parameter name='parameters' qname='ns2:getPatch' mode='IN' type='ns2:getPatch' xmlns:ns2='http://spc.intuit.com/oi/messaging/ws/types' />
                 </operation>
                
                 <typeMapping
                 qname='ns2:getPatch' xmlns:ns2='http://spc.intuit.com/oi/messaging/ws/types'
                 type='java:com.intuit.offeringIntegration.messaging.ws.GetPatch_getPatch_RequestStruct'
                 serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
                 deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
                 encodingStyle=''>
                 <typeDesc>
                 <elementDesc fieldName='String_1' xmlName='String_1'/>
                 <elementDesc fieldName='String_2' xmlName='String_2'/>
                 <elementOrder>
                 <element name='String_1'/>
                 <element name='String_2'/>
                 </elementOrder>
                 </typeDesc>
                 </typeMapping>
                
                 <typeMapping
                 qname='ns2:getPatchResponse' xmlns:ns2='http://spc.intuit.com/oi/messaging/ws/types'
                 type='java:com.intuit.offeringIntegration.messaging.ws.GetPatch_getPatch_ResponseStruct'
                 serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory'
                 deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory'
                 encodingStyle=''>
                 <typeDesc>
                 <elementDesc fieldName='result' xmlName='result'/>
                 <elementOrder>
                 <element name='result'/>
                 </elementOrder>
                 </typeDesc>
                 </typeMapping>
                </service>
                </deployment>
                


                And finally, the error messages with DEBUG on:

                2005-10-13 16:35:59,975 DEBUG [org.jboss.webservice.EngineConfigurationFinder] Found config at: jar:file:/C:/Documents%20and%20Settings/YZhang/.maven/repository/jboss/jars/jboss-ws4ee-client-4.0.3.jar!/META-INF/axis-client-config.xml
                2005-10-13 16:35:59,975 DEBUG [org.jboss.axis.AxisEngine] Enter: AxisEngine::init
                2005-10-13 16:36:00,257 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] getBundle(org.jboss.axis,org.jboss.axis.i18n,resource,null,...)
                2005-10-13 16:36:00,272 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] loadBundle: Ignoring MissingResourceException: Can't find bundle for base name org.jboss.axis.resource, locale en_US
                2005-10-13 16:36:00,272 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] Created org.jboss.axis.i18n.resource, linked to parent null
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] getBundle(org.jboss.axis,org.jboss.axis.utils,resource,null,...)
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] loadBundle: Ignoring MissingResourceException: Can't find bundle for base name org.jboss.axis.utils.resource, locale en_US
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] loadBundle: Ignoring MissingResourceException: Can't find bundle for base name org.jboss.axis.resource, locale en_US
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] Root package not found, cross link to org.jboss.axis.i18n.resource
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.i18n.ProjectResourceBundle] Root package not found, cross link to org.jboss.axis.i18n.resource
                2005-10-13 16:36:00,288 DEBUG [org.jboss.axis.utils.JavaUtils] Attachment support is enabled? false
                2005-10-13 16:36:00,491 DEBUG [org.jboss.axis.AxisEngine] Exit: AxisEngine::init
                2005-10-13 16:36:00,772 DEBUG [org.jboss.webservice.metadata.wsdl.WSDL11DefinitionFactory] getBaseInputSource [wsdlUrl=http://localhost:8080/spc-oi-getPatchWS-1/GetPatch?wsdl]
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.deployment.ServiceDescription] Using type uri to obtain package: http://spc.intuit.com/oi/messaging/ws/types -> com.intuit.spc
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.deployment.ServiceDescription] Guessing the javaType from typeQName: {http://spc.intuit.com/oi/messaging/ws/types}getPatch -> com.intuit.spc.getPatch
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.deployment.ServiceDescription] Using type uri to obtain package: http://spc.intuit.com/oi/messaging/ws/types -> com.intuit.spc
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.deployment.ServiceDescription] Guessing the javaType from typeQName: {http://spc.intuit.com/oi/messaging/ws/types}getPatchResponse -> com.intuit.spc.getPatchResponse
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.deployment.ServiceDescription] No ws4ee deployment meta data available
                2005-10-13 16:36:00,866 DEBUG [org.jboss.webservice.client.ServiceImpl] initService: port=GetPatchPort
                2005-10-13 16:36:00,882 WARN [org.jboss.webservice.deployment.TypeMappingDescription] Class not found: com.intuit.spc.getPatch
                2005-10-13 16:36:00,882 WARN [org.jboss.webservice.deployment.TypeMappingDescription] Class not found: com.intuit.spc.getPatchResponse
                2005-10-13 16:36:00,913 DEBUG [org.jboss.axis.client.Call] Transport is org.jboss.axis.transport.http.HTTPTransport@1f26605
                2005-10-13 16:36:00,944 DEBUG [org.jboss.webservice.client.PortProxy] Invoke on object: toString
                2005-10-13 16:36:00,944 DEBUG [org.jboss.webservice.client.PortProxy] Invoke on service endpoint interface: getPatch
                2005-10-13 16:36:00,975 DEBUG [org.jboss.axis.client.Call] Removing leading '>' from anonymous type{http://spc.intuit.com/oi/messaging/ws/types}>getPatchResponse
                2005-10-13 16:36:00,975 DEBUG [org.jboss.webservice.client.CallImpl] Fixing style: [was=rpc,is=document]
                2005-10-13 16:36:00,975 DEBUG [org.jboss.webservice.client.CallImpl] Fixing use: [was=encoded,is=literal]
                2005-10-13 16:36:00,975 ERROR [org.jboss.webservice.client.PortProxy] Port error
                java.lang.IllegalStateException: Cannot obtain type mapping for: {http://spc.intuit.com/oi/messaging/ws/types}>getPatch
                at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:150)
                at $Proxy1.getPatch(Unknown Source)
                at com.intuit.offeringIntegration.messaging.ws.GetPatchTest.testGetPatch_RPC(GetPatchTest.java:49)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at junit.framework.TestCase.runTest(TestCase.java:154)
                at junit.framework.TestCase.runBare(TestCase.java:127)
                at junit.framework.TestResult$1.protect(TestResult.java:106)
                at junit.framework.TestResult.runProtected(TestResult.java:124)
                at junit.framework.TestResult.run(TestResult.java:109)
                at junit.framework.TestCase.run(TestCase.java:118)
                at junit.framework.TestSuite.runTest(TestSuite.java:208)
                at junit.framework.TestSuite.run(TestSuite.java:203)
                at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
                at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
                at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)



                • 5. Re: Document-literal not working with JBoss 4.0.3?
                  yi_zhang

                  Oh, forgot the webservices.xml:

                   <webservices xmlns="http://java.sun.com/xml/ns/j2ee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
                   version="1.1">
                  
                   <webservice-description>
                   <webservice-description-name>GetPatchService</webservice-description-name>
                   <wsdl-file>META-INF/wsdl/GetPatchService.wsdl</wsdl-file>
                   <jaxrpc-mapping-file>META-INF/GetPathService_JAXRPC_Mapping.xml</jaxrpc-mapping-file>
                  
                   <port-component>
                   <port-component-name>GetPatch</port-component-name>
                   <wsdl-port>GetPatchPort</wsdl-port>
                   <service-endpoint-interface>com.intuit.offeringIntegration.messaging.ws.GetPatch</service-endpoint-interface>
                   <service-impl-bean>
                   <ejb-link>GetPatchBean</ejb-link>
                   </service-impl-bean>
                   </port-component>
                   </webservice-description>
                  </webservices>
                  


                  And the config.xml used for wscompile:
                  <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
                   <service name="GetPatchService"
                   targetNamespace="http://spc.intuit.com/oi/messaging/ws"
                   typeNamespace="http://spc.intuit.com/oi/messaging/ws/types"
                   packageName="com.intuit.offeringIntegration.messaging.ws">
                   <interface name="com.intuit.offeringIntegration.messaging.ws.GetPatch"/>
                   </service>
                  </configuration>
                  


                  • 6. Re: Document-literal not working with JBoss 4.0.3?

                    look , it make sense to me that the problem is in the client i suggest:
                    1.make sure u wrap all your parameters with object (dont use Int or String as parameter)

                    2.as u can see in the wiki,
                    make sure that u use wscompile with the -keep flag to create the sources for the request and response messages, edit your source files after that, make sure your methods are using the request and response structs generated by wscompile instead of your methods params and your methods return types.

                    3.
                    (most important)
                    use wscompile to generate the client related stubs , and use them.
                    there is a sensitive issue regarding the parameters wrapping and wscompile that sometimes leads to unclear exceptions, so using wscompile with -gen:client and also f:wsi will assure that the params fit.

                    Alon.

                    • 7. Re: Document-literal not working with JBoss 4.0.3?
                      yi_zhang

                      After switching to JBoss specific code (for the client), the client worked. Thanks guys!