1 /* 2 * Copyright (c) 1997, 2010, 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 */ 25 26 package com.sun.xml.internal.ws.addressing; 27 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.Packet; 31 import com.sun.xml.internal.ws.api.pipe.Tube; 32 import com.sun.xml.internal.ws.api.pipe.TubeCloner; 33 import com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException; 34 35 /** 36 * @author Rama Pulavarthi 37 */ 38 public class W3CWsaClientTube extends WsaClientTube { 39 public W3CWsaClientTube(WSDLPort wsdlPort, WSBinding binding, Tube next) { 40 super(wsdlPort, binding, next); 41 } 42 43 public W3CWsaClientTube(WsaClientTube that, TubeCloner cloner) { 44 super(that, cloner); 45 } 46 47 @Override 48 public W3CWsaClientTube copy(TubeCloner cloner) { 49 return new W3CWsaClientTube(this, cloner); 50 } 51 52 @Override 53 protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo, 54 boolean foundFaultTo, boolean foundMessageID, boolean foundRelatesTo) { 55 super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo, foundFaultTo, foundMessageID, foundRelatesTo); 56 57 // if it is not one-way, response must contain wsa:RelatesTo 58 // RelatesTo required as per 59 // Table 5-3 of http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#wsdl11requestresponse 60 if (expectReply && (packet.getMessage() != null) && !foundRelatesTo) { 61 String action = packet.getMessage().getHeaders().getAction(addressingVersion, soapVersion); 62 // Don't check for AddressingFaults as 63 // Faults for requests with duplicate MessageId will have no wsa:RelatesTo 64 if (!packet.getMessage().isFault() || !action.equals(addressingVersion.getDefaultFaultAction())) { 65 throw new MissingAddressingHeaderException(addressingVersion.relatesToTag,packet); 66 } 67 } 68 69 } 70 } | 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 */ 25 26 package com.sun.xml.internal.ws.addressing; 27 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; 35 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 } 43 44 public W3CWsaClientTube(WsaClientTube that, TubeCloner cloner) { 45 super(that, cloner); 46 } 47 48 @Override 49 public W3CWsaClientTube copy(TubeCloner cloner) { 50 return new W3CWsaClientTube(this, cloner); 51 } 52 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); 57 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 } 69 70 } 71 } |