src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java

changeset 408
b0610cd08440
parent 384
8f2986ff0235
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Thu Sep 26 10:43:28 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Fri Oct 04 16:21:34 2013 +0100
     1.3 @@ -41,7 +41,9 @@
     1.4  import com.sun.xml.internal.ws.api.databinding.DatabindingFactory;
     1.5  import com.sun.xml.internal.ws.api.databinding.MetadataReader;
     1.6  import com.sun.xml.internal.ws.api.model.SEIModel;
     1.7 +import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
     1.8  import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
     1.9 +import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
    1.10  import com.sun.xml.internal.ws.api.pipe.Stubs;
    1.11  import com.sun.xml.internal.ws.api.server.Container;
    1.12  import com.sun.xml.internal.ws.api.server.ContainerResolver;
    1.13 @@ -51,15 +53,11 @@
    1.14  import com.sun.xml.internal.ws.client.HandlerConfigurator.AnnotationConfigurator;
    1.15  import com.sun.xml.internal.ws.client.HandlerConfigurator.HandlerResolverImpl;
    1.16  import com.sun.xml.internal.ws.client.sei.SEIStub;
    1.17 -
    1.18  import com.sun.xml.internal.ws.developer.MemberSubmissionAddressingFeature;
    1.19  import com.sun.xml.internal.ws.developer.UsesJAXBContextFeature;
    1.20  import com.sun.xml.internal.ws.developer.WSBindingProvider;
    1.21  import com.sun.xml.internal.ws.model.RuntimeModeler;
    1.22  import com.sun.xml.internal.ws.model.SOAPSEIModel;
    1.23 -import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl;
    1.24 -import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
    1.25 -import com.sun.xml.internal.ws.model.wsdl.WSDLServiceImpl;
    1.26  import com.sun.xml.internal.ws.resources.ClientMessages;
    1.27  import com.sun.xml.internal.ws.resources.DispatchMessages;
    1.28  import com.sun.xml.internal.ws.resources.ProviderApiMessages;
    1.29 @@ -67,6 +65,7 @@
    1.30  import com.sun.xml.internal.ws.util.ServiceConfigurationError;
    1.31  import com.sun.xml.internal.ws.util.ServiceFinder;
    1.32  import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
    1.33 +
    1.34  import org.xml.sax.EntityResolver;
    1.35  import org.xml.sax.SAXException;
    1.36  
    1.37 @@ -86,6 +85,7 @@
    1.38  import javax.xml.ws.WebServiceFeature;
    1.39  import javax.xml.ws.handler.HandlerResolver;
    1.40  import javax.xml.ws.soap.AddressingFeature;
    1.41 +
    1.42  import java.io.IOException;
    1.43  import java.lang.reflect.InvocationHandler;
    1.44  import java.lang.reflect.Proxy;
    1.45 @@ -179,7 +179,7 @@
    1.46       * This fiels can be be null if the service is created without wsdl but later
    1.47       * the epr supplies a wsdl that can be parsed.
    1.48       */
    1.49 -    private  @Nullable WSDLServiceImpl wsdlService;
    1.50 +    private  @Nullable WSDLService wsdlService;
    1.51  
    1.52      private final Container container;
    1.53      /**
    1.54 @@ -219,7 +219,7 @@
    1.55       * @param serviceClass
    1.56       *      Either {@link Service}.class or other generated service-derived classes.
    1.57       */
    1.58 -    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLServiceImpl service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeature... features) {
    1.59 +    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLService service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeature... features) {
    1.60          this(wsdl, service, serviceName, serviceClass, new WebServiceFeatureList(features));
    1.61      }
    1.62  
    1.63 @@ -227,7 +227,7 @@
    1.64       * @param serviceClass
    1.65       *      Either {@link Service}.class or other generated service-derived classes.
    1.66       */
    1.67 -    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLServiceImpl service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeatureList features) {
    1.68 +    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLService service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeatureList features) {
    1.69          //we cant create a Service without serviceName
    1.70          if (serviceName == null) {
    1.71              throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME_NULL(null));
    1.72 @@ -303,7 +303,7 @@
    1.73                  if (wsdl != null) {
    1.74                      try {
    1.75                          URL url = wsdl.getSystemId()==null ? null : JAXWSUtils.getEncodedURL(wsdl.getSystemId());
    1.76 -                        WSDLModelImpl model = parseWSDL(url, wsdl, serviceClass);
    1.77 +                        WSDLModel model = parseWSDL(url, wsdl, serviceClass);
    1.78                          service = model.getService(this.serviceName);
    1.79                          if (service == null)
    1.80                              throw new WebServiceException(
    1.81 @@ -316,6 +316,10 @@
    1.82                          throw new WebServiceException(ClientMessages.INVALID_WSDL_URL(wsdl.getSystemId()));
    1.83                      }
    1.84                  }
    1.85 +        } else {
    1.86 +            // fill in statically known ports
    1.87 +            for (WSDLPort port : service.getPorts())
    1.88 +                ports.put(port.getName(), new PortInfo(this, port));
    1.89          }
    1.90          this.wsdlService = service;
    1.91  
    1.92 @@ -339,7 +343,7 @@
    1.93       *      Either this or <tt>wsdl</tt> parameter must be given.
    1.94       *      Null location means the system won't be able to resolve relative references in the WSDL,
    1.95       */
    1.96 -    private WSDLModelImpl parseWSDL(URL wsdlDocumentLocation, Source wsdlSource, Class serviceClass) {
    1.97 +    private WSDLModel parseWSDL(URL wsdlDocumentLocation, Source wsdlSource, Class serviceClass) {
    1.98          try {
    1.99              return RuntimeWSDLParser.parse(wsdlDocumentLocation, wsdlSource, createCatalogResolver(),
   1.100                  true, getContainer(), serviceClass, ServiceFinder.find(WSDLParserExtension.class).toArray());
   1.101 @@ -385,7 +389,7 @@
   1.102      public <T> T getPort(QName portName, Class<T> portInterface, WebServiceFeature... features) {
   1.103          if (portName == null || portInterface == null)
   1.104              throw new IllegalArgumentException();
   1.105 -        WSDLServiceImpl tWsdlService = this.wsdlService;
   1.106 +        WSDLService tWsdlService = this.wsdlService;
   1.107          if (tWsdlService == null) {
   1.108              // assigning it to local variable and not setting it back to this.wsdlService intentionally
   1.109              // as we don't want to include the service instance with information gathered from sei
   1.110 @@ -396,7 +400,7 @@
   1.111              }
   1.112  
   1.113          }
   1.114 -        WSDLPortImpl portModel = getPortModel(tWsdlService, portName);
   1.115 +        WSDLPort portModel = getPortModel(tWsdlService, portName);
   1.116          return getPort(portModel.getEPR(), portName, portInterface, new WebServiceFeatureList(features));
   1.117      }
   1.118  
   1.119 @@ -436,7 +440,7 @@
   1.120      public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
   1.121          //get the portType from SEI
   1.122          QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
   1.123 -        WSDLServiceImpl tmpWsdlService = this.wsdlService;
   1.124 +        WSDLService tmpWsdlService = this.wsdlService;
   1.125          if (tmpWsdlService == null) {
   1.126              // assigning it to local variable and not setting it back to this.wsdlService intentionally
   1.127              // as we don't want to include the service instance with information gathered from sei
   1.128 @@ -447,7 +451,7 @@
   1.129              }
   1.130          }
   1.131          //get the first port corresponding to the SEI
   1.132 -        WSDLPortImpl port = tmpWsdlService.getMatchingPort(portTypeName);
   1.133 +        WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
   1.134          if (port == null) {
   1.135              throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
   1.136          }
   1.137 @@ -672,7 +676,7 @@
   1.138                  throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
   1.139              }
   1.140              try {
   1.141 -                WSDLModelImpl eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
   1.142 +                WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
   1.143                  wsdlService = eprWsdlMdl.getService(serviceName);
   1.144                  if (wsdlService == null)
   1.145                      throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
   1.146 @@ -685,7 +689,7 @@
   1.147  
   1.148          if (portName == null && portTypeName != null) {
   1.149              //get the first port corresponding to the SEI
   1.150 -            WSDLPortImpl port = wsdlService.getMatchingPort(portTypeName);
   1.151 +            WSDLPort port = wsdlService.getMatchingPort(portTypeName);
   1.152              if (port == null)
   1.153                  throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
   1.154              portName = port.getName();
   1.155 @@ -732,7 +736,7 @@
   1.156          );
   1.157      }
   1.158  
   1.159 -    private WSDLServiceImpl getWSDLModelfromSEI(final Class sei) {
   1.160 +    private WSDLService getWSDLModelfromSEI(final Class sei) {
   1.161          WebService ws = AccessController.doPrivileged(new PrivilegedAction<WebService>() {
   1.162              public WebService run() {
   1.163                  return (WebService) sei.getAnnotation(WebService.class);
   1.164 @@ -743,11 +747,11 @@
   1.165          String wsdlLocation = ws.wsdlLocation();
   1.166          wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
   1.167          Source wsdl = new StreamSource(wsdlLocation);
   1.168 -        WSDLServiceImpl service = null;
   1.169 +        WSDLService service = null;
   1.170  
   1.171          try {
   1.172              URL url = wsdl.getSystemId() == null ? null : new URL(wsdl.getSystemId());
   1.173 -            WSDLModelImpl model = parseWSDL(url, wsdl, sei);
   1.174 +            WSDLModel model = parseWSDL(url, wsdl, sei);
   1.175              service = model.getService(this.serviceName);
   1.176              if (service == null)
   1.177                  throw new WebServiceException(
   1.178 @@ -815,7 +819,7 @@
   1.179       */
   1.180      private StringBuilder buildWsdlPortNames() {
   1.181          Set<QName> wsdlPortNames = new HashSet<QName>();
   1.182 -        for (WSDLPortImpl port : wsdlService.getPorts()) {
   1.183 +        for (WSDLPort port : wsdlService.getPorts()) {
   1.184              wsdlPortNames.add(port.getName());
   1.185          }
   1.186          return buildNameList(wsdlPortNames);
   1.187 @@ -826,8 +830,8 @@
   1.188       *
   1.189       * @return guaranteed to be non-null.
   1.190       */
   1.191 -    public @NotNull WSDLPortImpl getPortModel(WSDLServiceImpl wsdlService, QName portName) {
   1.192 -        WSDLPortImpl port = wsdlService.get(portName);
   1.193 +    public @NotNull WSDLPort getPortModel(WSDLService wsdlService, QName portName) {
   1.194 +        WSDLPort port = wsdlService.get(portName);
   1.195          if (port == null)
   1.196              throw new WebServiceException(
   1.197                  ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
   1.198 @@ -884,7 +888,7 @@
   1.199      }
   1.200  
   1.201      private SEIPortInfo createSEIPortInfo(QName portName, Class portInterface, WebServiceFeatureList features) {
   1.202 -        WSDLPortImpl wsdlPort = getPortModel(wsdlService, portName);
   1.203 +        WSDLPort wsdlPort = getPortModel(wsdlService, portName);
   1.204          SEIModel model = buildRuntimeModel(serviceName, portName, portInterface, wsdlPort, features);
   1.205  
   1.206          return new SEIPortInfo(this, portInterface, (SOAPSEIModel) model, wsdlPort);
   1.207 @@ -894,7 +898,7 @@
   1.208          return features.contains(UsesJAXBContextFeature.class);
   1.209      }
   1.210  
   1.211 -    public WSDLServiceImpl getWsdlService() {
   1.212 +    public WSDLService getWsdlService() {
   1.213          return wsdlService;
   1.214      }
   1.215  

mercurial