/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Handles WS-Addressing for the server.
*
* @author Rama Pulavarthi
* @author Kohsuke Kawaguchi
* @author Arun Gupta
*/
// both will be set to non-null in processRequest
private boolean isAnonymousRequired = false;
/**
* WSDLBoundOperation calculated on the Request payload.
* Used for determining ReplyTo or Fault Action for non-anonymous responses *
*/
public WsaServerTube(WSEndpoint endpoint, @NotNull WSDLPort wsdlPort, WSBinding binding, Tube next) {
}
}
return new WsaServerTube(this, cloner);
}
// expose bunch of addressing related properties for advanced applications
// Store request ReplyTo and FaultTo in requestPacket.invocationProperties
// so that they can be used after responsePacket is received.
try {
} catch (InvalidAddressingHeaderException e) {
addressingVersion.getInvalidMapText()+", Problem header:" + e.getProblemHeader()+ ", Reason: "+ e.getSubsubcode(),e);
// WS-A fault processing for one-way methods
return doReturnWith(response);
}
FaultDetailHeader s11FaultDetailHeader = new FaultDetailHeader(addressingVersion, addressingVersion.problemHeaderQNameTag.getLocalPart(), e.getProblemHeader());
}
return doReturnWith(response);
}
// defaulting
// if one-way message and WS-A header processing fault has occurred,
// then do no further processing
if (p.getMessage() == null)
// request message is invalid, exception is logged by now and response is sent back with null message
return doReturnWith(p);
// if we find an error in addressing header, just turn around the direction here
if (p.getMessage().isFault()) {
// close the transportBackChannel if we know that
// we'll never use them
if (!(isAnonymousRequired) &&
return processResponse(p);
}
// close the transportBackChannel if we know that
// we'll never use them
if (!(isAnonymousRequired) &&
}
//this requirement can only be specified in W3C case, Override this in W3C case.
return false;
}
protected void checkAnonymousSemantics(WSDLBoundOperation wbo, WSEndpointReference replyTo, WSEndpointReference faultTo) {
//this requirement can only be specified in W3C case, Override this in W3C case.
}
// the response will go back the back channel. most common case
return doReturnWith(response);
// the caller doesn't want to hear about it, so proceed like one-way
return doReturnWith(response);
}
// send the response to this EPR.
// then we'll proceed the rest like one-way.
return doReturnWith(response);
}
/**
* Send a response to a non-anonymous address. Also closes the transport back channel
* of {@link Packet} if it's not closed already.
*
* <p>
* TODO: ideally we should be doing this by creating a new fiber.
*
* @param packet
* The response from our server, which will be delivered to the destination.
* @param target
* Where do we send the packet to?
*/
// at this point we know we won't be sending anything back through the back channel,
// so close it first to let the client go.
// one way message but with replyTo. I believe this is a hack for WS-TX - KK.
return;
}
try {
} catch (NullPointerException e) {
throw new WebServiceException(e);
} catch (IllegalArgumentException e) {
throw new WebServiceException(e);
}
// we need to assemble a pipeline to talk to this endpoint.
// TODO: what to pass as WSService?
new ClientTubeAssemblerContext(adrs, wsdlPort, (WSService) null, binding,endpoint.getContainer(),((BindingImpl)binding).createCodec(),null));
//set the SOAPAction, as its got to be same as wsa:Action
packet.expectReply = false;
}
//There may not be a WSDL operation. There may not even be a WSDL.
//For instance this may be a RM CreateSequence message.
if (wsdlBoundOperation == null)
return;
throw new ActionNotSupportedException(gotA);
}
}
// wsaw:Anonymous validation
// check if addresses are valid
}
if (!replyTo.isAnonymous()) {
try {
} catch (Exception e) {
throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
}
}
//for now only validate ReplyTo
/*
if (!faultTo.isAnonymous()) {
try {
new EndpointAddress(URI.create(faultTo.getAddress()));
} catch (IllegalArgumentException e) {
throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
}
}
*/
}
/**
* @deprecated
* Use {@link JAXWSProperties#ADDRESSING_MESSAGEID}.
*/
public static final String REQUEST_MESSAGE_ID = "com.sun.xml.internal.ws.addressing.request.messageID";
}