Couple of things:

1) With this policy, BOTH of the the policies should be applied.   When on the 
input and the binding, they should be combined with an <wsp:all>.   

2) With a provider based service, per spec, we have to allow for any XML to 
come in, even stuff that doesn't match the wsdl document.   To handle this, we 
create the internal "invoke" BindingOperation which is what we map all the 
"unexpected" stuff to.   It sounds like the incoming body isn't matching the 
expectations of the invoke operation you have in the wsdl and thus the other 
synthetic invoke operation we create is being applied.     Check the body 
payloads between the two to see if something would be triggering that.


Dan



On Aug 28, 2013, at 4:31 AM, alex <[email protected]> wrote:

> Hi, 
> We are seeing some policy attachment issues when policies are attached to 
> both service and operation level. 
>  <wsdl:binding name="UrnMustUnderstandBinding2" type="tns:MustUnderstand">
>         <wsp:PolicyReference URI="#UserNameToken1" />
>         <soap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>         <wsdl:operation name="invoke">
>             <soap:operation soapAction="" style="document"/>
>             <wsdl:input name="getVerRequest">
>                 <soap:body use="literal"/>
>                  <wsp:PolicyReference URI="#UserNameToken2" />
>             </wsdl:input>    
>             <wsdl:output name="getVerResponse">
>                <soap:body use="literal"/>
>             </wsdl:output>
>         </wsdl:operation>        
>     </wsdl:binding>
> 
> While we expect operation level policy UserNameToken2  should be applied to 
> server inbound, we are surprised to find out this is not always the case. 
> When running the same test case again and again, we found  UserNameToken2 is 
> applied  in one run, and UserNameToken1 is applied in another run. Which 
> policy is applied is totally random.
> 
> Further debug, we found out that there are two BindingOperationInfo instances 
> in server inbound. 
> [8/27/13 12:43:37:629 CDT] 00000034 id= SystemOut O 
> PolicyInInterceptor():BindingOperationInfo:[BindingOperationInfo: 
> {http://mustunderstand.cxf.fats}invoke]:0 
> [8/27/13 12:43:37:629 CDT] 00000034 id= SystemOut O 
> PolicyInInterceptor():debugBoi:[BindingInfo 
> http://schemas.xmlsoap.org/wsdl/soap/]:OperationInfo:[OperationInfo: 
> {http://mustunderstand.cxf.fats}invoke]:input:org.apache.cxf.service.model.BindingMessageInfo@8c2760ba:outMessage:org.apache.cxf.service.model.BindingMessageInfo@33f92db2
>  
> 
> [8/27/13 12:43:37:630 CDT] 00000034 id= SystemOut O 
> PolicyInInterceptor():BindingOperationInfo:[BindingOperationInfo: 
> {http://cxf.apache.org/jaxws/provider}invoke]:1 
> [8/27/13 12:43:37:630 CDT] 00000034 id= SystemOut O 
> PolicyInInterceptor():debugBoi:[BindingInfo http://schem 
> as.xmlsoap.org/wsdl/soap/]:OperationInfo:[OperationInfo: 
> {http://cxf.apache.org/jaxws/provider}invoke]:input:org.apache.cxf.service.model.BindingMessageInfo@b72a33df:outMessage:org.apache.cxf.service.model.BindingMessageInfo@34105618
>  
> One instance is created from WSDL with namespace 
> {http://mustunderstand.cxf.fats}invoke], and another is hardcoded namespace 
> http://cxf.apache.org/jaxws/provider.
> Depending on the order of instances, if instance from WSDL is first, 
> operation policy is applied as expected. If instance with default JAXWS 
> namespace is first, operation policy is NOT applied.
> Looking at JaxWsServiceFactoryBean.java, line 355 to 385, I can see 
> BindingOperationInfo is always created with JAXWS namespace regardless WSDL.
> Could someone help to explain why we need two instances of 
> BindingOperationInfo? and why this impact policy attachment?
> 
> 

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to