Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1785

wsdlLocation attribute and XmlBeans: Getting NullPointerException/UNMARSHALL_ERROR

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1.7
    • Component/s: OtherDatabindings
    • Labels:
      None
    • Environment:

      WinXP Pro SP3, Java 1.6, Spring 2.5, XmlBeans 2.3.0, CXF 2.1

      Description

      I have created my own WSDL and its corresponding service and implementation classes (annotated of course). When I do not use the wsdlLocation attribute on jaxws:endpoint, the request I send to the service works fine, but when I specify the wsdlLocation attribute, I get a NullPointerException/UNMARSHAL_ERROR from the XmlBeans databinding used by CXF. Any ideas where I am not doing it correctly?

      Error

      java.lang.NullPointerException
      at org.apache.cxf.xmlbeans.DataReaderImpl.read(DataReaderImpl.java:73)
      at org.apache.cxf.xmlbeans.DataReaderImpl.read(DataReaderImpl.java:43)
      at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:183)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
      at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:151)
      at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
      at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.arevatd.mmi.pjm.filters.CLUProgramContextFilter.doFilter(CLUProgramContextFilter.java:56)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)
      Sep 4, 2008 12:35:49 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept
      INFO: Interceptor has thrown exception, unwinding now
      org.apache.cxf.interceptor.Fault: UNMARSHAL_ERROR
      at org.apache.cxf.xmlbeans.DataReaderImpl.read(DataReaderImpl.java:81)
      at org.apache.cxf.xmlbeans.DataReaderImpl.read(DataReaderImpl.java:43)
      at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:183)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
      at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
      at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)
      at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:151)
      at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
      at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.arevatd.mmi.pjm.filters.CLUProgramContextFilter.doFilter(CLUProgramContextFilter.java:56)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
      at org.apache.cxf.xmlbeans.DataReaderImpl.read(DataReaderImpl.java:73)
      ... 26 more

      WSDL

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions name="mmi"
      targetNamespace="http://com.arevatd.mmi/xml/wsdl"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:tns="http://com.arevatd.mmi/xml/wsdl"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:mmi="http://com.arevatd.mmi/xml">

      <wsdl:types>
      <xsd:schema targetNamespace="http://com.arevatd.mmi/xml/wsdl"
      xmlns="http://www.w3.org/2001/XMLSchema">

      <import namespace="http://com.arevatd.mmi/xml"
      schemaLocation="../xml/mmi.xsd" />

      </xsd:schema>
      </wsdl:types>

      <wsdl:message name="ExportRequestMessage">
      <wsdl:part name="request" element="mmi:ExportRequestMessage" />
      </wsdl:message>

      <wsdl:portType name="MMIExportRequestPortType">
      <wsdl:operation name="performExportRequest">
      <wsdl:input message="tns:ExportRequestMessage" />
      </wsdl:operation>
      </wsdl:portType>

      <wsdl:binding name="MMIExportRequestSoapBinding" type="tns:MMIExportRequestPortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="performExportRequest">
      <soap:operation soapAction="performExportRequest" style="document" />
      <wsdl:input>
      <soap:body use="literal" />
      </wsdl:input>
      </wsdl:operation>
      </wsdl:binding>

      <wsdl:service name="MMIExportRequestService">
      <wsdl:port name="MMIExportRequestPort" binding="tns:MMIExportRequestSoapBinding">
      <soap:address location="http://localhost:8080/mmi/services/export" />
      </wsdl:port>
      </wsdl:service>

      </wsdl:definitions>

      XML SCHEMA

      <?xml version="1.0" encoding="UTF-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://com.arevatd.mmi/xml"
      xmlns:mmi="http://com.arevatd.mmi/xml"
      elementFormDefault="qualified">

      <complexType name="ExportRequestMessageType">
      <all>
      <element minOccurs="1" maxOccurs="1" name="application" type="string" />
      <element minOccurs="1" maxOccurs="1" name="environment" type="string" />
      <element minOccurs="1" maxOccurs="1" name="directoryName" type="string" />
      <element minOccurs="1" maxOccurs="1" name="filename" type="string" />
      <element minOccurs="1" maxOccurs="1" name="requestId" type="string" />
      </all>
      </complexType>

      <element name="ExportRequestMessage" type="mmi:ExportRequestMessageType" />

      </schema>

      CXF-servlet.xml

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

      <!-- Configuration File for CXF -->
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

      <import resource="classpath:META-INF/cxf/cxf.xml" />
      <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
      <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

      <bean id="exportService" class="com.arevatd.mmi.business.services.support.CmiModelDataExportWsImpl" scope="prototype" />

      <bean id="xmlBeansBean" class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" scope="prototype" />

      <bean id="exportServiceFactory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" scope="singleton">
      <property name="dataBinding" ref="xmlBeansBean" />
      </bean>

      <jaxws:endpoint id="exportServiceEndPoint"
      implementor="com.arevatd.mmi.business.services.support.CmiModelDataExportWsImpl"
      address="/export"
      wsdlLocation="wsdl/mmi.wsdl" >
      <jaxws:serviceFactory>
      <ref bean="exportServiceFactory" />
      </jaxws:serviceFactory>
      </jaxws:endpoint>

      </beans>

      Service Class

      package com.arevatd.mmi.business.services;

      import javax.jws.Oneway;
      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;

      import mmi.arevatd.com.xml.ExportRequestMessageType;

      /**

      • Interface for the Import Service
        *
      • @author jvelez
        *
        */
        @WebService(name="MMIExportRequestPortType",
        targetNamespace="http://com.arevatd.mmi/xml/wsdl")
        @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
        public interface CmiModelDataExportWs {
        /**
      • The actual operation for this web service: perform an export of CMI Model Data
        *
      • @param request The Request to export a e-terrasource export project
        */
        @WebMethod(operationName = "performExportRequest", action = "performExportRequest")
        @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
        @Oneway()
        public void exportCmiModelData(
        @WebParam(targetNamespace = "http://com.arevatd.mmi/xml",
        partName="request",
        name = "ExportRequestMessage")
        ExportRequestMessageType request);
        }

      Service Implementation Class

      package com.arevatd.mmi.business.services.support;

      import java.util.logging.Logger;

      import javax.jws.WebService;
      import javax.xml.namespace.QName;
      import javax.xml.soap.SOAPException;
      import javax.xml.soap.SOAPFactory;
      import javax.xml.soap.SOAPFault;
      import javax.xml.ws.BindingType;
      import javax.xml.ws.soap.SOAPFaultException;

      import com.arevatd.mmi.business.services.CmiModelDataExportWs;

      import mmi.arevatd.com.xml.ExportRequestMessageType;

      /**

      • Implementation for the CmiModelDataExportWs Web Service
        *
      • @author jvelez
        *
        */
        @WebService(endpointInterface="com.arevatd.mmi.business.services.CmiModelDataExportWs",
        targetNamespace="http://com.arevatd.mmi/xml/wsdl",
        portName="MMIExportRequestPort",
        serviceName="MMIExportRequestService",
        name="MMIExportRequestPortType")
        @BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
        public class CmiModelDataExportWsImpl implements CmiModelDataExportWs {
        private final Logger logger = Logger.getLogger(this.getClass().getName());

      public void exportCmiModelData(ExportRequestMessageType request) /throws ExportRequestFault/ {
      logger.info("Application=" + request.getApplication());
      logger.info("Environment=" + request.getEnvironment());
      logger.info("Directory=" + request.getDirectoryName());
      logger.info("File=" + request.getFilename());
      logger.info("Export Request Id=" + request.getRequestId());

      try

      { SOAPFactory soapFactory = SOAPFactory.newInstance(); SOAPFault fault = soapFactory.createFault("Hello", new QName("http://schemas.xmlsoap.org/soap/envelope/", "Client")); fault.setFaultString("Juan"); throw new SOAPFaultException(fault); }

      catch(SOAPException se) {
      }
      }
      }

        Attachments

        1. CXFTestXmlBeansHeader.rar
          8 kB
          Knut Ivar Skogland
        2. MMI CXF.zip
          1.67 MB
          Juan Velez

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              juanavelez Juan Velez
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: