Java Code Examples for com.sun.xml.internal.ws.api.model.wsdl.WSDLPort#getName()

The following examples show how to use com.sun.xml.internal.ws.api.model.wsdl.WSDLPort#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSServiceDelegate.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
Example 2
Source File: WSServiceDelegate.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
Example 3
Source File: WSServiceDelegate.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
Example 4
Source File: WSServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
Example 5
Source File: WSServiceDelegate.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
Example 6
Source File: PortInfo.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) {
    this.owner = owner;
    this.targetEndpoint = port.getAddress();
    this.portName = port.getName();
    this.bindingId = port.getBinding().getBindingId();
    this.portModel = port;
    this.policyMap = createPolicyMap();
}
 
Example 7
Source File: PortInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) {
    this.owner = owner;
    this.targetEndpoint = port.getAddress();
    this.portName = port.getName();
    this.bindingId = port.getBinding().getBindingId();
    this.portModel = port;
    this.policyMap = createPolicyMap();
}
 
Example 8
Source File: PortInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) {
    this.owner = owner;
    this.targetEndpoint = port.getAddress();
    this.portName = port.getName();
    this.bindingId = port.getBinding().getBindingId();
    this.portModel = port;
    this.policyMap = createPolicyMap();
}
 
Example 9
Source File: PortInfo.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) {
    this.owner = owner;
    this.targetEndpoint = port.getAddress();
    this.portName = port.getName();
    this.bindingId = port.getBinding().getBindingId();
    this.portModel = port;
    this.policyMap = createPolicyMap();
}
 
Example 10
Source File: PortInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PortInfo(@NotNull WSServiceDelegate owner, @NotNull WSDLPort port) {
    this.owner = owner;
    this.targetEndpoint = port.getAddress();
    this.portName = port.getName();
    this.bindingId = port.getBinding().getBindingId();
    this.portModel = port;
    this.policyMap = createPolicyMap();
}
 
Example 11
Source File: Stub.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private Stub(WSServiceDelegate owner, @Nullable Tube master, @Nullable WSPortInfo portInfo, QName portname, BindingImpl binding, @Nullable WSDLPort wsdlPort, EndpointAddress defaultEndPointAddress, @Nullable WSEndpointReference epr) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        this.owner = owner;
        this.portInfo = portInfo;
        this.wsdlPort = wsdlPort != null ? wsdlPort : (portInfo != null ? portInfo.getPort() : null);
        this.portname = portname;
        if (portname == null) {
            if (portInfo != null) {
                this.portname = portInfo.getPortName();
            } else if (wsdlPort != null) {
                this.portname = wsdlPort.getName();
            }
        }
        this.binding = binding;

        ComponentFeature cf = binding.getFeature(ComponentFeature.class);
        if (cf != null && Target.STUB.equals(cf.getTarget())) {
            components.add(cf.getComponent());
        }
        ComponentsFeature csf = binding.getFeature(ComponentsFeature.class);
        if (csf != null) {
            for (ComponentFeature cfi : csf.getComponentFeatures()) {
                if (Target.STUB.equals(cfi.getTarget()))
                    components.add(cfi.getComponent());
            }
        }

        // if there is an EPR, EPR's address should be used for invocation instead of default address
        if (epr != null) {
            this.requestContext.setEndPointAddressString(epr.getAddress());
        } else {
            this.requestContext.setEndpointAddress(defaultEndPointAddress);
        }
        this.engine = new Engine(getStringId(), owner.getContainer(), owner.getExecutor());
        this.endpointReference = epr;
        wsdlProperties = (wsdlPort == null) ? new WSDLDirectProperties(owner.getServiceName(), portname) : new WSDLPortProperties(wsdlPort);

        this.cleanRequestContext = this.requestContext.copy();

        // ManagedObjectManager MUST be created before the pipeline
        // is constructed.

        managedObjectManager = new MonitorRootClient(this).createManagedObjectManager(this);

        if (master != null) {
            this.tubes = new TubePool(master);
        } else {
            this.tubes = new TubePool(createPipeline(portInfo, binding));
        }

        addrVersion = binding.getAddressingVersion();

        // This needs to happen after createPipeline.
        // TBD: Check if it needs to happen outside the Stub constructor.
        managedObjectManager.resumeJMXRegistration();
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 12
Source File: WSServiceDelegate.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 * @param wsepr EndpointReference from which portName will be extracted.
 *      If EndpointName ( port name) is null in EPR, then it will try to get if from WSDLModel using portType QName
 * @param portTypeName
 *          should be null in dispatch case
 *          should be non null in SEI case
 * @return
 *      port name from EPR after validating various metadat elements.
 *      Also if service instance does n't have wsdl,
 *      then it gets the WSDL metadata from EPR and builds wsdl model.
 */
