You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2006/10/31 06:35:01 UTC

svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Author: mmao
Date: Mon Oct 30 21:35:01 2006
New Revision: 469376

URL: http://svn.apache.org/viewvc?view=rev&rev=469376
Log:
URIMappingInterceptor unit test update

* Get the parameter class type through reflection instead of messagepartinfo due to the api changes.
* Enable the parameter checking in unit test.
* Added parameter checker and log if failed.

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorRPCTest.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?view=diff&rev=469376&r1=469375&r2=469376
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java Mon Oct 30 21:35:01 2006
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.interceptor;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedHashMap;
@@ -27,14 +29,16 @@
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
+import javax.jws.WebParam;
+
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.util.PrimitiveUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.MethodDispatcher;
 import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceModelUtil;
 
 public class URIMappingInterceptor extends AbstractInDatabindingInterceptor {
@@ -70,15 +74,55 @@
         message.setContent(List.class, getParameters(message, op));
     }
 
+    private Method getMethod(Message message, BindingOperationInfo operation) {
+        MethodDispatcher md = (MethodDispatcher) message.getExchange().
+            get(Service.class).get(MethodDispatcher.class.getName());
+        return md.getMethod(operation);
+    }
+    
+    private boolean isValidParameter(Annotation[][] parameterAnnotation, int index, String parameterName) {
+        if (parameterAnnotation == null || parameterAnnotation.length < index) {
+            return true;
+        }
+        Annotation[] annotations = parameterAnnotation[index];
+        if (annotations == null || annotations.length < 1) {
+            return true;
+        }
+        WebParam webParam = null;
+        for (Annotation annotation : annotations) {
+            if (annotation.annotationType() == WebParam.class) {
+                webParam = (WebParam) annotation;
+            }
+        }
+        if (webParam == null 
+            || StringUtils.isEmpty(webParam.name()) 
+            || webParam.name().equals(parameterName)) {
+            return true;
+        }
+        LOG.warning("The parameter name [" + parameterName 
+                    + "] is not match the one defined in the WebParam name [" + webParam.name() + "]");
+        return false;
+    }
+    
     protected List<Object> getParameters(Message message, BindingOperationInfo operation) {
         List<Object> parameters = new ArrayList<Object>();
-        MessageInfo msg = operation.getOperationInfo().getInput();
         int idx = parameters.size();
 
-        Map<String, String> queries = getQueries(message);
+        Map<String, String> queries = getQueries(message);        
+        
+        Method method = getMethod(message, operation);        
+        
+        Class[] types = method.getParameterTypes();
+        
+        Annotation[][] parameterAnnotation = method.getParameterAnnotations();
+        
         for (String key : queries.keySet()) {
-            MessagePartInfo p = msg.getMessageParts().get(idx);
-            if (p == null) {
+            Class<?> type = types[idx];
+            
+            // Do we need to fail the processing if the parameter not match the WebParam?
+            isValidParameter(parameterAnnotation, idx, key);
+            
+            if (type == null) {
                 LOG.warning("URIMappingInterceptor MessagePartInfo NULL ");
                 throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", BUNDLE, 
                                                                        "index: " + idx + " on key " + key));
@@ -86,8 +130,7 @@
 
             // TODO check the parameter name here
             Object param = null;
-            Class type = (Class)p.getProperty(Class.class.getName());
-            
+                        
             if (type != null && type.isPrimitive()) {
                 param = PrimitiveUtils.read(queries.get(key), type);
             } else {
@@ -96,15 +139,16 @@
             if (param != null) {
                 parameters.add(param);
             } else {
-                throw new RuntimeException(p.getName() + " can not be unmarshalled");
+                throw new RuntimeException(type.getName() + " can not be unmarshalled");
             }
-        }        
+            idx = parameters.size();
+        }
         return parameters;
     }
 
     protected Map<String, String> getQueries(Message message) {
         Map<String, String> queries = new LinkedHashMap<String, String>();
-        String query = (String)message.get(Message.QUERY_STRING);   
+        String query = (String)message.get(Message.QUERY_STRING);
         if (!StringUtils.isEmpty(query)) {
             List<String> parts = Arrays.asList(query.split("&"));
             for (String part : parts) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java?view=diff&rev=469376&r1=469375&r2=469376
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorDocLitTest.java Mon Oct 30 21:35:01 2006
@@ -74,7 +74,8 @@
         
         EndpointInfo endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, "CalculatorPort"));
         Endpoint endpoint = new EndpointImpl(getBus(), service, endpointInfo);
