I'm getting an interesting error when deploying a web service using a static WSDL (the static WSDL I'm using is actually a copy of a CXF dynamically generated WSDL which works, this error only occurs when I use this same WSDL in a static manner via the wsdlLocation @WebService annotation attribute).
Here is the exception reported on the server when executing the service from a client w/the payload: Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body xmlns:ns1="http://emailer.ws.base.cybersource.com"><ns1:sendEmail xmlns:ns3="http://process.ws.mag.cybersource.com"><ns1:EmailMessage><Mer chantID>ssteveli3</MerchantID><To>Homer Simpson</To></ns1:EmailMessage></ns1:sendEmail></soap:Body></soap:Envelo pe> -------------------------------------- 15:01:34,000 ERROR [STDERR] Feb 15, 2008 3:01:34 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Application has thrown exception, unwinding now java.lang.NullPointerException at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvok er.java:109) at org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.j ava:76) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.ja va:101) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:1 00) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.ja va:68) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvoke rInterceptor.java:56) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor .java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Servi ceInvokerInterceptor.java:92) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC hain.java:208) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati onObserver.java:77) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDes tination.java:79) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser vletController.java:264) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl ler.java:160) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe rvlet.java:170) at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFSe rvlet.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(Applica tionFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte r.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs sociationValve.java:179) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j ava:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConn ectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2 62) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84 4) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Thread.java:595) 15:01:34,031 ERROR [STDERR] Feb 15, 2008 3:01:34 PM org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose INFO: Outbound Message --------------------------- Encoding: UTF-8 Headers: {} Messages: Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap: Fault><faultcode>soap:Server</faultcode><faultstring>Fault occurred while processing.</faultstring></soap:Fault></soap:Body></soap:Envelope> -------------------------------------- Debugging and digging into the code reveals that when AbstractInvoker heads into MethodDispatcher's getMethod() to retrieve the Method, a null is returned. Further debugging shows that JAXWSMethodDispatcher is the actual implementation of MethodDispatcher being used which itself extends SimpleMethodDispatcher, in SimpleMethodDispatcher an internal Map is maintained of available methods, opToMethod. The debugger shows my single sendEmail() method being contained in the opToMethod map, however when the SimpleMethodDispatcher.getMethod() looks for it by the OperationInfo reference passed in (which reports an identical toString() value to the map key entry) a null is returned which is of course is propagated up, not checked, eventually referenced, finally resulting in the NullPointerException. The problem -- as I see it -- is on the Map lookup which is done by hashCode(), the hashCode() contained in the stored map key and the inbound OperationInfo object are different, hence Map.get() returns null. If I switch this same service back to a dynamic WSDL then the same debugging results in the same hashCode() between the two OperationInfo objects. So I've done all this digging and I just know this has to be something simple, any thoughts??? My Service Impl: @WebService( serviceName="EmailerService", portName="EmailerServiceHttpPort", endpointInterface="com.cybersource.base.ws.emailer.EmailerService", targetNamespace="http://emailer.ws.base.cybersource.com") public class EmailerServiceImpl implements EmailerService { public void sendEmail(EmailMessage message) { // TODO implement this for crying out loud System.out.println( "stubbed email sender!!" ); } } My WSDL: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://emailer.ws.base.cybersource.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="EmailerService" targetNamespace="http://emailer.ws.base.cybersource.com"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://process.ws.mag.cybersource.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://process.ws.mag.cybersource.com"> <xs:element name="MAGProcessRequest"> <xs:complexType> <xs:sequence> <xs:element name="resellerId" type="xs:string" /> <xs:element name="callbackUrl" type="xs:string" /> <xs:element name="application" type="tns:ShortForm" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="MAGProcessResponse"> <xs:complexType> <xs:sequence> <xs:element name="responseCode" type="xs:int" /> <xs:element name="responseMessage" type="xs:string" /> <xs:element name="magId" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="MAGStatusRequest"> <xs:complexType> <xs:sequence> <xs:element name="magId" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="MAGStatusResponse"> <xs:complexType> <xs:sequence> <xs:element name="status" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="CybsStatus"> <xs:sequence> <xs:element name="reasonCode" type="xs:int" /> <xs:element name="reasonMessage" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="Address"> <xs:sequence> <xs:element name="AddressLine1" type="xs:string" /> <xs:element minOccurs="0" name="AddressLine2" type="xs:string" /> <xs:element name="City" type="xs:string" /> <xs:element name="State" type="xs:string" /> <xs:element name="Zip" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="BusinessEntityType"> <xs:sequence> <xs:element minOccurs="0" name="SoleProprietorship" type="xs:boolean" /> <xs:element minOccurs="0" name="Partnership" type="xs:boolean" /> </xs:sequence> </xs:complexType> <xs:complexType name="ShortForm"> <xs:sequence> <xs:element name="CompanyDBA" type="xs:string" /> <xs:element name="LegalBusinessName" type="xs:string" /> <xs:element name="TaxID" type="xs:string" /> <xs:element name="BusinessEstablishedDate" type="xs:string" /> <xs:element name="BusinessPhoneNumber" type="xs:string" /> <xs:element name="BusinessAddress" type="tns:Address" /> <xs:element name="MailingAddress" type="tns:Address" /> <xs:element name="BusinessEntityType" type="xs:string" /> <xs:element name="TypeOfProducts" type="xs:string" /> <xs:element name="ProductsDescription" type="xs:string" /> <xs:element name="ContactName" type="xs:string" /> <xs:element name="ContactTitle" type="xs:string" /> <xs:element name="ContactPhoneNumber" type="xs:string" /> <xs:element name="ContactEmail" type="xs:string" /> <xs:element maxOccurs="unbounded" name="Owners" type="tns:OwnerInfo" /> <xs:element name="EstimatedCreditCardVolume" type="xs:int" /> <xs:element name="AverageCredirCardSale" type="xs:float" /> <xs:element name="CardTypesDesired" type="tns:CardTypes" /> <xs:element name="DepositBankAccountNumber" type="xs:string" /> <xs:element name="DepositRoutingNumber" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="OwnerInfo"> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="OwnershipPercent" type="xs:float" /> <xs:element name="OwnerStartDate" type="xs:anySimpleType" /> <xs:element name="ResidenceAddress" type="tns:Address" /> <xs:element name="SocialSecurityNumber" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="CardTypes"> <xs:sequence> <xs:element minOccurs="0" name="VisaOrMC" type="xs:boolean" /> <xs:element minOccurs="0" name="AmericanExpress" type="xs:boolean" /> <xs:element minOccurs="0" name="Discover" type="xs:boolean" /> <xs:element minOccurs="0" name="JCB" type="xs:boolean" /> <xs:element minOccurs="0" name="Other" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://emailer.ws.base.cybersource.com" xmlns:ns1="http://process.ws.mag.cybersource.com" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://emailer.ws.base.cybersource.com"> <xs:import namespace="http://process.ws.mag.cybersource.com" /> <xs:element name="EmailMessage"> <xs:complexType> <xs:sequence> <xs:element name="MerchantID" type="xs:string" /> <xs:element name="To" type="xs:string" /> <xs:element name="From" type="xs:string" /> <xs:element name="Subject" type="xs:string" /> <xs:element name="TemplateFile" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="EmailResponse"> <xs:complexType> <xs:sequence> <xs:element name="status" type="ns1:CybsStatus" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="sendEmail" type="sendEmail" /> <xs:complexType name="sendEmail"> <xs:sequence> <xs:element minOccurs="0" ref="EmailMessage" /> </xs:sequence> </xs:complexType> <xs:element name="sendEmailResponse" type="sendEmailResponse" /> <xs:complexType name="sendEmailResponse"> <xs:sequence> <xs:element minOccurs="0" ref="EmailResponse" /> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="sendEmail"> <wsdl:part element="tns:sendEmail" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="sendEmailResponse"> <wsdl:part element="tns:sendEmailResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="EmailerService"> <wsdl:operation name="sendEmail"> <wsdl:input message="tns:sendEmail" name="sendEmail"> </wsdl:input> <wsdl:output message="tns:sendEmailResponse" name="sendEmailResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="EmailerServiceSoapBinding" type="tns:EmailerService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="sendEmail"> <soap:operation soapAction="" style="document" /> <wsdl:input name="sendEmail"> <soap:body use="literal" /> </wsdl:input> <wsdl:output name="sendEmailResponse"> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="EmailerService"> <wsdl:port binding="tns:EmailerServiceSoapBinding" name="EmailerServiceHttpPort"> <soap:address location="http://localhost:8080/magws/services/EmailerService" /> </wsdl:port> </wsdl:service> </wsdl:definitions> Env: JBOSS AS 4.2.2.GA JRE 1.5.0_04-b05 CXF 2.0.4-incubator
