1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
28 import com.sun.istack.internal.Nullable; |
28 import com.sun.istack.internal.Nullable; |
29 import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult; |
29 import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult; |
30 import com.sun.xml.internal.ws.api.Component; |
30 import com.sun.xml.internal.ws.api.Component; |
31 import com.sun.xml.internal.ws.api.WSBinding; |
31 import com.sun.xml.internal.ws.api.WSBinding; |
32 import com.sun.xml.internal.ws.api.BindingID; |
32 import com.sun.xml.internal.ws.api.BindingID; |
|
33 import com.sun.xml.internal.ws.api.databinding.MetadataReader; |
33 import com.sun.xml.internal.ws.api.message.Packet; |
34 import com.sun.xml.internal.ws.api.message.Packet; |
34 import com.sun.xml.internal.ws.binding.BindingImpl; |
35 import com.sun.xml.internal.ws.binding.BindingImpl; |
35 import com.sun.xml.internal.ws.api.server.*; |
36 import com.sun.xml.internal.ws.api.server.*; |
36 import com.sun.xml.internal.ws.server.EndpointFactory; |
37 import com.sun.xml.internal.ws.server.EndpointFactory; |
37 import com.sun.xml.internal.ws.server.ServerRtException; |
38 import com.sun.xml.internal.ws.server.ServerRtException; |
301 Class.forName("com.sun.net.httpserver.HttpServer"); |
302 Class.forName("com.sun.net.httpserver.HttpServer"); |
302 } catch (Exception e) { |
303 } catch (Exception e) { |
303 throw new UnsupportedOperationException("Couldn't load light weight http server", e); |
304 throw new UnsupportedOperationException("Couldn't load light weight http server", e); |
304 } |
305 } |
305 container = getContainer(); |
306 container = getContainer(); |
|
307 MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(implClass, binding); |
306 WSEndpoint wse = WSEndpoint.create( |
308 WSEndpoint wse = WSEndpoint.create( |
307 implClass, true, |
309 implClass, true, |
308 invoker, |
310 invoker, |
309 getProperty(QName.class, Endpoint.WSDL_SERVICE), |
311 getProperty(QName.class, Endpoint.WSDL_SERVICE), |
310 getProperty(QName.class, Endpoint.WSDL_PORT), |
312 getProperty(QName.class, Endpoint.WSDL_PORT), |
311 container, |
313 container, |
312 binding, |
314 binding, |
313 getPrimaryWsdl(), |
315 getPrimaryWsdl(metadataReader), |
314 buildDocList(), |
316 buildDocList(), |
315 (EntityResolver) null, |
317 (EntityResolver) null, |
316 false |
318 false |
317 ); |
319 ); |
318 // Don't load HttpEndpoint class before as it may load HttpServer classes |
320 // Don't load HttpEndpoint class before as it may load HttpServer classes |
358 } |
360 } |
359 |
361 |
360 /** |
362 /** |
361 * Gets wsdl from @WebService or @WebServiceProvider |
363 * Gets wsdl from @WebService or @WebServiceProvider |
362 */ |
364 */ |
363 private @Nullable SDDocumentSource getPrimaryWsdl() { |
365 private @Nullable SDDocumentSource getPrimaryWsdl(MetadataReader metadataReader) { |
364 // Takes care of @WebService, @WebServiceProvider's wsdlLocation |
366 // Takes care of @WebService, @WebServiceProvider's wsdlLocation |
365 EndpointFactory.verifyImplementorClass(implClass); |
367 EndpointFactory.verifyImplementorClass(implClass, metadataReader); |
366 String wsdlLocation = EndpointFactory.getWsdlLocation(implClass); |
368 String wsdlLocation = EndpointFactory.getWsdlLocation(implClass, metadataReader); |
367 if (wsdlLocation != null) { |
369 if (wsdlLocation != null) { |
368 ClassLoader cl = implClass.getClassLoader(); |
370 ClassLoader cl = implClass.getClassLoader(); |
369 URL url = cl.getResource(wsdlLocation); |
371 URL url = cl.getResource(wsdlLocation); |
370 if (url != null) { |
372 if (url != null) { |
371 return SDDocumentSource.create(url); |
373 return SDDocumentSource.create(url); |