private QName getPortNameFromEPR(@NotNull WSEndpointReference wsepr, @Nullable QName portTypeName) {
    QName portName;
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    QName eprServiceName = metadata.getServiceName();
    QName eprPortName = metadata.getPortName();
    if ((eprServiceName != null ) && !eprServiceName.equals(serviceName)) {
        throw new WebServiceException("EndpointReference WSDL ServiceName differs from Service Instance WSDL Service QName.\n"
                + " The two Service QNames must match");
    }
    if (wsdlService == null) {
        Source eprWsdlSource = metadata.getWsdlSource();
        if (eprWsdlSource == null) {
            throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
        }
        try {
            WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
            wsdlService = eprWsdlMdl.getService(serviceName);
            if (wsdlService == null)
                throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
                        buildNameList(eprWsdlMdl.getServices().keySet())));
        } catch (MalformedURLException e) {
            throw new WebServiceException(ClientMessages.INVALID_ADDRESS(wsepr.getAddress()));
        }
    }
    portName = eprPortName;

    if (portName == null && portTypeName != null) {
        //get the first port corresponding to the SEI
        WSDLPort port = wsdlService.getMatchingPort(portTypeName);
        if (port == null)
            throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
        portName = port.getName();
    }
    if (portName == null)
        throw new WebServiceException(ProviderApiMessages.NULL_PORTNAME());
    if (wsdlService.get(portName) == null)
        throw new WebServiceException(ClientMessages.INVALID_EPR_PORT_NAME(portName, buildWsdlPortNames()));

    return portName;

}
 
Example 13
Source File: Stub.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private Stub(WSServiceDelegate owner, @Nullable Tube master, @Nullable WSPortInfo portInfo, QName portname, BindingImpl binding, @Nullable WSDLPort wsdlPort, EndpointAddress defaultEndPointAddress, @Nullable WSEndpointReference epr) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        this.owner = owner;
        this.portInfo = portInfo;
        this.wsdlPort = wsdlPort != null ? wsdlPort : (portInfo != null ? portInfo.getPort() : null);
        this.portname = portname;
        if (portname == null) {
            if (portInfo != null) {
                this.portname = portInfo.getPortName();
            } else if (wsdlPort != null) {
                this.portname = wsdlPort.getName();
            }
        }
        this.binding = binding;

        ComponentFeature cf = binding.getFeature(ComponentFeature.class);
        if (cf != null && Target.STUB.equals(cf.getTarget())) {
            components.add(cf.getComponent());
        }
        ComponentsFeature csf = binding.getFeature(ComponentsFeature.class);
        if (csf != null) {
            for (ComponentFeature cfi : csf.getComponentFeatures()) {
                if (Target.STUB.equals(cfi.getTarget()))
                    components.add(cfi.getComponent());
            }
        }

        // if there is an EPR, EPR's address should be used for invocation instead of default address
        if (epr != null) {
            this.requestContext.setEndPointAddressString(epr.getAddress());
        } else {
            this.requestContext.setEndpointAddress(defaultEndPointAddress);
        }
        this.engine = new Engine(getStringId(), owner.getContainer(), owner.getExecutor());
        this.endpointReference = epr;
        wsdlProperties = (wsdlPort == null) ? new WSDLDirectProperties(owner.getServiceName(), portname) : new WSDLPortProperties(wsdlPort);

        this.cleanRequestContext = this.requestContext.copy();

        // ManagedObjectManager MUST be created before the pipeline
        // is constructed.

        managedObjectManager = new MonitorRootClient(this).createManagedObjectManager(this);

        if (master != null) {
            this.tubes = new TubePool(master);
        } else {
            this.tubes = new TubePool(createPipeline(portInfo, binding));
        }

        addrVersion = binding.getAddressingVersion();

        // This needs to happen after createPipeline.
        // TBD: Check if it needs to happen outside the Stub constructor.
        managedObjectManager.resumeJMXRegistration();
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 14
Source File: WSServiceDelegate.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 * @param wsepr EndpointReference from which portName will be extracted.
 *      If EndpointName ( port name) is null in EPR, then it will try to get if from WSDLModel using portType QName
 * @param portTypeName
 *          should be null in dispatch case
 *          should be non null in SEI case
 * @return
 *      port name from EPR after validating various metadat elements.
 *      Also if service instance does n't have wsdl,
 *      then it gets the WSDL metadata from EPR and builds wsdl model.
 */
