[ 
https://issues.apache.org/jira/browse/CXF-4115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13209447#comment-13209447
 ] 

Daniel Kulp commented on CXF-4115:
----------------------------------


Just played around with the JAX-WS RI with your sample to see what it does.

With JAX-WS RI 2.1.7 (and what's built into JDK 1.6), the provider ALWAYS gets 
null for the operation.  Looking into their code, they do not provide the wsdl 
operation name at all.  (it IS optional in the spec, see table 9.2 in the 
spec).    However, with 2.2.5 (version built into Java7), it provides null if 
the message doesn't match the wsdl and the proper qname if it does.   

Anyway, I do think we need to return null in the non-matching case.   I just 
wanted to point out that code that relies on it NOT being null isn't exactly 
portable as the operation name is optional in the spec.





                
> The operation property of the MessageContext may return wrong value if 
> erroneous request is sent
> ------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4115
>                 URL: https://issues.apache.org/jira/browse/CXF-4115
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.5.2
>            Reporter: Zsolt Beothy-Elo
>         Attachments: jaxws_dispatch_provider.zip, request.txt
>
>
> Send a random request to a Provider based service. Retrieving the operation 
> property from the MessageContext within the invoke method always returns an 
> operation defined in the attached wsdl even if the the rquest is completely 
> unrelated, e.g. unknown SOAPAction, payload not matching any schema in the 
> WSDL.
> Expected behavior is to get back some undefined value, e.g. null, to indicate 
> the requested operation could not be determined. 
> Attached is the slightly modified jaxws_dispatch_provider sample. The changes 
> were basically made in demo.hwDispatch.server.GreeterSoapMessageProvider:
> {code:title=GreeterSoapMessageProvider.java}
> @WebServiceProvider(portName = "SoapPort1", serviceName = "SOAPService1",
>                       targetNamespace = 
> "http://apache.org/hello_world_soap_http";,
>                       wsdlLocation = "wsdl/hello_world.wsdl")
> @ServiceMode(value = Service.Mode.MESSAGE)
> public class GreeterSoapMessageProvider implements Provider<SOAPMessage> {
>     @Resource
>     private WebServiceContext context;
>     public SOAPMessage invoke(SOAPMessage request) {
>           QName opName = (QName) 
> context.getMessageContext().get(MessageContext.WSDL_OPERATION);
>         System.out.println("Incoming Client Request as a SOAPMessage calling 
> operation " + opName);
> ...
> {code}
> If sending the request attached in the output of the console is:
> {{monospaced}}Incoming Client Request as a SOAPMessage calling operation 
> {http://apache.org/hello_world_soap_http}greetMe{{monospaced}}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to