0 Replies Latest reply on Apr 24, 2008 6:40 AM by Ramon Havermans

    Binding custom Exception field fails

    Ramon Havermans Newbie

      Hi there,

      I'm trying to make a simple hallo World with a parameter and a custom exception that has its own field. Without the extra field in the exception it works fine. Server start up fine but when I call my webservice with the field "naam" filled in with "kaboom" (with this value the exception is thrown) this is what I get:

      08:48:41,921 ERROR [RequestHandlerImpl] Error processing web service request
      
      org.jboss.ws.WSException: org.jboss.xb.binding.JBossXBRuntimeException: Failed to find read method or field for property 'typeFout' in class nl.havermans.rhcp.boodschappen.webservice.EWebserviceException
      
       at org.jboss.ws.WSException.rethrow(WSException.java:68)
      
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:310)
      
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
      
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
      
       at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
      
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      
      

      The problem is that the property really is in the class nl.havermans.rhcp.boodschappen.webservice.EWebserviceException, I even tried to make the field itself public but it does not help. Does anyone know why this is happening?


      Can anyone have a look at this?

      /**
       *
       */
      package nl.havermans.rhcp.boodschappen.webservice;
      
      import java.rmi.RemoteException;
      
      /**
       * @author RHCP
       *
       */
      public interface IHalloWereldService extends java.rmi.Remote {
       public String zegMijHallo(String naam) throws EWebserviceException, RemoteException;
      }
      

      /**
       *
       */
      package nl.havermans.rhcp.boodschappen.webservice;
      
      import java.rmi.RemoteException;
      
      import org.apache.log4j.Logger;
      
      /**
       * @author RHCP
       *
       */
      public class HalloWereldService implements IHalloWereldService {
       Logger _log = Logger.getLogger(HalloWereldService.class);
      
       /**
       * @throws EWebserviceException
       * @see nl.havermans.rhcp.boodschappen.webservice.IHalloWereldService#zegMijHallo(java.lang.String)
       */
       public String zegMijHallo(String naam) throws RemoteException, EWebserviceException {
       _log.info("Start zegMijHallo: " + naam);
       String antwoord = "Welkom bij mijn webservice";
       if (naam != null) {
       if (naam.equals("kaboom")) {
       throw new EWebserviceException("Exceptie test", "functioneel");
       }
       antwoord = antwoord + ": " + naam;
       }
      
       _log.info("Einde zegMijHallo");
       return antwoord;
       }
      }
      

      /**
       *
       */
      package nl.havermans.rhcp.boodschappen.webservice;
      
      /**
       * @author RHCP
       *
       */
      public class EWebserviceException extends Exception {
       /**
       *
       */
       private static final long serialVersionUID = -4539401858795964596L;
       public String typeFout = "onbekend";
      
       /**
       *
       */
       public EWebserviceException() {
       super();
       }
      
       /**
       * @param p_message
       * @param p_cause
       */
       public EWebserviceException(String p_message, Throwable p_cause) {
       super(p_message, p_cause);
       }
      
       /**
       * @param p_message
       */
       public EWebserviceException(String p_message) {
       super(p_message);
       }
      
       /**
       * @param p_message boodschap
       * @param p_typeFout type fout
       */
       public EWebserviceException(String message, String typeFout) {
       super(message);
       this.typeFout = typeFout;
       }
      
      
       /**
       * @param p_cause
       */
       public EWebserviceException(Throwable p_cause) {
       super(p_cause);
       }
      
       /**
       * @return the typeFout
       */
       public String getTypeFout() {
       return typeFout;
       }
      
       /**
       * @param p_typeFout the typeFout to set
       */
       public void setTypeFout(String typeFout) {
       this.typeFout = typeFout;
       }
      
      }
      

      <?xml version="1.0" encoding="UTF-8"?>
      <definitions
       name="HalloWereldWS"
       targetNamespace="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"
       xmlns:hllwrld="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"
       xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
      >
       <types>
       <xsd:schema
       targetNamespace="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService">
      
       <xsd:complexType name="EWebserviceException">
       <xsd:sequence>
       <xsd:element name="typeFout" nillable="true" type="xsd:string"/>
       </xsd:sequence>
       </xsd:complexType>
       <xsd:element name="EWebserviceException" type="hllwrld:EWebserviceException"/>
       </xsd:schema>
       </types>
       <message name="GetHalloWereldRequest">
       <part name="naam" type="xsd:string"/>
       </message>
       <message name="GetHalloWereldResponse">
       <part name="antwoord" type="xsd:string"/>
       </message>
       <message name="EWebserviceException">
       <part name="EWebserviceException" element="hllwrld:EWebserviceException"></part>
       </message>
      
       <portType name="HalloWereld">
       <operation name="zegMijHallo">
       <input message="hllwrld:GetHalloWereldRequest"/>
       <output message="hllwrld:GetHalloWereldResponse"/>
       <fault name="EWebserviceException" message="hllwrld:EWebserviceException"></fault>
       </operation>
       </portType>
      
       <binding name="HalloWereld_binding" type="hllwrld:HalloWereld">
       <soapbind:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="zegMijHallo">
       <soapbind:operation style="rpc" soapAction="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService/ZegMijHallo"/>
       <input>
       <soapbind:body use="literal" namespace="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"/>
       </input>
       <output>
       <soapbind:body use="literal" namespace="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"/>
       </output>
       <fault name="EWebserviceException">
       <soapbind:fault name="EWebserviceException" use="literal"/>
       </fault>
       </operation>
       </binding>
      
       <service name="HalloWereldService">
       <port name="HalloWereld_Port" binding="hllwrld:HalloWereld_binding">
       <soapbind:address location="http://localhost:8080/BoodschappenServiceWeb/myJSE/HalloWereld"/>
       </port>
       </service>
      </definitions>
      

      <?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"
       xmlns:hllwrld="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"
       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>nl.havermans.rhcp.boodschappen.webservice</package-type>
       <namespaceURI>http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService</namespaceURI>
       </package-mapping>
       <java-xml-type-mapping>
       <java-type>nl.havermans.rhcp.boodschappen.webservice.EWebserviceException</java-type>
       <root-type-qname>hllwrld:EWebserviceException</root-type-qname>
       <qname-scope>complexType</qname-scope>
       </java-xml-type-mapping>
       <exception-mapping>
       <exception-type>nl.havermans.rhcp.boodschappen.webservice.EWebserviceException</exception-type>
       <wsdl-message>hllwrld:EWebserviceException</wsdl-message>
       </exception-mapping>
       <service-interface-mapping>
       <service-interface>nl.havermans.rhcp.boodschappen.webservice.HalloWereldService</service-interface>
       <wsdl-service-name>hllwrld:HalloWereldService</wsdl-service-name>
       <port-mapping>
       <port-name>hllwrld:HalloWereld_Port</port-name>
       <java-port-name>hllwrld:HalloWereld_Port</java-port-name>
       </port-mapping>
       </service-interface-mapping>
       <service-endpoint-interface-mapping>
       <service-endpoint-interface>nl.havermans.rhcp.boodschappen.webservice.IHalloWereldService</service-endpoint-interface>
       <wsdl-port-type>hllwrld:HalloWereld</wsdl-port-type>
       <wsdl-binding>hllwrld:HalloWereld_binding</wsdl-binding>
       <service-endpoint-method-mapping>
       <java-method-name>zegMijHallo</java-method-name>
       <wsdl-operation>zegMijHallo</wsdl-operation>
       <method-param-parts-mapping>
       <param-position>0</param-position>
       <param-type>java.lang.String</param-type>
       <wsdl-message-mapping>
       <wsdl-message>hllwrld:GetHalloWereldRequest</wsdl-message>
       <wsdl-message-part-name>naam</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>hllwrld:GetHalloWereldResponse</wsdl-message>
       <wsdl-message-part-name>antwoord</wsdl-message-part-name>
       </wsdl-return-value-mapping>
       </service-endpoint-method-mapping>
       </service-endpoint-interface-mapping>
      </java-wsdl-mapping>
      

      <?xml version="1.0" encoding="UTF-8"?>
      <webservices xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:hllwrld="http://webservice.boodschappen.rhcp.havermans.nl/HalloWereldService"
       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>HalloWereld</webservice-description-name>
       <wsdl-file>WEB-INF/wsdl/HalloWereld.wsdl</wsdl-file>
       <jaxrpc-mapping-file>WEB-INF/HalloWereld-rpc-mapping.xml</jaxrpc-mapping-file>
       <port-component>
       <port-component-name>HalloWereldJSE</port-component-name>
       <wsdl-port>hllwrld:HalloWereld_Port</wsdl-port>
       <service-endpoint-interface>nl.havermans.rhcp.boodschappen.webservice.IHalloWereldService</service-endpoint-interface>
       <service-impl-bean>
       <servlet-link>HalloWereldJSE</servlet-link>
       </service-impl-bean>
       </port-component>
       </webservice-description>
      </webservices>
      

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.4"
       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://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <display-name>BoodschappenServiceWeb</display-name>
       <servlet>
       <display-name>Apache-Axis Servlet</display-name>
       <servlet-name>AxisServlet</servlet-name>
       <servlet-class>
       org.apache.axis.transport.http.AxisServlet
       </servlet-class>
       </servlet>
       <servlet>
       <display-name>Axis Admin Servlet</display-name>
       <servlet-name>AdminServlet</servlet-name>
       <servlet-class>
       org.apache.axis.transport.http.AdminServlet
       </servlet-class>
       <load-on-startup>100</load-on-startup>
       </servlet>
       <servlet>
       <display-name>Hallo Wereld webservice oefening</display-name>
       <servlet-name>HalloWereldJSE</servlet-name>
       <servlet-class>nl.havermans.rhcp.boodschappen.webservice.HalloWereldService</servlet-class>
       <load-on-startup>101</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>/servlet/AxisServlet</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>*.jws</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>AxisServlet</servlet-name>
       <url-pattern>/services/*</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>AdminServlet</servlet-name>
       <url-pattern>/servlet/AdminServlet</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>HalloWereldJSE</servlet-name>
       <url-pattern>/myJSE/HalloWereld</url-pattern>
       </servlet-mapping>
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       <welcome-file>index.htm</welcome-file>
       <welcome-file>index.jsp</welcome-file>
       <welcome-file>default.html</welcome-file>
       <welcome-file>default.htm</welcome-file>
       <welcome-file>default.jsp</welcome-file>
       </welcome-file-list>
      </web-app>