[ https://issues.apache.org/jira/browse/CXF-3891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145735#comment-13145735 ]
Joe Godleski commented on CXF-3891: ----------------------------------- I downloaded the source code to try and find some sort of solution to this problem. I don't really understand conceptually what I did, but I know I was able to get it working and have been using it without issue. There was one change I made: org.apache.cxf.javascript.service.ServiceJavascriptBuilder private void getElementsForParts(MessageInfo message, List<ParticleInfo> elements) if (betterElement instanceof XmlSchemaElement) {} - I commented out this entire if statement block. Again, no idea what this really did but it fixed my problem and I've been adding webservices to the xsd and wsdl given above without a problem so far. > WSDL2JS Null Pointer Exception > ------------------------------ > > Key: CXF-3891 > URL: https://issues.apache.org/jira/browse/CXF-3891 > Project: CXF > Issue Type: Bug > Components: JavaScript Client > Affects Versions: 2.4.3 > Environment: Windows Vista 64-bit > Reporter: Joe Godleski > > Given my wsdl and xsd wsdl2java.bat runs without issue but wsdl2js.bat throws > Null Pointer Exception: > org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException > at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:294) > at > org.apache.cxf.tools.wsdlto.javascript.JavaScriptContainer.execute(JavaScriptContainer.java:154) > at > org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103) > at > org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:67) > at > org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript.run(WSDLToJavaScript.java:60) > at > org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScript.main(WSDLToJavaScript.java:97) > Caused by: java.lang.NullPointerException > at > org.apache.ws.commons.schema.XmlSchemaCollection.getTypeByQName(XmlSchemaCollection.java:221) > at > org.apache.cxf.common.xmlschema.SchemaCollection.getTypeByQName(SchemaCollection.java:106) > at > org.apache.cxf.javascript.service.ServiceJavascriptBuilder.getElementsForParts(ServiceJavascriptBuilder.java:745) > at > org.apache.cxf.javascript.service.ServiceJavascriptBuilder.createResponseDeserializer(ServiceJavascriptBuilder.java:516) > at > org.apache.cxf.javascript.service.ServiceJavascriptBuilder.end(ServiceJavascriptBuilder.java:269) > at > org.apache.cxf.service.ServiceModelVisitor.walk(ServiceModelVisitor.java:76) > at > org.apache.cxf.tools.wsdlto.javascript.WSDLToJavaScriptProcessor.process(WSDLToJavaScriptProcessor.java:93) > at > org.apache.cxf.tools.wsdlto.javascript.JavaScriptContainer.execute(JavaScriptContainer.java:147) > at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:286) > ... 5 more > xsd: > <?xml version="1.0" encoding="UTF-8"?> > <schema > xmlns="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://webservices/" > xmlns:tns="http://webservices/" elementFormDefault="qualified"> > > <!-- getFacilities --> > <element name="FacilityID" type="string" /> > <element name="FacilityName" type="string" /> > <element name="Facility"> > <complexType> > <sequence> > <element ref="tns:FacilityID" /> > <element ref="tns:FacilityName" /> > </sequence> > </complexType> > </element> > <element name="Facilities"> > <complexType> > <sequence> > <element maxOccurs="unbounded" > ref="tns:Facility" /> > </sequence> > </complexType> > </element> > > <!-- getAreasForFacility --> > <element name="AreaName" type="string" /> > <element name="Area"> > <complexType> > <sequence> > <element ref="tns:FacilityID" /> > <element ref="tns:AreaName" /> > </sequence> > </complexType> > </element> > <element name="Areas"> > <complexType> > <sequence> > <element maxOccurs="unbounded" ref="tns:Area" /> > </sequence> > </complexType> > </element> > > <!-- getLocationsForArea --> > <element name="GetLocationsRequestParam"> > <complexType> > <sequence> > <element ref="tns:FacilityID" /> > <element ref="tns:AreaName" /> > </sequence> > </complexType> > </element> > <element name="LocationName" type="string" /> > <element name="LocationState" type="string" /> > <element name="Location"> > <complexType> > <sequence> > <element ref="tns:FacilityID" /> > <element ref="tns:AreaName" /> > <element ref="tns:LocationName" /> > <element ref="tns:LocationState" /> > </sequence> > </complexType> > </element> > <element name="Locations"> > <complexType> > <sequence> > <element maxOccurs="unbounded" > ref="tns:Location" /> > </sequence> > </complexType> > </element> > > <!-- getLocationState --> > <element name="GetLocationStateRequestParam"> > <complexType> > <sequence> > <element ref="tns:FacilityID" /> > <element ref="tns:AreaName" /> > <element ref="tns:LocationName" /> > </sequence> > </complexType> > </element> > > </schema> > wsdl: > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <wsdl:definitions > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" > xmlns:tns="http://webservices/" > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > name="OnTrack" targetNamespace="http://webservices/"> > <wsdl:types> > <xsd:schema> > <xsd:import schemaLocation="OnTrack.xsd" > namespace="http://webservices/" /> > </xsd:schema> > </wsdl:types> > > <wsdl:message name="GetFacilitiesRequest" /> > <wsdl:message name="GetFacilitiesResponse"> > <wsdl:part element="tns:Facilities" name="Facilities" /> > </wsdl:message> > <wsdl:message name="GetAreasRequest"> > <wsdl:part element="tns:FacilityID" name="FacilityID" /> > </wsdl:message> > <wsdl:message name="GetAreasResponse"> > <wsdl:part element="tns:Areas" name="Areas" /> > </wsdl:message> > <wsdl:message name="GetLocationsRequest"> > <wsdl:part element="tns:GetLocationsRequestParam" > name="FacilityID_AreaName" /> > </wsdl:message> > <wsdl:message name="GetLocationsResponse"> > <wsdl:part element="tns:Locations" name="Locations" /> > </wsdl:message> > <wsdl:message name="GetLocationStateRequest"> > <wsdl:part element="tns:GetLocationStateRequestParam" > name="FacilityID_AreaName_LocationName" /> > </wsdl:message> > <wsdl:message name="GetLocationStateResponse"> > <wsdl:part element="tns:Location" name="Location" /> > </wsdl:message> > > <wsdl:portType name="OnTrack"> > <wsdl:operation name="GetFacilities"> > <wsdl:input message="tns:GetFacilitiesRequest"/> > <wsdl:output message="tns:GetFacilitiesResponse"/> > </wsdl:operation> > <wsdl:operation name="GetAreas"> > <wsdl:input message="tns:GetAreasRequest" /> > <wsdl:output message="tns:GetAreasResponse" /> > </wsdl:operation> > <wsdl:operation name="GetLocations"> > <wsdl:input message="tns:GetLocationsRequest" /> > <wsdl:output message="tns:GetLocationsResponse" /> > </wsdl:operation> > <wsdl:operation name="GetLocationState"> > <wsdl:input message="tns:GetLocationStateRequest" /> > <wsdl:output message="tns:GetLocationStateResponse" /> > </wsdl:operation> > </wsdl:portType> > > <wsdl:binding name="OnTrackSOAP" type="tns:OnTrack"> > <soap:binding style="document" > transport="http://schemas.xmlsoap.org/soap/http"/> > <wsdl:operation name="GetFacilities"> > <soap:operation soapAction=""/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > <wsdl:operation name="GetAreas"> > <soap:operation soapAction=""/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > <wsdl:operation name="GetLocations"> > <soap:operation soapAction=""/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > <wsdl:operation name="GetLocationState"> > <soap:operation soapAction=""/> > <wsdl:input> > <soap:body use="literal"/> > </wsdl:input> > <wsdl:output> > <soap:body use="literal"/> > </wsdl:output> > </wsdl:operation> > </wsdl:binding> > > <wsdl:service name="OnTrack"> > <wsdl:port binding="tns:OnTrackSOAP" name="OnTrackSOAP"> > <soap:address location="http://godleski2-dt/OnTrack"/> > </wsdl:port> > </wsdl:service> > > </wsdl:definitions> -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira