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://schemas.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?