7 Replies Latest reply on Feb 23, 2005 9:02 AM by Thomas Diesler

    Almost there

    Paul Casal Newbie

      Hello,

      I am trying to migrate from Jboss 3.2.3 to 4.01. The real problem is with web services. I know that it was necessary to trash Jboss.net, but how much difficult things are now, and how frustrating to have to redo something that works... :(
      Anyways, frustration aside, I might be not too far from making it. This is a very simple, one method web service that returns a custom object. My latest problem is that when I call the web service. The following exception is thrown by Jboss in the server.

      java.io.IOException: No serializer found for class com.acme.betty.server.invoice.InvoiceWS in registry org.apache.axis.encoding.TypeMappingImpl@ 100124f
      at org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1476)
      at org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:888)
      at org.apache.axis.encoding.SerializationContextImpl.outputMultiRefs(SerializationContextImpl.java:949)
      *************

      This is the endpoint interface:

      package com.acme.betty.server.invoice;

      import java.rmi.Remote;
      import java.rmi.RemoteException;

      public interface InvoiceService extends Remote {
      public InvoiceWS get(Integer invoiceId)
      throws RemoteException;
      }
      *************

      The webservice.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>invoice</webservice-description-name>
      <wsdl-file>META-INF/wsdl/invoice.wsdl</wsdl-file>
      <jaxrpc-mapping-file>META-INF/ws-mapping.xml</jaxrpc-mapping-file>
      <port-component>
      <port-component-name>invoice</port-component-name>
      <wsdl-port>InvoiceServicePort</wsdl-port>
      <service-endpoint-interface>
      com.acme.betty.server.invoice.InvoiceService
      </service-endpoint-interface>
      <service-impl-bean>
      <ejb-link>InvoiceSession</ejb-link>
      </service-impl-bean>
      </port-component>
      </webservice-description>

      **************************

      The jaxrpc-mapping-file

      <java-wsdl-mapping 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_jaxrpc_mapping_1_1.xsd"
      version="1.1">

      <package-mapping>
      <package-type>com.acme.betty.server</package-type>
      http://www.acme.com
      </package-mapping>
      </java-wsdl-mapping>
      ***************************

      And the ws4ee-deployment.xml

      <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/2000/10/XMLSchema-instance'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

      <typeMapping
      qname='ns1:InvoiceWS' xmlns:ns1='http://www.acme.com'
      type='java:com.acme.betty.server.invoice.InvoiceWS'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      ***************************

      Are there any examples or tutorials out there with custom objects being returned by a web services in JbossWS? The example in the getting started document doesn't even talk about the file ws2ee-deployment.xml.

      Thank you very much for any hint you can give me.
      Take care,

      gr

        • 2. Re: Almost there
          Thomas Diesler Master

          The frustration comes from switching from a propriatory solution to standard solution, which is at first sight a good thing. Agreed, presently WS4EE is far from being user friendly.

          You jaxrpc-mapping seems incomplete. Try to generate it with JWSDP wscompile. You might not need ws4ee-deployment.xml

          • 3. Re: Almost there
            Paul Casal Newbie

            Hi Thomas.

            Thanks for your answer. I am happy to be moving towards the standard web services implementation, as specified in J2EE. The problem is that I was expecting some xdoclet tags and ant tasks to help with the DDs. In Jboss.net it was great not to have to deal with descriptors ;)

            Well, I followed your advice, and got a jaxrpc-mapping from JWSDP. I was quite excited to see a 10K file with lots of mappings (compared with my 10 lines file...). Sadly, I am still getting the same exception from the server. I have attached the config file, and resulting jaxrpc-mapping file at the bottom. Please, if you have any ideas on how to solve ths I would very much appreciate.

            Command line to get the mapping and wsdl file:
            c:\bop\tools\jwsdp-1.5\jaxrpc\bin\wscompile.bat -cp C:\bop\betty\build\classes -gen:server -f:rpcliteral -d C:\bop\betty\build\ws -f:explicitcontext -keep -mapping C:\bop\betty\build\ws\ws-mapping.xml C:\bop\betty\src\descriptors\jboss\ws-config.xml


            config file:
            <?xml version="1.0" encoding="UTF-8"?>








            Genearted mapping file:

            <?xml version="1.0" encoding="UTF-8"?>
            <java-wsdl-mapping version="1.1" 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_jaxrpc_mapping_1_1.xsd">
            <package-mapping>
            <package-type>com.acme.betty.server.invoice</package-type>
            http://www.acme.com/types
            </package-mapping>
            <package-mapping>
            <package-type>com.acme.betty.server.invoice</package-type>
            http://www.acme.com
            </package-mapping>
            <package-mapping>
            <package-type>com.acme.betty.server.invoice._arrays.com.acme.betty.server.invoice</package-type>
            http://www.acme.com/types/arrays/com/acme/betty/server/invoice
            </package-mapping>
            <java-xml-type-mapping>
            <java-type>com.acme.betty.server.entity.InvoiceLineDTO</java-type>
            <root-type-qname xmlns:typeNS="http://www.acme.com/types">typeNS:InvoiceLineDTO</root-type-qname>
            <qname-scope>complexType</qname-scope>
            <variable-mapping>
            <java-variable-name>amount</java-variable-name>
            <xml-element-name>amount</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>deleted</java-variable-name>
            <xml-element-name>deleted</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>description</java-variable-name>
            <xml-element-name>description</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>id</java-variable-name>
            <xml-element-name>id</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>itemId</java-variable-name>
            <xml-element-name>itemId</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>price</java-variable-name>
            <xml-element-name>price</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>primaryKey</java-variable-name>
            <xml-element-name>primaryKey</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>quantity</java-variable-name>
            <xml-element-name>quantity</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>sourceUserId</java-variable-name>
            <xml-element-name>sourceUserId</xml-element-name>
            </variable-mapping>
            </java-xml-type-mapping>
            <java-xml-type-mapping>
            <java-type>com.acme.betty.server.invoice.InvoiceWS</java-type>
            <root-type-qname xmlns:typeNS="http://www.acme.com/types">typeNS:InvoiceWS</root-type-qname>
            <qname-scope>complexType</qname-scope>
            <variable-mapping>
            <java-variable-name>balance</java-variable-name>
            <xml-element-name>balance</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>carriedBalance</java-variable-name>
            <xml-element-name>carriedBalance</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>createDateTime</java-variable-name>
            <xml-element-name>createDateTime</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>currencyId</java-variable-name>
            <xml-element-name>currencyId</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>customerNotes</java-variable-name>
            <xml-element-name>customerNotes</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>deleted</java-variable-name>
            <xml-element-name>deleted</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>dueDate</java-variable-name>
            <xml-element-name>dueDate</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>id</java-variable-name>
            <xml-element-name>id</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>inProcessPayment</java-variable-name>
            <xml-element-name>inProcessPayment</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>isReview</java-variable-name>
            <xml-element-name>isReview</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>lastReminder</java-variable-name>
            <xml-element-name>lastReminder</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>number</java-variable-name>
            <xml-element-name>number</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>overdueStep</java-variable-name>
            <xml-element-name>overdueStep</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>paymentAttempts</java-variable-name>
            <xml-element-name>paymentAttempts</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>primaryKey</java-variable-name>
            <xml-element-name>primaryKey</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>toProcess</java-variable-name>
            <xml-element-name>toProcess</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>total</java-variable-name>
            <xml-element-name>total</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>delegatedInvoiceId</java-variable-name>
            <xml-element-name>delegatedInvoiceId</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>invoiceLines</java-variable-name>
            <xml-element-name>invoiceLines</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>orders</java-variable-name>
            <xml-element-name>orders</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>payments</java-variable-name>
            <xml-element-name>payments</xml-element-name>
            </variable-mapping>
            <variable-mapping>
            <java-variable-name>userId</java-variable-name>
            <xml-element-name>userId</xml-element-name>
            </variable-mapping>
            </java-xml-type-mapping>
            <service-interface-mapping>
            <service-interface>com.acme.betty.server.invoice.Invoice</service-interface>
            <wsdl-service-name xmlns:serviceNS="http://www.acme.com">serviceNS:Invoice</wsdl-service-name>
            <port-mapping>
            <port-name>InvoiceServicePort</port-name>
            <java-port-name>InvoiceServicePort</java-port-name>
            </port-mapping>
            </service-interface-mapping>
            <service-endpoint-interface-mapping>
            <service-endpoint-interface>com.acme.betty.server.invoice.InvoiceService</service-endpoint-interface>
            <wsdl-port-type xmlns:portTypeNS="http://www.acme.com">portTypeNS:InvoiceService</wsdl-port-type>
            <wsdl-binding xmlns:bindingNS="http://www.acme.com">bindingNS:InvoiceServiceBinding</wsdl-binding>
            <service-endpoint-method-mapping>
            <java-method-name>get</java-method-name>
            <wsdl-operation>get</wsdl-operation>
            <method-param-parts-mapping>
            <param-position>0</param-position>
            <param-type>java.lang.Integer</param-type>
            <wsdl-message-mapping>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_get</wsdl-message>
            <wsdl-message-part-name>Integer_1</wsdl-message-part-name>
            <parameter-mode>IN</parameter-mode>
            </wsdl-message-mapping>
            </method-param-parts-mapping>
            <wsdl-return-value-mapping>
            <method-return-value>com.acme.betty.server.invoice.InvoiceWS</method-return-value>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getResponse</wsdl-message>
            <wsdl-message-part-name>result</wsdl-message-part-name>
            </wsdl-return-value-mapping>
            </service-endpoint-method-mapping>
            <service-endpoint-method-mapping>
            <java-method-name>getLast</java-method-name>
            <wsdl-operation>getLast</wsdl-operation>
            <method-param-parts-mapping>
            <param-position>0</param-position>
            <param-type>java.lang.Integer</param-type>
            <wsdl-message-mapping>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getLast</wsdl-message>
            <wsdl-message-part-name>Integer_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.Integer</param-type>
            <wsdl-message-mapping>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getLast</wsdl-message>
            <wsdl-message-part-name>Integer_2</wsdl-message-part-name>
            <parameter-mode>IN</parameter-mode>
            </wsdl-message-mapping>
            </method-param-parts-mapping>
            <wsdl-return-value-mapping>
            <method-return-value>com.acme.betty.server.invoice.InvoiceWS[]</method-return-value>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getLastResponse</wsdl-message>
            <wsdl-message-part-name>result</wsdl-message-part-name>
            </wsdl-return-value-mapping>
            </service-endpoint-method-mapping>
            <service-endpoint-method-mapping>
            <java-method-name>getLatest</java-method-name>
            <wsdl-operation>getLatest</wsdl-operation>
            <method-param-parts-mapping>
            <param-position>0</param-position>
            <param-type>java.lang.Integer</param-type>
            <wsdl-message-mapping>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getLatest</wsdl-message>
            <wsdl-message-part-name>Integer_1</wsdl-message-part-name>
            <parameter-mode>IN</parameter-mode>
            </wsdl-message-mapping>
            </method-param-parts-mapping>
            <wsdl-return-value-mapping>
            <method-return-value>com.acme.betty.server.invoice.InvoiceWS</method-return-value>
            <wsdl-message xmlns:wsdlMsgNS="http://www.acme.com">wsdlMsgNS:InvoiceService_getLatestResponse</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>

            • 4. Re: Almost there
              Paul Casal Newbie

              Thomas, I have removed the ws4ee-deployment.xml from the jar file and seems that the web service is working fine.

              I want to thank you very much for you help, it made a huge difference for me. You saved me lots of time.

              • 5. JBossWS: problem with custom exceptions
                Gogu Pintenogu Newbie

                Hello Thomas,

                I use JBossWS and I defined in the web service interface for a bean, custom exceptions.
                Could you tell me please if there is a way to avoid getting RemoteException instead of the custom exception?

                Thank you.

                • 6. Re: Almost there
                  Paul Casal Newbie

                  Gogu, I believe that the throwing of RemoteException is part of the J2EE specs on web services, therefore it has to stay there.

                  • 7. Re: Almost there
                    Thomas Diesler Master

                    There is no requirement of custom exception extending RemoteException. A service endpoint method must declare RemoteException in its throws clause, in addition it may throw any other checked exception.

                    ant -Dtest=org.jboss.test.webservice.exception.ExceptionTestCase one-test