CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
if (null == addrProps)
{
throw new SOAPFaultException(
Constants.SOAP11_FAULT_CODE_CLIENT,
"The message is not valid and cannot be processed: " +
"Cannot obtain addressing properties.",
null, null
);
}
ReferenceParameters refParams = addrProps.getReferenceParameters();
if (refParams != null)
{
for (Object obj : refParams.getElements())
{
if (obj instanceof Element)
{
Element el = (Element)obj;
QName qname = DOMUtils.getElementQName(el);
if (qname.equals(IDQN))
{
try
{
subscriptionId = new URI(DOMUtils.getTextContent(el));
break;
}
catch (URISyntaxException e)
{
throw new SOAPFaultException(
Constants.SOAP11_FAULT_CODE_CLIENT,
"The message is not valid and cannot be processed: " +
"Invalid subscription id.",
null, null
);
}
}
}
}
}
if (null == subscriptionId)
{
throw new SOAPFaultException(
buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE),
"The message is not valid and cannot be processed: "
+ "Cannot obtain subscription id.",
null, null
);