/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
/** * Creates a {@link Parser} that reads from {@link SDDocumentSource}. */ public Parser(SDDocumentSource doc) throws IOException, XMLStreamException { this.systemId = doc.getSystemId(); this.parser = doc.read(); }
public Collection getWsdlsAndSchemas(File pkgedWsdl) throws Exception { ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>(); getWsdlsAndSchemas(pkgedWsdl, cumulative); //if there are circular imports of wsdls, the original wsdl might //be in this Collection of imported metadata documents. If so, remove it. URL id = pkgedWsdl.toURL(); SDDocumentSource toRemove = null; for (SDDocumentSource source: cumulative) { if ((id.toString()).equals(source.getSystemId().toString())) { toRemove = source; } } if (toRemove != null) { cumulative.remove(toRemove); } return cumulative; }
private void addFileAndDecendents(URL fileUrl, ArrayList<SDDocumentSource> cumulative) throws Exception { //make sure we have not processed this file before boolean alreadyProcessed = false; for (SDDocumentSource source: cumulative) { if ((fileUrl.toString()).equals(source.getSystemId().toString())) { alreadyProcessed = true; break; } } if (!alreadyProcessed) { cumulative.add(0, SDDocumentSource.create(fileUrl)); getWsdlsAndSchemas(fileUrl, cumulative); } }
/** * This implementation is similar to #getWsdlsAndSchemas(File pkgedWsdl, except that this works on URL which makes * it easy when the wsdl is loaded from the archive. * @param pkgedWsdl URL * @return * @throws Exception */ public Collection getWsdlsAndSchemas(URL pkgedWsdl) throws Exception { ArrayList<SDDocumentSource> cumulative = new ArrayList<SDDocumentSource>(); getWsdlsAndSchemas(pkgedWsdl, cumulative); //if there are circular imports of wsdls, the original wsdl might //be in this Collection of imported metadata documents. If so, remove it. SDDocumentSource toRemove = null; for (SDDocumentSource source: cumulative) { if ((pkgedWsdl.toString()).equals(source.getSystemId().toString())) { toRemove = source; } } if (toRemove != null) { cumulative.remove(toRemove); } return cumulative; }
private void addFileAndDecendents(File file, ArrayList<SDDocumentSource> cumulative) throws Exception { try { //JAX-WS has trouble with "..'s" in paths here file = file.getCanonicalFile(); } catch (IOException e) { //hope JAX-WS can deal with the original path } //make sure we have not processed this file before URL id = file.toURL(); boolean alreadyProcessed = false; for (SDDocumentSource source: cumulative) { if ((id.toString()).equals(source.getSystemId().toString())) { alreadyProcessed = true; break; } } if (!alreadyProcessed) { cumulative.add(0, SDDocumentSource.create(id)); getWsdlsAndSchemas(file, cumulative); } }
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }
public Parser resolveEntity (String publicId, String systemId) throws IOException, XMLStreamException { if (systemId != null) { SDDocumentSource doc = metadata.get(systemId); if (doc != null) return new Parser(doc); synchronized(this) { while(origMetadata.hasNext()) { doc = origMetadata.next(); String extForm = doc.getSystemId().toExternalForm(); this.metadata.put(extForm,doc); if (systemId.equals(extForm)) return new Parser(doc); } } } if (resolver != null) { try { InputSource source = resolver.resolveEntity(publicId, systemId); if (source != null) { Parser p = new Parser(null, XMLStreamReaderFactory.create(source, true)); return p; } } catch (SAXException e) { throw new XMLStreamException(e); } } return null; }
URL systemId = src.getSystemId(); String importedDoc = reader.getAttributeValue(null, "schemaLocation"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString()); String importedDoc = reader.getAttributeValue(null, "location"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString()); String importedDoc = reader.getAttributeValue(null, "schemaLocation"); if (importedDoc != null) { importedDocs.add(new URL(src.getSystemId(), importedDoc).toString());
/** * Verifies whether the given primaryWsdl contains the given serviceName. * If the WSDL doesn't have the service, it throws an WebServiceException. */ private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) { SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null); if (!(primaryDoc instanceof SDDocument.WSDL)) { throw new WebServiceException(primaryWsdl.getSystemId()+ " is not a WSDL. But it is passed as a primary WSDL"); } SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc; if (!wsdlDoc.hasService()) { if(wsdlDoc.getAllServices().isEmpty()) throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+ " since it doesn't have Service "+serviceName); else throw new WebServiceException("WSDL "+primaryDoc.getSystemId() +" has the following services "+wsdlDoc.getAllServices() +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?"); } }
/** * Verifies whether the given primaryWsdl contains the given serviceName. * If the WSDL doesn't have the service, it throws an WebServiceException. */ private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) { SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null); if (!(primaryDoc instanceof SDDocument.WSDL)) { throw new WebServiceException(primaryWsdl.getSystemId()+ " is not a WSDL. But it is passed as a primary WSDL"); } SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc; if (!wsdlDoc.hasService()) { if(wsdlDoc.getAllServices().isEmpty()) throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+ " since it doesn't have Service "+serviceName); else throw new WebServiceException("WSDL "+primaryDoc.getSystemId() +" has the following services "+wsdlDoc.getAllServices() +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?"); } }
/** * Verifies whether the given primaryWsdl contains the given serviceName. * If the WSDL doesn't have the service, it throws an WebServiceException. */ private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) { SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null); if (!(primaryDoc instanceof SDDocument.WSDL)) { throw new WebServiceException(primaryWsdl.getSystemId()+ " is not a WSDL. But it is passed as a primary WSDL"); } SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc; if (!wsdlDoc.hasService()) { if(wsdlDoc.getAllServices().isEmpty()) throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+ " since it doesn't have Service "+serviceName); else throw new WebServiceException("WSDL "+primaryDoc.getSystemId() +" has the following services "+wsdlDoc.getAllServices() +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?"); } }
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort, Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding, SDDocumentSource primaryWsdl) { DatabindingFactory fac = DatabindingFactory.newInstance(); DatabindingConfig config = new DatabindingConfig(); config.setEndpointClass(implType); config.getMappingInfo().setServiceName(serviceName); config.setWsdlPort(wsdlPort); config.setWSBinding(binding); config.setClassLoader(implType.getClassLoader()); config.getMappingInfo().setPortName(portName); if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId()); config.setMetadataReader(getExternalMetadatReader(implType, binding)); com.sun.xml.ws.db.DatabindingImpl rt = (com.sun.xml.ws.db.DatabindingImpl)fac.createRuntime(config); return (AbstractSEIModelImpl) rt.getModel(); }
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort, Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding, SDDocumentSource primaryWsdl) { DatabindingFactory fac = DatabindingFactory.newInstance(); DatabindingConfig config = new DatabindingConfig(); config.setEndpointClass(implType); config.getMappingInfo().setServiceName(serviceName); config.setWsdlPort(wsdlPort); config.setWSBinding(binding); config.setClassLoader(implType.getClassLoader()); config.getMappingInfo().setPortName(portName); if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId()); config.setMetadataReader(getExternalMetadatReader(implType, binding)); com.sun.xml.ws.db.DatabindingImpl rt = (com.sun.xml.ws.db.DatabindingImpl)fac.createRuntime(config); return (AbstractSEIModelImpl) rt.getModel(); }
private static AbstractSEIModelImpl createSEIModel(WSDLPort wsdlPort, Class<?> implType, @NotNull QName serviceName, @NotNull QName portName, WSBinding binding, SDDocumentSource primaryWsdl) { DatabindingFactory fac = DatabindingFactory.newInstance(); DatabindingConfig config = new DatabindingConfig(); config.setEndpointClass(implType); config.getMappingInfo().setServiceName(serviceName); config.setWsdlPort(wsdlPort); config.setWSBinding(binding); config.setClassLoader(implType.getClassLoader()); config.getMappingInfo().setPortName(portName); if (primaryWsdl != null) config.setWsdlURL(primaryWsdl.getSystemId()); config.setMetadataReader(getExternalMetadatReader(implType, binding)); com.sun.xml.ws.db.DatabindingImpl rt = (com.sun.xml.ws.db.DatabindingImpl)fac.createRuntime(config); return (AbstractSEIModelImpl) rt.getModel(); }
@NotNull QName serviceName, @NotNull QName portName, Container container, EntityResolver resolver) { URL wsdlUrl = primaryWsdl.getSystemId(); try {
@NotNull QName serviceName, @NotNull QName portName, Container container, EntityResolver resolver) { URL wsdlUrl = primaryWsdl.getSystemId(); try {
@NotNull QName serviceName, @NotNull QName portName, Container container, EntityResolver resolver) { URL wsdlUrl = primaryWsdl.getSystemId(); try {