private QName getPortNameFromEPR(@NotNull WSEndpointReference wsepr, @Nullable QName portTypeName) {
    QName portName;
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    QName eprServiceName = metadata.getServiceName();
    QName eprPortName = metadata.getPortName();
    if ((eprServiceName != null ) && !eprServiceName.equals(serviceName)) {
        throw new WebServiceException("EndpointReference WSDL ServiceName differs from Service Instance WSDL Service QName.\n"
                + " The two Service QNames must match");
    }
    if (wsdlService == null) {
        Source eprWsdlSource = metadata.getWsdlSource();
        if (eprWsdlSource == null) {
            throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
        }
        try {
            WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
            wsdlService = eprWsdlMdl.getService(serviceName);
            if (wsdlService == null)
                throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
                        buildNameList(eprWsdlMdl.getServices().keySet())));
        } catch (MalformedURLException e) {
            throw new WebServiceException(ClientMessages.INVALID_ADDRESS(wsepr.getAddress()));
        }
    }
    portName = eprPortName;

    if (portName == null && portTypeName != null) {
        //get the first port corresponding to the SEI
        WSDLPort port = wsdlService.getMatchingPort(portTypeName);
        if (port == null)
            throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
        portName = port.getName();
    }
    if (portName == null)
        throw new WebServiceException(ProviderApiMessages.NULL_PORTNAME());
    if (wsdlService.get(portName) == null)
        throw new WebServiceException(ClientMessages.INVALID_EPR_PORT_NAME(portName, buildWsdlPortNames()));

    return portName;

}
 
