Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.ws.addressing;
28 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
29 import com.sun.xml.internal.ws.api.WSBinding;
30 import com.sun.xml.internal.ws.api.message.AddressingUtils;
31 import com.sun.xml.internal.ws.api.message.Packet;
32 import com.sun.xml.internal.ws.api.pipe.Tube;
33 import com.sun.xml.internal.ws.api.pipe.TubeCloner;
34 import com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException;
36 /**
37 * @author Rama Pulavarthi
38 */
39 public class W3CWsaClientTube extends WsaClientTube {
40 public W3CWsaClientTube(WSDLPort wsdlPort, WSBinding binding, Tube next) {
41 super(wsdlPort, binding, next);
42 }
44 public W3CWsaClientTube(WsaClientTube that, TubeCloner cloner) {
45 super(that, cloner);
46 }
48 @Override
49 public W3CWsaClientTube copy(TubeCloner cloner) {
50 return new W3CWsaClientTube(this, cloner);
51 }
53 @Override
54 protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo,
55 boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) {
56 super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo, foundFaultTo, foundMessageID, foundRelatesTo);
58 // if it is not one-way, response must contain wsa:RelatesTo
59 // RelatesTo required as per
60 // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse
61 if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) {
62 String action = AddressingUtils.getAction(packet.getMessage().getHeaders(), addressingVersion, soapVersion);
63 // Don't check for AddressingFaults as
64 // Faults for requests with duplicate MessageId will have no wsa:RelatesTo
65 if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) {
66 throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet);
67 }
68 }
70 }
71 }