< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java

Print this page




 122      * The {@link WSDLParserExtension}. Always non-null.
 123      */
 124     private final WSDLParserExtension extensionFacade;
 125 
 126     private final WSDLParserExtensionContextImpl context;
 127 
 128     List<WSDLParserExtension> extensions;
 129 
 130     //Capture namespaces declared on the ancestors of wsa:EndpointReference, so that valid XmlStreamBuffer is created
 131     // from the EndpointReference fragment.
 132     Map<String, String> wsdldef_nsdecl = new HashMap<String, String>();
 133     Map<String, String> service_nsdecl = new HashMap<String, String>();
 134     Map<String, String> port_nsdecl = new HashMap<String, String>();
 135 
 136     /**
 137      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 138      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 139      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 140      *
 141      * @param wsdlLoc
 142      *      Either this or <tt>wsdl</tt> parameter must be given.
 143      *      Null location means the system won't be able to resolve relative references in the WSDL,
 144      */
 145     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 146                                       boolean isClientSide, Container container,
 147                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 148         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, PolicyResolverFactory.create(),extensions);
 149     }
 150 
 151     /**
 152      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 153      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 154      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 155      *
 156      * @param wsdlLoc
 157      *      Either this or <tt>wsdl</tt> parameter must be given.
 158      *      Null location means the system won't be able to resolve relative references in the WSDL,
 159      */
 160     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 161                                       boolean isClientSide, Container container, Class serviceClass,
 162                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 163         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, PolicyResolverFactory.create(),extensions);
 164     }
 165 
 166     /**
 167      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 168      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 169      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 170      *
 171      * @param wsdlLoc
 172      *      Either this or <tt>wsdl</tt> parameter must be given.
 173      *      Null location means the system won't be able to resolve relative references in the WSDL,
 174      */
 175     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 176                                       boolean isClientSide, Container container, @NotNull PolicyResolver policyResolver,
 177                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 178         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, policyResolver, extensions);
 179     }
 180 
 181     /**
 182      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 183      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 184      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 185      *
 186      * @param wsdlLoc
 187      *      Either this or <tt>wsdl</tt> parameter must be given.
 188      *      Null location means the system won't be able to resolve relative references in the WSDL,
 189      */
 190     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 191                                       boolean isClientSide, Container container, Class serviceClass,
 192                                       @NotNull PolicyResolver policyResolver,
 193                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 194         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, policyResolver, false, extensions);
 195     }
 196 
 197     /**
 198      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 199      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 200      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 201      *
 202      * @param wsdlLoc
 203      *      Either this or <tt>wsdl</tt> parameter must be given.
 204      *      Null location means the system won't be able to resolve relative references in the WSDL,
 205      */
 206     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 207                                       boolean isClientSide, Container container, Class serviceClass,
 208                                       @NotNull PolicyResolver policyResolver,
 209                                       boolean isUseStreamFromEntityResolverWrapper,
 210                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 211         assert resolver != null;
 212 
 213         RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
 214         Parser parser;
 215         try{
 216             parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
 217             if(!hasWSDLDefinitions(parser.parser)){
 218                 throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
 219                         WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
 220             }
 221         }catch(XMLStreamException e){
 222             //Try MEX if there is WSDLLoc available
 223             if(wsdlLoc == null)




 122      * The {@link WSDLParserExtension}. Always non-null.
 123      */
 124     private final WSDLParserExtension extensionFacade;
 125 
 126     private final WSDLParserExtensionContextImpl context;
 127 
 128     List<WSDLParserExtension> extensions;
 129 
 130     //Capture namespaces declared on the ancestors of wsa:EndpointReference, so that valid XmlStreamBuffer is created
 131     // from the EndpointReference fragment.
 132     Map<String, String> wsdldef_nsdecl = new HashMap<String, String>();
 133     Map<String, String> service_nsdecl = new HashMap<String, String>();
 134     Map<String, String> port_nsdecl = new HashMap<String, String>();
 135 
 136     /**
 137      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 138      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 139      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 140      *
 141      * @param wsdlLoc
 142      *      Either this or {@code wsdl} parameter must be given.
 143      *      Null location means the system won't be able to resolve relative references in the WSDL,
 144      */
 145     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 146                                       boolean isClientSide, Container container,
 147                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 148         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, PolicyResolverFactory.create(),extensions);
 149     }
 150 
 151     /**
 152      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 153      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 154      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 155      *
 156      * @param wsdlLoc
 157      *      Either this or {@code wsdl} parameter must be given.
 158      *      Null location means the system won't be able to resolve relative references in the WSDL,
 159      */
 160     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 161                                       boolean isClientSide, Container container, Class serviceClass,
 162                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 163         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, PolicyResolverFactory.create(),extensions);
 164     }
 165 
 166     /**
 167      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 168      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 169      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 170      *
 171      * @param wsdlLoc
 172      *      Either this or {@code wsdl} parameter must be given.
 173      *      Null location means the system won't be able to resolve relative references in the WSDL,
 174      */
 175     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 176                                       boolean isClientSide, Container container, @NotNull PolicyResolver policyResolver,
 177                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 178         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, policyResolver, extensions);
 179     }
 180 
 181     /**
 182      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 183      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 184      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 185      *
 186      * @param wsdlLoc
 187      *      Either this or {@code wsdl} parameter must be given.
 188      *      Null location means the system won't be able to resolve relative references in the WSDL,
 189      */
 190     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 191                                       boolean isClientSide, Container container, Class serviceClass,
 192                                       @NotNull PolicyResolver policyResolver,
 193                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 194         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, policyResolver, false, extensions);
 195     }
 196 
 197     /**
 198      * Parses the WSDL and gives WSDLModel. If wsdl parameter is null, then wsdlLoc is used to get the WSDL. If the WSDL
 199      * document could not be obtained then {@link MetadataResolverFactory} is tried to get the WSDL document, if not found
 200      * then as last option, if the wsdlLoc has no '?wsdl' as query parameter then it is tried by appending '?wsdl'.
 201      *
 202      * @param wsdlLoc
 203      *      Either this or {@code wsdl} parameter must be given.
 204      *      Null location means the system won't be able to resolve relative references in the WSDL,
 205      */
 206     public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
 207                                       boolean isClientSide, Container container, Class serviceClass,
 208                                       @NotNull PolicyResolver policyResolver,
 209                                       boolean isUseStreamFromEntityResolverWrapper,
 210                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
 211         assert resolver != null;
 212 
 213         RuntimeWSDLParser wsdlParser = new RuntimeWSDLParser(wsdlSource.getSystemId(), new EntityResolverWrapper(resolver, isUseStreamFromEntityResolverWrapper), isClientSide, container, policyResolver, extensions);
 214         Parser parser;
 215         try{
 216             parser = wsdlParser.resolveWSDL(wsdlLoc, wsdlSource, serviceClass);
 217             if(!hasWSDLDefinitions(parser.parser)){
 218                 throw new XMLStreamException(ClientMessages.RUNTIME_WSDLPARSER_INVALID_WSDL(parser.systemId,
 219                         WSDLConstants.QNAME_DEFINITIONS, parser.parser.getName(), parser.parser.getLocation()));
 220             }
 221         }catch(XMLStreamException e){
 222             //Try MEX if there is WSDLLoc available
 223             if(wsdlLoc == null)


< prev index next >