Example 15
Source File: Stub.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private Stub(WSServiceDelegate owner, @Nullable Tube master, @Nullable WSPortInfo portInfo, QName portname, BindingImpl binding, @Nullable WSDLPort wsdlPort, EndpointAddress defaultEndPointAddress, @Nullable WSEndpointReference epr) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        this.owner = owner;
        this.portInfo = portInfo;
        this.wsdlPort = wsdlPort != null ? wsdlPort : (portInfo != null ? portInfo.getPort() : null);
        this.portname = portname;
        if (portname == null) {
            if (portInfo != null) {
                this.portname = portInfo.getPortName();
            } else if (wsdlPort != null) {
                this.portname = wsdlPort.getName();
            }
        }
        this.binding = binding;

        ComponentFeature cf = binding.getFeature(ComponentFeature.class);
        if (cf != null && Target.STUB.equals(cf.getTarget())) {
            components.add(cf.getComponent());
        }
        ComponentsFeature csf = binding.getFeature(ComponentsFeature.class);
        if (csf != null) {
            for (ComponentFeature cfi : csf.getComponentFeatures()) {
                if (Target.STUB.equals(cfi.getTarget()))
                    components.add(cfi.getComponent());
            }
        }

        // if there is an EPR, EPR's address should be used for invocation instead of default address
        if (epr != null) {
            this.requestContext.setEndPointAddressString(epr.getAddress());
        } else {
            this.requestContext.setEndpointAddress(defaultEndPointAddress);
        }
        this.engine = new Engine(getStringId(), owner.getContainer(), owner.getExecutor());
        this.endpointReference = epr;
        wsdlProperties = (wsdlPort == null) ? new WSDLDirectProperties(owner.getServiceName(), portname) : new WSDLPortProperties(wsdlPort);

        this.cleanRequestContext = this.requestContext.copy();

        // ManagedObjectManager MUST be created before the pipeline
        // is constructed.

        managedObjectManager = new MonitorRootClient(this).createManagedObjectManager(this);

        if (master != null) {
            this.tubes = new TubePool(master);
        } else {
            this.tubes = new TubePool(createPipeline(portInfo, binding));
        }

        addrVersion = binding.getAddressingVersion();

        // This needs to happen after createPipeline.
        // TBD: Check if it needs to happen outside the Stub constructor.
        managedObjectManager.resumeJMXRegistration();
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 16
Source File: Stub.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private Stub(WSServiceDelegate owner, @Nullable Tube master, @Nullable WSPortInfo portInfo, QName portname, BindingImpl binding, @Nullable WSDLPort wsdlPort, EndpointAddress defaultEndPointAddress, @Nullable WSEndpointReference epr) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        this.owner = owner;
        this.portInfo = portInfo;
        this.wsdlPort = wsdlPort != null ? wsdlPort : (portInfo != null ? portInfo.getPort() : null);
        this.portname = portname;
        if (portname == null) {
            if (portInfo != null) {
                this.portname = portInfo.getPortName();
            } else if (wsdlPort != null) {
                this.portname = wsdlPort.getName();
            }
        }
        this.binding = binding;

        ComponentFeature cf = binding.getFeature(ComponentFeature.class);
        if (cf != null && Target.STUB.equals(cf.getTarget())) {
            components.add(cf.getComponent());
        }
        ComponentsFeature csf = binding.getFeature(ComponentsFeature.class);
        if (csf != null) {
            for (ComponentFeature cfi : csf.getComponentFeatures()) {
                if (Target.STUB.equals(cfi.getTarget()))
                    components.add(cfi.getComponent());
            }
        }

        // if there is an EPR, EPR's address should be used for invocation instead of default address
        if (epr != null) {
            this.requestContext.setEndPointAddressString(epr.getAddress());
        } else {
            this.requestContext.setEndpointAddress(defaultEndPointAddress);
        }
        this.engine = new Engine(getStringId(), owner.getContainer(), owner.getExecutor());
        this.endpointReference = epr;
        wsdlProperties = (wsdlPort == null) ? new WSDLDirectProperties(owner.getServiceName(), portname) : new WSDLPortProperties(wsdlPort);

        this.cleanRequestContext = this.requestContext.copy();

        // ManagedObjectManager MUST be created before the pipeline
        // is constructed.

        managedObjectManager = new MonitorRootClient(this).createManagedObjectManager(this);

        if (master != null) {
            this.tubes = new TubePool(master);
        } else {
            this.tubes = new TubePool(createPipeline(portInfo, binding));
        }

        addrVersion = binding.getAddressingVersion();

        // This needs to happen after createPipeline.
        // TBD: Check if it needs to happen outside the Stub constructor.
        managedObjectManager.resumeJMXRegistration();
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 17
Source File: WSServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 * @param wsepr EndpointReference from which portName will be extracted.
 *      If EndpointName ( port name) is null in EPR, then it will try to get if from WSDLModel using portType QName
 * @param portTypeName
 *          should be null in dispatch case
 *          should be non null in SEI case
 * @return
 *      port name from EPR after validating various metadat elements.
 *      Also if service instance does n't have wsdl,
 *      then it gets the WSDL metadata from EPR and builds wsdl model.
 */
