1 /*
2 * Copyright (c) 1997, 2014, 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
140 */
141 public static SOAPMessage read(SOAPVersion soapVersion, Message message) throws SOAPException {
142 for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) {
143 SOAPMessage msg = s.readAsSOAPMessage(soapVersion, message);
144 if (msg != null)
145 return msg;
146 }
147
148 return instance.readAsSOAPMessage(soapVersion, message);
149 }
150
151 /**
152 * Reads Message as SOAPMessage. After this call message is consumed.
153 * @param soapVersion SOAP version
154 * @param message Message
155 * @param packet The packet that owns the Message
156 * @return Created SOAPMessage
157 * @throws SOAPException if SAAJ processing fails
158 */
159 public static SOAPMessage read(SOAPVersion soapVersion, Message message, Packet packet) throws SOAPException {
160 for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) {
161 SOAPMessage msg = s.readAsSOAPMessage(soapVersion, message, packet);
162 if (msg != null)
163 return msg;
164 }
165
166 return instance.readAsSOAPMessage(soapVersion, message, packet);
167 }
168
169 /**
170 * Reads the message within the Packet to a SAAJMessage. After this call message is consumed.
171 * @param packet Packet
172 * @return Created SAAJPMessage
173 * @throws SOAPException if SAAJ processing fails
174 */
175 public static SAAJMessage read(Packet packet) throws SOAPException {
176 // Use the Component from the Packet if it exists. Note the logic
177 // in the ServiceFinder is such that find(Class) is not equivalent
178 // to find (Class, null), so the ternary operator is needed.
179 ServiceFinder<SAAJFactory> factories = (packet.component != null ?
180 ServiceFinder.find(SAAJFactory.class, packet.component) :
181 ServiceFinder.find(SAAJFactory.class));
182 for (SAAJFactory s : factories) {
183 SAAJMessage msg = s.readAsSAAJ(packet);
184 if (msg != null) return msg;
185 }
186 return instance.readAsSAAJ(packet);
187 }
188
189 /**
190 * Reads the message within the Packet to a SAAJMessage. After this call message is consumed.
191 * @param packet Packet
192 * @return Created SAAJPMessage
193 * @throws SOAPException if SAAJ processing fails
194 */
195 public SAAJMessage readAsSAAJ(Packet packet) throws SOAPException {
|
1 /*
2 * Copyright (c) 1997, 2015, 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
140 */
141 public static SOAPMessage read(SOAPVersion soapVersion, Message message) throws SOAPException {
142 for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) {
143 SOAPMessage msg = s.readAsSOAPMessage(soapVersion, message);
144 if (msg != null)
145 return msg;
146 }
147
148 return instance.readAsSOAPMessage(soapVersion, message);
149 }
150
151 /**
152 * Reads Message as SOAPMessage. After this call message is consumed.
153 * @param soapVersion SOAP version
154 * @param message Message
155 * @param packet The packet that owns the Message
156 * @return Created SOAPMessage
157 * @throws SOAPException if SAAJ processing fails
158 */
159 public static SOAPMessage read(SOAPVersion soapVersion, Message message, Packet packet) throws SOAPException {
160 SAAJFactory saajfac = packet.getSAAJFactory();
161 if (saajfac != null) {
162 SOAPMessage msg = saajfac.readAsSOAPMessage(soapVersion, message, packet);
163 if (msg != null) return msg;
164 }
165 for (SAAJFactory s : ServiceFinder.find(SAAJFactory.class)) {
166 SOAPMessage msg = s.readAsSOAPMessage(soapVersion, message, packet);
167 if (msg != null)
168 return msg;
169 }
170
171 return instance.readAsSOAPMessage(soapVersion, message, packet);
172 }
173
174 /**
175 * Reads the message within the Packet to a SAAJMessage. After this call message is consumed.
176 * @param packet Packet
177 * @return Created SAAJPMessage
178 * @throws SOAPException if SAAJ processing fails
179 */
180 public static SAAJMessage read(Packet packet) throws SOAPException {
181 SAAJFactory saajfac = packet.getSAAJFactory();
182 if (saajfac != null) {
183 SAAJMessage msg = saajfac.readAsSAAJ(packet);
184 if (msg != null) return msg;
185 }
186 // Use the Component from the Packet if it exists. Note the logic
187 // in the ServiceFinder is such that find(Class) is not equivalent
188 // to find (Class, null), so the ternary operator is needed.
189 ServiceFinder<SAAJFactory> factories = (packet.component != null ?
190 ServiceFinder.find(SAAJFactory.class, packet.component) :
191 ServiceFinder.find(SAAJFactory.class));
192 for (SAAJFactory s : factories) {
193 SAAJMessage msg = s.readAsSAAJ(packet);
194 if (msg != null) return msg;
195 }
196 return instance.readAsSAAJ(packet);
197 }
198
199 /**
200 * Reads the message within the Packet to a SAAJMessage. After this call message is consumed.
201 * @param packet Packet
202 * @return Created SAAJPMessage
203 * @throws SOAPException if SAAJ processing fails
204 */
205 public SAAJMessage readAsSAAJ(Packet packet) throws SOAPException {
|