-        exchange.put(Endpoint.class, endpoint);
+        exchange.put(Service.class, service);
+        exchange.put(Endpoint.class, endpoint);        
     }
     
     public void testGetAddFromPath() throws Exception {
@@ -88,12 +89,12 @@
         Object parameters = message.getContent(List.class);
         assertNotNull(parameters);
         assertEquals(2, ((List)parameters).size());
-        // TODO: should return int, service factory is broken, check it later.
-        //        Integer value = (Integer) ((List)parameters).get(0);
-        //        assertEquals(1, value.intValue());
-        //        
-        //        value = (Integer) ((List)parameters).get(1);        
-        //        assertEquals(2, value.intValue());
+         
+        Integer value = (Integer) ((List)parameters).get(0);
+        assertEquals(1, value.intValue());
+        
+        value = (Integer) ((List)parameters).get(1);        
+        assertEquals(2, value.intValue());
         
         BindingOperationInfo boi = message.getExchange().get(BindingOperationInfo.class);
         assertNotNull(boi);
@@ -112,11 +113,10 @@
         Object parameters = message.getContent(List.class);
         assertNotNull(parameters);
         assertEquals(2, ((List)parameters).size());
-        
-        // TODO: should return int
-        //        Integer value = (Integer) ((List)parameters).get(0);       
-        //        assertEquals(1, value.intValue());
-        //        value = (Integer) ((List)parameters).get(1);
-        //        assertEquals(2, value.intValue());
+                 
+        Integer value = (Integer) ((List)parameters).get(0);       
+        assertEquals(1, value.intValue());
+        value = (Integer) ((List)parameters).get(1);
+        assertEquals(2, value.intValue());
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorRPCTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorRPCTest.java?view=diff&rev=469376&r1=469375&r2=469376
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorRPCTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/URIMappingInterceptorRPCTest.java Mon Oct 30 21:35:01 2006
@@ -73,6 +73,7 @@
         
         EndpointInfo endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, "SoapPortRPCLit"));
         Endpoint endpoint = new EndpointImpl(getBus(), service, endpointInfo);
+        exchange.put(Service.class, service);
         exchange.put(Endpoint.class, endpoint);
     }
     



Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by James Mao <ja...@iona.com>.
Hi Dan,

Just check the code, the WebParam is not part of Jaxws it's part of JSR181.
As i said, i'll change that to 
messagePartInfo.getConcreteName().getLocalPart(), that's next story.

And also will add a code first test for this.

As i said in previous other email, this is just the first tryout, i will 
have two commits to solve the parameter order and encoding/decoding issues.

The HttpBinding will slow down the processing in case of GET, first it 
have to build the doc and then it will add the xmlmessageinterceptor in 
the middle, in will go through the xmlmessageininerceptor, and 
xmlmessageininterceptor will then go through the bare/wrapped 
interceptors, it'll do unmarshall work. it definitely slower than get 
the operation name and parameters directly.

Anyway, i think it's just different user scenarios. what the GET i just 
checked in will allow user to expose the service through HTTP GET, no 
matter which binding they are using (SOAP1.1 SOAP1.2  
and XMLbinding etc.) it's sort of RESTlike service, but 
it's different from the HTTP binding which in my opinion is a REST 
binding. So in case of GET in HTTP binding, it's fine.


Cheers,
James.