private QName getPortNameFromEPR(@NotNull WSEndpointReference wsepr, @Nullable QName portTypeName) {
    QName portName;
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    QName eprServiceName = metadata.getServiceName();
    QName eprPortName = metadata.getPortName();
    if ((eprServiceName != null ) && !eprServiceName.equals(serviceName)) {
        throw new WebServiceException("EndpointReference WSDL ServiceName differs from Service Instance WSDL Service QName.\n"
                + " The two Service QNames must match");
    }
    if (wsdlService == null) {
        Source eprWsdlSource = metadata.getWsdlSource();
        if (eprWsdlSource == null) {
            throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
        }
        try {
            WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
            wsdlService = eprWsdlMdl.getService(serviceName);
            if (wsdlService == null)
                throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
                        buildNameList(eprWsdlMdl.getServices().keySet())));
        } catch (MalformedURLException e) {
            throw new WebServiceException(ClientMessages.INVALID_ADDRESS(wsepr.getAddress()));
        }
    }
    portName = eprPortName;

    if (portName == null && portTypeName != null) {
        //get the first port corresponding to the SEI
        WSDLPort port = wsdlService.getMatchingPort(portTypeName);
        if (port == null)
            throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
        portName = port.getName();
    }
    if (portName == null)
        throw new WebServiceException(ProviderApiMessages.NULL_PORTNAME());
    if (wsdlService.get(portName) == null)
        throw new WebServiceException(ClientMessages.INVALID_EPR_PORT_NAME(portName, buildWsdlPortNames()));

    return portName;

}
 
Example 18
Source File: Stub.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private Stub(WSServiceDelegate owner, @Nullable Tube master, @Nullable WSPortInfo portInfo, QName portname, BindingImpl binding, @Nullable WSDLPort wsdlPort, EndpointAddress defaultEndPointAddress, @Nullable WSEndpointReference epr) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        this.owner = owner;
        this.portInfo = portInfo;
        this.wsdlPort = wsdlPort != null ? wsdlPort : (portInfo != null ? portInfo.getPort() : null);
        this.portname = portname;
        if (portname == null) {
            if (portInfo != null) {
                this.portname = portInfo.getPortName();
            } else if (wsdlPort != null) {
                this.portname = wsdlPort.getName();
            }
        }
        this.binding = binding;

        ComponentFeature cf = binding.getFeature(ComponentFeature.class);
        if (cf != null && Target.STUB.equals(cf.getTarget())) {
            components.add(cf.getComponent());
        }
        ComponentsFeature csf = binding.getFeature(ComponentsFeature.class);
        if (csf != null) {
            for (ComponentFeature cfi : csf.getComponentFeatures()) {
                if (Target.STUB.equals(cfi.getTarget()))
                    components.add(cfi.getComponent());
            }
        }

        // if there is an EPR, EPR's address should be used for invocation instead of default address
        if (epr != null) {
            this.requestContext.setEndPointAddressString(epr.getAddress());
        } else {
            this.requestContext.setEndpointAddress(defaultEndPointAddress);
        }
        this.engine = new Engine(getStringId(), owner.getContainer(), owner.getExecutor());
        this.endpointReference = epr;
        wsdlProperties = (wsdlPort == null) ? new WSDLDirectProperties(owner.getServiceName(), portname) : new WSDLPortProperties(wsdlPort);

        this.cleanRequestContext = this.requestContext.copy();

        // ManagedObjectManager MUST be created before the pipeline
        // is constructed.

        managedObjectManager = new MonitorRootClient(this).createManagedObjectManager(this);

        if (master != null) {
            this.tubes = new TubePool(master);
        } else {
            this.tubes = new TubePool(createPipeline(portInfo, binding));
        }

        addrVersion = binding.getAddressingVersion();

        // This needs to happen after createPipeline.
        // TBD: Check if it needs to happen outside the Stub constructor.
        managedObjectManager.resumeJMXRegistration();
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
 
Example 19
Source File: WSServiceDelegate.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 * @param wsepr EndpointReference from which portName will be extracted.
 *      If EndpointName ( port name) is null in EPR, then it will try to get if from WSDLModel using portType QName
 * @param portTypeName
 *          should be null in dispatch case
 *          should be non null in SEI case
 * @return
 *      port name from EPR after validating various metadat elements.
 *      Also if service instance does n't have wsdl,
 *      then it gets the WSDL metadata from EPR and builds wsdl model.
 */
private QName getPortNameFromEPR(@NotNull WSEndpointReference wsepr, @Nullable QName portTypeName) {
    QName portName;
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    QName eprServiceName = metadata.getServiceName();
    QName eprPortName = metadata.getPortName();
    if ((eprServiceName != null ) && !eprServiceName.equals(serviceName)) {
        throw new WebServiceException("EndpointReference WSDL ServiceName differs from Service Instance WSDL Service QName.\n"
                + " The two Service QNames must match");
    }
    if (wsdlService == null) {
        Source eprWsdlSource = metadata.getWsdlSource();
        if (eprWsdlSource == null) {
            throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
        }
        try {
            WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
            wsdlService = eprWsdlMdl.getService(serviceName);
            if (wsdlService == null)
                throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
                        buildNameList(eprWsdlMdl.getServices().keySet())));
        } catch (MalformedURLException e) {
            throw new WebServiceException(ClientMessages.INVALID_ADDRESS(wsepr.getAddress()));
        }
    }
    portName = eprPortName;

    if (portName == null && portTypeName != null) {
        //get the first port corresponding to the SEI
        WSDLPort port = wsdlService.getMatchingPort(portTypeName);
        if (port == null)
            throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
        portName = port.getName();
    }
    if (portName == null)
        throw new WebServiceException(ProviderApiMessages.NULL_PORTNAME());
    if (wsdlService.get(portName) == null)
        throw new WebServiceException(ClientMessages.INVALID_EPR_PORT_NAME(portName, buildWsdlPortNames()));

    return portName;

}
 
Example 20
Source File: WSServiceDelegate.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 *
 * @param wsepr EndpointReference from which portName will be extracted.
 *      If EndpointName ( port name) is null in EPR, then it will try to get if from WSDLModel using portType QName
 * @param portTypeName
 *          should be null in dispatch case
 *          should be non null in SEI case
 * @return
 *      port name from EPR after validating various metadat elements.
 *      Also if service instance does n't have wsdl,
 *      then it gets the WSDL metadata from EPR and builds wsdl model.
 */
private QName getPortNameFromEPR(@NotNull WSEndpointReference wsepr, @Nullable QName portTypeName) {
    QName portName;
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    QName eprServiceName = metadata.getServiceName();
    QName eprPortName = metadata.getPortName();
    if ((eprServiceName != null ) && !eprServiceName.equals(serviceName)) {
        throw new WebServiceException("EndpointReference WSDL ServiceName differs from Service Instance WSDL Service QName.\n"
                + " The two Service QNames must match");
    }
    if (wsdlService == null) {
        Source eprWsdlSource = metadata.getWsdlSource();
        if (eprWsdlSource == null) {
            throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
        }
        try {
            WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
            wsdlService = eprWsdlMdl.getService(serviceName);
            if (wsdlService == null)
                throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
                        buildNameList(eprWsdlMdl.getServices().keySet())));
        } catch (MalformedURLException e) {
            throw new WebServiceException(ClientMessages.INVALID_ADDRESS(wsepr.getAddress()));
        }
    }
    portName = eprPortName;

    if (portName == null && portTypeName != null) {
        //get the first port corresponding to the SEI
        WSDLPort port = wsdlService.getMatchingPort(portTypeName);
        if (port == null)
            throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
        portName = port.getName();
    }
    if (portName == null)
        throw new WebServiceException(ProviderApiMessages.NULL_PORTNAME());
    if (wsdlService.get(portName) == null)
        throw new WebServiceException(ClientMessages.INVALID_EPR_PORT_NAME(portName, buildWsdlPortNames()));

    return portName;

}