[jboss-user] [JBossWS] - Re: Warning with ServiceObjectFactory with jbossws-native-2.
thomas.diesler@jboss.com
do-not-reply at jboss.com
Mon Nov 5 10:35:00 EST 2007
Service.getPort(SEI) must be able to retrieve a distinct port definition. Please show us your <service-ref> definitions
| /**
| * Narrow available endpoints by <port-component-ref> declarations.
| * Service.getPort(SEI) must be able to retrieve a distinct port definition.
| */
| protected void narrowPortSelection(UnifiedServiceRefMetaData serviceRef, ServiceMetaData serviceMetaData)
| {
| if (serviceMetaData.getEndpoints().size() > 1)
| {
| Map<String, UnifiedPortComponentRefMetaData> pcrefs = new HashMap<String, UnifiedPortComponentRefMetaData>();
| for (UnifiedPortComponentRefMetaData pcref : serviceRef.getPortComponentRefs())
| {
| String seiName = pcref.getServiceEndpointInterface();
|
| // Constraint#1: within a service-ref it's not allowed to use a SEI across different pcref's
| if (pcrefs.get(seiName) != null)
| throw new WSException("Within a <service-ref> it's not allowed to use a SEI across different <port-component-ref>'s: " + seiName);
|
| pcrefs.put(seiName, pcref);
| }
|
| // Constraint#2: A pcref may only match one EndpointMetaData
| for (String sei : pcrefs.keySet())
| {
| // Narrow available endpoints by port-component-ref declaration
| List<QName> narrowedEndpoints = new ArrayList<QName>();
|
| UnifiedPortComponentRefMetaData pcref = pcrefs.get(sei);
|
| // Constraint#3: Port selection only applies when both SEI and QName are given
| if (pcref.getServiceEndpointInterface() != null && pcref.getPortQName() != null)
| {
| List<QName> pcRef2EndpointMapping = new ArrayList<QName>();
| for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
| {
| if (pcref.getServiceEndpointInterface().equals(epMetaData.getServiceEndpointInterfaceName()))
| {
| pcRef2EndpointMapping.add(epMetaData.getPortName());
| }
| }
|
| for (QName q : pcRef2EndpointMapping)
| {
| EndpointMetaData mappedEndpoint = serviceMetaData.getEndpoint(q);
| if (!pcref.getPortQName().equals(mappedEndpoint.getPortName()))
| narrowedEndpoints.add(q);
| }
|
| // Constraint: Dont exclude all of them ;)
| if (pcRef2EndpointMapping.size() > 0 && (pcRef2EndpointMapping.size() == narrowedEndpoints.size()))
| throw new WSException("Failed to narrow available endpoints by <port-component-ref> declaration");
|
| for (QName q : narrowedEndpoints)
| {
| EndpointMetaData removed = serviceMetaData.removeEndpoint(q);
| log.debug("Narrowed endpoint " + q + "(" + removed + ")");
| }
| }
| else
| {
| // TODO: In case there is more then one EMPD this should cause an exception
| log.warn("Unable to narrow port selection for " + pcref);
| }
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101849#4101849
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101849
More information about the jboss-user
mailing list