Dan Diephouse 写道:
> James Mao wrote:
>> Hi Dan,
>> Yes, i awared, that's why i just use it to log, i'm not failed the 
>> processing.
> From what I can tell you're using it to check that the parameter name 
> from the URI matches the parameter name. And the annotations don't 
> always have that name in code first scenarios. So that means that 
> processing will fail even when its not necessarily supposed to. So 
> this is important.
>> If i can not use jaxws stuff in that module , i guess we should 
>> remove the dependencies from the POM
> Yes, that would be good but I think the unit tests depend on it. This 
> is part of the reason we need to refactor the tools...
>> Yes, i will use the messagePartInfo.getConcreteName().getLocalPart(), 
>> that's next story.
>>
> Great. Also noticed you seem to be depending on the parameter order in 
> the URL. Why not just match up the keys to the message part local name?
>> It's not a part of HTTP binding, and i don't think in GET we need to 
>> convert to the document, it'll slow down the processing.
>>
> Well it is *a* binding to HTTP. I don't care that much, but it does 
> all the dirty work for you and I doubt it slows things down that much.
>> Cheers,
>> James.
>>
>> Dan Diephouse 写道:
>>> Hi James,
>>> Are you aware this information is in the service model? Are you also 
>>> aware that this information often times is NOT in the annotations - 
>>> for instance when someone does code first services? There should 
>>> hardly ever be any reason to use the jax-ws annotations outside the 
>>> JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
>>> key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see 
>>> if they match.
>>>
>>> Also you might want to look at using the utility code in the HTTP 
>>> binding to turn parameters and their values into a document which 
>>> conforms to the schema.
>>>
>>> - Dan
>>>
>>>
>>> mmao@apache.org wrote:
>>>> +    private boolean isValidParameter(Annotation[][] 
>>>> parameterAnnotation, int index, String parameterName) {
>>>> +        if (parameterAnnotation == null || 
>>>> parameterAnnotation.length < index) {
>>>> +            return true;
>>>> +        }
>>>> +        Annotation[] annotations = parameterAnnotation[index];
>>>> +        if (annotations == null || annotations.length < 1) {
>>>> +            return true;
>>>> +        }
>>>> +        WebParam webParam = null;
>>>> +        for (Annotation annotation : annotations) {
>>>> +            if (annotation.annotationType() == WebParam.class) {
>>>> +                webParam = (WebParam) annotation;
>>>> +            }
>>>> +        }
>>>> +        if (webParam == null +            || 
>>>> StringUtils.isEmpty(webParam.name()) +            || 
>>>> webParam.name().equals(parameterName)) {
>>>> +            return true;
>>>> +        }
>>>> +        LOG.warning("The parameter name [" + parameterName 
>>>> +                    + "] is not match the one defined in the 
>>>> WebParam name [" + webParam.name() + "]");
>>>> +        return false;
>>>> +    }
>>>>   
>>> Dan Diephouse
>>> Envoi Solutions
>>> http://envoisolutions.com
>>> http://netzooid.com/blog
>>>
>>>
>>
>
>


Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by James Mao <ja...@iona.com>.
Hi Dan,

Just check the code, the WebParam is not part of Jaxws it's part of JSR181.
As i said, i'll change that to 
messagePartInfo.getConcreteName().getLocalPart(), that's next story.

And also will add a code first test for this.

As i said in previous other email, this is just the first tryout, i will 
have two commits to solve the parameter order and encoding/decoding issues.

The HttpBinding will slow down the processing in case of GET, first it 
have to build the doc and then it will add the xmlmessageinterceptor in 
the middle, in will go through the xmlmessageininerceptor, and 
xmlmessageininterceptor will then go through the bare/wrapped 
interceptors, it'll do unmarshall work. it definitely slower than get 
the operation name and parameters directly.

Anyway, i think it's just different user scenarios. what the GET i just 
checked in will allow user to expose the service through HTTP GET, no 
matter which binding they are using (SOAP1.1 SOAP1.2  
and XMLbinding etc.) it's sort of RESTlike service, but 
it's different from the HTTP binding which in my opinion is a REST 
binding. So in case of GET in HTTP binding, it's fine.


Cheers,
James.

Dan Diephouse 写道:
> James Mao wrote:
>> Hi Dan,
>> Yes, i awared, that's why i just use it to log, i'm not failed the 
>> processing.
> From what I can tell you're using it to check that the parameter name 
> from the URI matches the parameter name. And the annotations don't 
> always have that name in code first scenarios. So that means that 
> processing will fail even when its not necessarily supposed to. So 
> this is important.
>> If i can not use jaxws stuff in that module , i guess we should 
>> remove the dependencies from the POM
> Yes, that would be good but I think the unit tests depend on it. This 
> is part of the reason we need to refactor the tools...
>> Yes, i will use the messagePartInfo.getConcreteName().getLocalPart(), 
>> that's next story.
>>
> Great. Also noticed you seem to be depending on the parameter order in 
> the URL. Why not just match up the keys to the message part local name?
>> It's not a part of HTTP binding, and i don't think in GET we need to 
>> convert to the document, it'll slow down the processing.
>>
> Well it is *a* binding to HTTP. I don't care that much, but it does 
> all the dirty work for you and I doubt it slows things down that much.
>> Cheers,
>> James.
>>
>> Dan Diephouse 写道:
>>> Hi James,
>>> Are you aware this information is in the service model? Are you also 
>>> aware that this information often times is NOT in the annotations - 
>>> for instance when someone does code first services? There should 
>>> hardly ever be any reason to use the jax-ws annotations outside the 
>>> JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
>>> key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see 
>>> if they match.
>>>
>>> Also you might want to look at using the utility code in the HTTP 
>>> binding to turn parameters and their values into a document which 
>>> conforms to the schema.
>>>
>>> - Dan
>>>
>>>
>>> mmao@apache.org wrote:
>>>> +    private boolean isValidParameter(Annotation[][] 
>>>> parameterAnnotation, int index, String parameterName) {
>>>> +        if (parameterAnnotation == null || 
>>>> parameterAnnotation.length < index) {
>>>> +            return true;
>>>> +        }
>>>> +        Annotation[] annotations = parameterAnnotation[index];
>>>> +        if (annotations == null || annotations.length < 1) {
>>>> +            return true;
>>>> +        }
>>>> +        WebParam webParam = null;
>>>> +        for (Annotation annotation : annotations) {
>>>> +            if (annotation.annotationType() == WebParam.class) {
>>>> +                webParam = (WebParam) annotation;
>>>> +            }
>>>> +        }
>>>> +        if (webParam == null +            || 
>>>> StringUtils.isEmpty(webParam.name()) +            || 
>>>> webParam.name().equals(parameterName)) {
>>>> +            return true;
>>>> +        }
>>>> +        LOG.warning("The parameter name [" + parameterName 
>>>> +                    + "] is not match the one defined in the 
>>>> WebParam name [" + webParam.name() + "]");
>>>> +        return false;
>>>> +    }
>>>>   
>>> Dan Diephouse
>>> Envoi Solutions
>>> http://envoisolutions.com
>>> http://netzooid.com/blog
>>>
>>>
>>
>
>


Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by Dan Diephouse <da...@envoisolutions.com>.
James Mao wrote:
> Hi Dan,
> Yes, i awared, that's why i just use it to log, i'm not failed the 
> processing.
 From what I can tell you're using it to check that the parameter name 
from the URI matches the parameter name. And the annotations don't 
always have that name in code first scenarios. So that means that 
processing will fail even when its not necessarily supposed to. So this 
is important.
> If i can not use jaxws stuff in that module , i guess we should remove 
> the dependencies from the POM
Yes, that would be good but I think the unit tests depend on it. This is 
part of the reason we need to refactor the tools...
> Yes, i will use the messagePartInfo.getConcreteName().getLocalPart(), 
> that's next story.
>
Great. Also noticed you seem to be depending on the parameter order in 
the URL. Why not just match up the keys to the message part local name?
> It's not a part of HTTP binding, and i don't think in GET we need to 
> convert to the document, it'll slow down the processing.
>
Well it is *a* binding to HTTP. I don't care that much, but it does all 
the dirty work for you and I doubt it slows things down that much.
> Cheers,
> James.
>
> Dan Diephouse 写道:
>> Hi James,
>> Are you aware this information is in the service model? Are you also 
>> aware that this information often times is NOT in the annotations - 
>> for instance when someone does code first services? There should 
>> hardly ever be any reason to use the jax-ws annotations outside the 
>> JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
>> key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see 
>> if they match.
>>
>> Also you might want to look at using the utility code in the HTTP 
>> binding to turn parameters and their values into a document which 
>> conforms to the schema.
>>
>> - Dan
>>
>>
>> mmao@apache.org wrote:
>>> +    private boolean isValidParameter(Annotation[][] 
>>> parameterAnnotation, int index, String parameterName) {
>>> +        if (parameterAnnotation == null || 
>>> parameterAnnotation.length < index) {
>>> +            return true;
>>> +        }
>>> +        Annotation[] annotations = parameterAnnotation[index];
>>> +        if (annotations == null || annotations.length < 1) {
>>> +            return true;
>>> +        }
>>> +        WebParam webParam = null;
>>> +        for (Annotation annotation : annotations) {
>>> +            if (annotation.annotationType() == WebParam.class) {
>>> +                webParam = (WebParam) annotation;
>>> +            }
>>> +        }
>>> +        if (webParam == null +            || 
>>> StringUtils.isEmpty(webParam.name()) +            || 
>>> webParam.name().equals(parameterName)) {
>>> +            return true;
>>> +        }
>>> +        LOG.warning("The parameter name [" + parameterName 
>>> +                    + "] is not match the one defined in the 
>>> WebParam name [" + webParam.name() + "]");
>>> +        return false;
>>> +    }
>>>   
>> Dan Diephouse
>> Envoi Solutions
>> http://envoisolutions.com
>> http://netzooid.com/blog
>>
>>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog


Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by James Mao <ja...@iona.com>.
Hi Dan,
Yes, i awared, that's why i just use it to log, i'm not failed the 
processing.
If i can not use jaxws stuff in that module , i guess we should remove 
the dependencies from the POM
Yes, i will use the messagePartInfo.getConcreteName().getLocalPart(), 
that's next story.

It's not a part of HTTP binding, and i don't think in GET we need to 
convert to the document, it'll slow down the processing.

Cheers,
James.

Dan Diephouse 写道:
> Hi James,
> Are you aware this information is in the service model? Are you also 
> aware that this information often times is NOT in the annotations - 
> for instance when someone does code first services? There should 
> hardly ever be any reason to use the jax-ws annotations outside the 
> JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
> key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see if 
> they match.
>
> Also you might want to look at using the utility code in the HTTP 
> binding to turn parameters and their values into a document which 
> conforms to the schema.
>
> - Dan
>
>
> mmao@apache.org wrote:
>> +    private boolean isValidParameter(Annotation[][] 
>> parameterAnnotation, int index, String parameterName) {
>> +        if (parameterAnnotation == null || 
>> parameterAnnotation.length < index) {
>> +            return true;
>> +        }
>> +        Annotation[] annotations = parameterAnnotation[index];
>> +        if (annotations == null || annotations.length < 1) {
>> +            return true;
>> +        }
>> +        WebParam webParam = null;
>> +        for (Annotation annotation : annotations) {
>> +            if (annotation.annotationType() == WebParam.class) {
>> +                webParam = (WebParam) annotation;
>> +            }
>> +        }
>> +        if (webParam == null +            || 
>> StringUtils.isEmpty(webParam.name()) +            || 
>> webParam.name().equals(parameterName)) {
>> +            return true;
>> +        }
>> +        LOG.warning("The parameter name [" + parameterName 
>> +                    + "] is not match the one defined in the 
>> WebParam name [" + webParam.name() + "]");
>> +        return false;
>> +    }
>>   
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com
> http://netzooid.com/blog
>
>


Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by James Mao <ja...@iona.com>.
Hi Dan,
Yes, i awared, that's why i just use it to log, i'm not failed the 
processing.
If i can not use jaxws stuff in that module , i guess we should remove 
the dependencies from the POM
Yes, i will use the messagePartInfo.getConcreteName().getLocalPart(), 
that's next story.

It's not a part of HTTP binding, and i don't think in GET we need to 
convert to the document, it'll slow down the processing.

Cheers,
James.

Dan Diephouse 写道:
> Hi James,
> Are you aware this information is in the service model? Are you also 
> aware that this information often times is NOT in the annotations - 
> for instance when someone does code first services? There should 
> hardly ever be any reason to use the jax-ws annotations outside the 
> JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
> key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see if 
> they match.
>
> Also you might want to look at using the utility code in the HTTP 
> binding to turn parameters and their values into a document which 
> conforms to the schema.
>
> - Dan
>
>
> mmao@apache.org wrote:
>> +    private boolean isValidParameter(Annotation[][] 
>> parameterAnnotation, int index, String parameterName) {
>> +        if (parameterAnnotation == null || 
>> parameterAnnotation.length < index) {
>> +            return true;
>> +        }
>> +        Annotation[] annotations = parameterAnnotation[index];
>> +        if (annotations == null || annotations.length < 1) {
>> +            return true;
>> +        }
>> +        WebParam webParam = null;
>> +        for (Annotation annotation : annotations) {
>> +            if (annotation.annotationType() == WebParam.class) {
>> +                webParam = (WebParam) annotation;
>> +            }
>> +        }
>> +        if (webParam == null +            || 
>> StringUtils.isEmpty(webParam.name()) +            || 
>> webParam.name().equals(parameterName)) {
>> +            return true;
>> +        }
>> +        LOG.warning("The parameter name [" + parameterName 
>> +                    + "] is not match the one defined in the 
>> WebParam name [" + webParam.name() + "]");
>> +        return false;
>> +    }
>>   
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com
> http://netzooid.com/blog
>
>


Re: svn commit: r469376 - in /incubator/cxf/trunk/rt: core/src/main/java/org/apache/cxf/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi James,
Are you aware this information is in the service model? Are you also 
aware that this information often times is NOT in the annotations - for 
instance when someone does code first services? There should hardly ever 
be any reason to use the jax-ws annotations outside the 
JaxWsServiceFactory/JaxWsServiceConfiguration classes. Just do 
key.equals(messagePartInfo.getConcreteName().getLocalPart()) to see if 
they match.

Also you might want to look at using the utility code in the HTTP 
binding to turn parameters and their values into a document which 
conforms to the schema.

- Dan


mmao@apache.org wrote:
> +    private boolean isValidParameter(Annotation[][] parameterAnnotation, int index, String parameterName) {
> +        if (parameterAnnotation == null || parameterAnnotation.length < index) {
> +            return true;
> +        }
> +        Annotation[] annotations = parameterAnnotation[index];
> +        if (annotations == null || annotations.length < 1) {
> +            return true;
> +        }
> +        WebParam webParam = null;
> +        for (Annotation annotation : annotations) {
> +            if (annotation.annotationType() == WebParam.class) {
> +                webParam = (WebParam) annotation;
> +            }
> +        }
> +        if (webParam == null 
> +            || StringUtils.isEmpty(webParam.name()) 
> +            || webParam.name().equals(parameterName)) {
> +            return true;
> +        }
> +        LOG.warning("The parameter name [" + parameterName 
> +                    + "] is not match the one defined in the WebParam name [" + webParam.name() + "]");
> +        return false;
> +    }
>   
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog