[ 
https://issues.apache.org/jira/browse/MUSE-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464858
 ] 

Oliver Waeldrich commented on MUSE-180:
---------------------------------------

I looked up the specs for WSRF-Basefaults and WSA and found that found that the 
specs might 
not really overlap. Following your advise I subclassed SimpleResourceRouter and 
made the following 
changes in order to use the WSRF base faults:

            String message = "DestinationUnreachable";
            String reason  = "No route can be determined to reach 
[destination]";
            ResourceUnknownFault fault = new ResourceUnknownFault("");
            fault.setReason(reason);
            fault.setSubCode(new QName(WsaConstants.NAMESPACE_URI,
                                       "DestinationUnreachable",
                                       "wsa"));
            
            Document owner   = fault.getDetail().getOwnerDocument();
            Node importedEPR = owner.importNode(epr.toXML(),true);
            
            Element timestamp   = 
owner.createElementNS(WsrfConstants.NAMESPACE_URI, "Timestamp");
            Element description = 
owner.createElementNS(WsrfConstants.NAMESPACE_URI, "Description");
            
            timestamp.appendChild(XmlUtils.convertToNode(owner, 
fault.getTimestamp()));
            description.appendChild(XmlUtils.convertToNode(owner, "Resource 
unknown"));
            
            fault.getDetail().appendChild(importedEPR);
            fault.getDetail().appendChild(timestamp);
            fault.getDetail().appendChild(description);
            
            throw fault;

This code produces the following XML:

<soap:Fault
        xmlns:tns="http://axis2.platform.core.muse.apache.org";
        xmlns:soap="http://www.w3.org/2003/05/soap-envelope";>
        <soap:Code>
                <soap:Value>soap:Receiver</soap:Value>
                <soap:Subcode>
                        <soap:Value>wsa:DestinationUnreachable</soap:Value>
                </soap:Subcode>
        </soap:Code>
        <soap:Reason>
                <soap:Text>
                        No route can be determined to reach [destination]
                </soap:Text>
        </soap:Reason>
        <soap:Detail>
                <wsrf-rw:ResourceUnknownFault
                        xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2";>
                        <wsa:EndpointReference>
                                <wsa:Address>
                                        http://myHost:8090/myApp/Service
                                </wsa:Address>
                        </wsa:EndpointReference>
                        <Timestamp
                                xmlns="http://docs.oasis-open.org/wsrf/r-2";>
                                2007-01-15T17:50:53+01:00
                        </Timestamp>
                        <Description
                                xmlns="http://docs.oasis-open.org/wsrf/r-2";>
                                Resource unknown
                        </Description>
                </wsrf-rw:ResourceUnknownFault>
        </soap:Detail>
</soap:Fault>


I think that is what I would expect from WSA and WSRF-BaseFaults point of view. 
However, I think parts of this code should be moved to BaseFault and some parts 
belong to the concrete exceptions.

> 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]

Reply via email to