[
https://issues.apache.org/jira/browse/MUSE-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465103
]
Oliver Waeldrich commented on MUSE-180:
---------------------------------------
O.k., I have checked the current implementation. The code and subcode fields
look fine. However, I still think it would be good to have the appropriate WSRF
exception in the detail field, because this field then could be evaluated on
the client site. Therefore I would suggest the following:
1. fix the BaseFault class to include at least timestamp an description:
protected void createDetail()
{
Element baseFault = XmlUtils.createElement(getName());
Element timestamp = XmlUtils.createElement(
new QName(WsrfConstants.NAMESPACE_URI,
"Timestamp",
WsrfConstants.PREFIX),
XsdUtils.getLocalTimeString(getTimestamp())
);
Element description = XmlUtils.createElement(
new QName(WsrfConstants.NAMESPACE_URI,
"Description",
WsrfConstants.PREFIX),
getMessage()
);
baseFault.appendChild(timestamp);
baseFault.appendChild(description);
setDetail(baseFault);
}
2. set code and subcode in the appropriate Exception class (e.g. in the
ResourceUnknownFault constructor)
3. simply throw the appropriate Fault
4. for tracing/debuging you can include the available EPRs in the following way:
// SimpleResourceRouter.getTargetResource()
String museNS = "http://ws.apache.org/muse";
Element noEPR = XmlUtils.createElement(new QName(museNS,
"EndpointNotFound"));
Element reqEPR = XmlUtils.createElement(new QName(museNS,
"RequestedEndpoint"));
Element avEPR = XmlUtils.createElement(new QName(museNS,
"AvailableEndpoints"));
noEPR.appendChild(reqEPR);
noEPR.appendChild(avEPR);
reqEPR.appendChild(epr.toXML(reqEPR.getOwnerDocument()));
Iterator i = manager.getResourceEPRs();
while (i.hasNext())
{
EndpointReference currentEPR = (EndpointReference) i.next();
avEPR.appendChild(currentEPR.toXML(avEPR.getOwnerDocument()));
}
ResourceUnknownFault fault = new ResourceUnknownFault("No route can
be determined to reach [destination]");
Document owner = fault.getDetail().getOwnerDocument();
fault.getDetail().appendChild(owner.importNode(noEPR, true));
throw fault;
This looks quite clean to me and would allow you to be compatible with WSA and
WSRF.
Regards,
Oliver
> SimpleResourceRouter should throw a ResourceUnknownException when a unknown
> resource is requested
> -------------------------------------------------------------------------------------------------
>
> Key: MUSE-180
> URL: https://issues.apache.org/jira/browse/MUSE-180
> Project: Muse
> Issue Type: Bug
> Components: Core Engine - Routing and Serialization
> Affects Versions: 2.0.0 M1, 2.0.0 M2, 2.0.0, 2.1.0, 2.2.0
> Reporter: Oliver Waeldrich
> Assigned To: Dan Jemiolo
> Fix For: 2.2.0
>
>
> The SimpleResourceRouter implementation should throw a
> ResourceUnknownException when a unknown resource is requested. This is stated
> in the WS resource spec:
> wsrf-rw:ResourceUnknownFault
> The resource identified in the message is not known to the Web service. The
> fault may contain additional resource- or application-specific information in
> it.
> Currently in the method SimpleResourceRouter.getTargetResource() only a
> SoapFault is thrown. This makes it difficult for applications to properly
> handle BaseFaults. A patch would simply be:
> SimpleResourceRouter.getTargetResource()
> ...
> throw new
> ResourceUnknownFault(_MESSAGES.get("DestinationUnreachable", filler));
> //throw new SoapFault(_MESSAGES.get("DestinationUnreachable",
> filler));
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]