src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 408
b0610cd08440
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -29,11 +29,13 @@
    1.11  import com.sun.istack.internal.Nullable;
    1.12  import com.sun.xml.internal.ws.api.WSBinding;
    1.13  import com.sun.xml.internal.ws.api.model.SEIModel;
    1.14 +import com.sun.xml.internal.ws.api.model.WSDLOperationMapping;
    1.15  import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
    1.16  import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
    1.17  import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
    1.18 -import com.sun.xml.internal.ws.api.message.HeaderList;
    1.19 +import com.sun.xml.internal.ws.api.message.AddressingUtils;
    1.20  import com.sun.xml.internal.ws.api.message.Message;
    1.21 +import com.sun.xml.internal.ws.api.message.MessageHeaders;
    1.22  import com.sun.xml.internal.ws.api.message.Messages;
    1.23  import com.sun.xml.internal.ws.api.message.Packet;
    1.24  import com.sun.xml.internal.ws.model.AbstractSEIModelImpl;
    1.25 @@ -61,8 +63,8 @@
    1.26  final class ActionBasedOperationFinder extends WSDLOperationFinder {
    1.27  
    1.28      private static final Logger LOGGER = Logger.getLogger(ActionBasedOperationFinder.class.getName());
    1.29 -    private final Map<ActionBasedOperationSignature, QName> uniqueOpSignatureMap;
    1.30 -    private final Map<String, QName> actionMap;
    1.31 +    private final Map<ActionBasedOperationSignature, WSDLOperationMapping> uniqueOpSignatureMap;
    1.32 +    private final Map<String, WSDLOperationMapping> actionMap;
    1.33  
    1.34      private final @NotNull AddressingVersion av;
    1.35  
    1.36 @@ -71,8 +73,8 @@
    1.37  
    1.38          assert binding.getAddressingVersion() != null;    // this dispatcher can be only used when addressing is on.
    1.39          av = binding.getAddressingVersion();
    1.40 -        uniqueOpSignatureMap = new HashMap<ActionBasedOperationSignature, QName>();
    1.41 -        actionMap = new HashMap<String,QName>();
    1.42 +        uniqueOpSignatureMap = new HashMap<ActionBasedOperationSignature, WSDLOperationMapping>();
    1.43 +        actionMap = new HashMap<String,WSDLOperationMapping>();
    1.44  
    1.45          if (seiModel != null) {
    1.46              for (JavaMethodImpl m : ((AbstractSEIModelImpl) seiModel).getJavaMethods()) {
    1.47 @@ -94,8 +96,8 @@
    1.48                          LOGGER.warning(AddressingMessages.NON_UNIQUE_OPERATION_SIGNATURE(
    1.49                                  uniqueOpSignatureMap.get(opSignature),m.getOperationQName(),action,payloadName));
    1.50                      }
    1.51 -                    uniqueOpSignatureMap.put(opSignature, m.getOperationQName());
    1.52 -                    actionMap.put(action,m.getOperationQName());
    1.53 +                    uniqueOpSignatureMap.put(opSignature, wsdlOperationMapping(m));
    1.54 +                    actionMap.put(action,wsdlOperationMapping(m));
    1.55                  }
    1.56              }
    1.57          } else {
    1.58 @@ -111,24 +113,28 @@
    1.59                                      uniqueOpSignatureMap.get(opSignature),wsdlOp.getName(),action,payloadName));
    1.60  
    1.61                  }
    1.62 -                uniqueOpSignatureMap.put(opSignature, wsdlOp.getName());
    1.63 -                actionMap.put(action,wsdlOp.getName());
    1.64 +                uniqueOpSignatureMap.put(opSignature, wsdlOperationMapping(wsdlOp));
    1.65 +                actionMap.put(action,wsdlOperationMapping(wsdlOp));
    1.66              }
    1.67          }
    1.68      }
    1.69  
    1.70 -    /**
    1.71 -     *
    1.72 -     * @param request  Request Packet that is used to find the associated WSDLOperation
    1.73 -     * @return WSDL operation Qname.
    1.74 -     *         return null if WS-Addressing is not engaged.
    1.75 -     * @throws DispatchException with WSA defined fault message when it cannot find an associated WSDL operation.
    1.76 -     *
    1.77 -     */
    1.78 -    @Override
    1.79 -    public QName getWSDLOperationQName(Packet request) throws DispatchException {
    1.80 -        HeaderList hl = request.getMessage().getHeaders();
    1.81 -        String action = hl.getAction(av, binding.getSOAPVersion());
    1.82 +//    /**
    1.83 +//     *
    1.84 +//     * @param request  Request Packet that is used to find the associated WSDLOperation
    1.85 +//     * @return WSDL operation Qname.
    1.86 +//     *         return null if WS-Addressing is not engaged.
    1.87 +//     * @throws DispatchException with WSA defined fault message when it cannot find an associated WSDL operation.
    1.88 +//     *
    1.89 +//     */
    1.90 +//    @Override
    1.91 +//    public QName getWSDLOperationQName(Packet request) throws DispatchException {
    1.92 +//        return getWSDLOperationMapping(request).getWSDLBoundOperation().getName();
    1.93 +//    }
    1.94 +
    1.95 +    public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
    1.96 +        MessageHeaders hl = request.getMessage().getHeaders();
    1.97 +        String action = AddressingUtils.getAction(hl, av, binding.getSOAPVersion());
    1.98  
    1.99          if (action == null)
   1.100              // Addressing is not enagaged, return null to use other ways to dispatch.
   1.101 @@ -146,16 +152,16 @@
   1.102              payloadName = new QName(nsUri, localPart);
   1.103          }
   1.104  
   1.105 -        QName opName = uniqueOpSignatureMap.get(new ActionBasedOperationSignature(action, payloadName));
   1.106 -        if (opName != null)
   1.107 -            return opName;
   1.108 +        WSDLOperationMapping opMapping = uniqueOpSignatureMap.get(new ActionBasedOperationSignature(action, payloadName));
   1.109 +        if (opMapping != null)
   1.110 +            return opMapping;
   1.111  
   1.112          //Seems like in Wstrust STS wsdls, the payload does not match what is specified in the wsdl leading to incorrect
   1.113          //  wsdl operation resolution. Use just wsa:Action to dispatch as a last resort.
   1.114          //try just with wsa:Action
   1.115 -        opName = actionMap.get(action);
   1.116 -        if (opName != null)
   1.117 -            return opName;
   1.118 +        opMapping = actionMap.get(action);
   1.119 +        if (opMapping != null)
   1.120 +            return opMapping;
   1.121  
   1.122          // invalid action header
   1.123          Message result = Messages.create(action, av, binding.getSOAPVersion());
   1.124 @@ -163,6 +169,4 @@
   1.125          throw new DispatchException(result);
   1.126  
   1.127      }
   1.128 -
   1.129 -
   1.130  }

mercurial