You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Li, Tao (Tom)" <Ta...@iona.com> on 2006/12/05 06:57:24 UTC

Service Model problem with ws-policy

Hi Andrea,

Currently, if a wsdl file contains ws-policy assertions,
our cxf can't build service model correctly.

In WSDLServiceBuilder.buildBinding method, it assumed that
the first ext element is the one specify the protocol (such 
as soap), but if the wsdl has ws-policy assertion, the first
element of binding may be the wsp:PolicyReference.

our code:
String ns = ((ExtensibilityElement)binding.getExtensibilityElements()
       .get(0)).getElementType().getNamespaceURI();

wsdl sample:
    <wsdl:binding name="BasicHttpBinding_IMtomTest" type="i0:IMtomTest">
        <wsp:PolicyReference URI="#BasicHttpBinding_IMtomTest_policy" />
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
	...

But what make me confused is when I look up the wsdl spec
(http://www.w3.org/TR/wsdl), I found the binding chapter specify
the binding part should like below:

Digest from http://www.w3.org/TR/wsdl

The grammar for a binding is as follows:

<wsdl:definitions .... >
    <wsdl:binding name="nmtoken" type="qname"> *
        <-- extensibility element (1) --> *
        <wsdl:operation name="nmtoken"> *
           <-- extensibility element (2) --> *
           <wsdl:input name="nmtoken"? > ?
               <-- extensibility element (3) --> 
           </wsdl:input>
           <wsdl:output name="nmtoken"? > ?
               <-- extensibility element (4) --> *
           </wsdl:output>
           <wsdl:fault name="nmtoken"> *
               <-- extensibility element (5) --> *
           </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
</wsdl:definitions>


Could we add a filter out map in WSDLServiceBuilder to filter out any 
well-known elements namespace which may precedes the protocol element of 
the binding to solve this type problem.

Thanks.
Tom

Re: Service Model problem with ws-policy

Posted by Andrea Smyth <an...@iona.com>.
+1 for this approach.
We should also consider using a default (soap 1.1) if no binding factory 
is found this way, and apply the same approach to the transports 
(default to http).
It will obsolete the fields transportId and bindingId in 
EndpointInfo/BindingInfo.

Andrea.

Dan Diephouse wrote:

> Yeah, I brought this up once before but never did anything about it. 
> We need
> a much more robust way to select the appropriate namespace. One option 
> would
> be to just loop through the elements until we find a bindingfactory:
>
> BindingFactory bindingFactory = null;
> for (ExtensibilityElement e : extensibilityElements) {
>  bindingFactory = bindingFactoryManager.getBinding(e.getElementType
> ().getNamespaceURI());
>  if (bindingFactory != null) break;
> }
>
> Regards,
> - Dan
>
> On 12/5/06, Li, Tao (Tom) <Ta...@iona.com> wrote:
>
>>
>> Hi Andrea,
>>
>> Currently, if a wsdl file contains ws-policy assertions,
>> our cxf can't build service model correctly.
>>
>> In WSDLServiceBuilder.buildBinding method, it assumed that
>> the first ext element is the one specify the protocol (such
>> as soap), but if the wsdl has ws-policy assertion, the first
>> element of binding may be the wsp:PolicyReference.
>>
>> our code:
>> String ns = ((ExtensibilityElement)binding.getExtensibilityElements()
>>        .get(0)).getElementType().getNamespaceURI();
>>
>> wsdl sample:
>>     <wsdl:binding name="BasicHttpBinding_IMtomTest" type="i0:IMtomTest">
>>         <wsp:PolicyReference URI="#BasicHttpBinding_IMtomTest_policy" />
>>         <soap:binding 
>> transport="http://schemas.xmlsoap.org/soap/http" />
>>         ...
>>
>> But what make me confused is when I look up the wsdl spec
>> (http://www.w3.org/TR/wsdl), I found the binding chapter specify
>> the binding part should like below:
>>
>> Digest from http://www.w3.org/TR/wsdl
>>
>> The grammar for a binding is as follows:
>>
>> <wsdl:definitions .... >
>>     <wsdl:binding name="nmtoken" type="qname"> *
>>         <-- extensibility element (1) --> *
>>         <wsdl:operation name="nmtoken"> *
>>            <-- extensibility element (2) --> *
>>            <wsdl:input name="nmtoken"? > ?
>>                <-- extensibility element (3) -->
>>            </wsdl:input>
>>            <wsdl:output name="nmtoken"? > ?
>>                <-- extensibility element (4) --> *
>>            </wsdl:output>
>>            <wsdl:fault name="nmtoken"> *
>>                <-- extensibility element (5) --> *
>>            </wsdl:fault>
>>         </wsdl:operation>
>>     </wsdl:binding>
>> </wsdl:definitions>
>>
>>
>> Could we add a filter out map in WSDLServiceBuilder to filter out any
>> well-known elements namespace which may precedes the protocol element of
>> the binding to solve this type problem.
>>
>> Thanks.
>> Tom
>>
>
>
>


Re: Service Model problem with ws-policy

Posted by Dan Diephouse <da...@envoisolutions.com>.
Yeah, I brought this up once before but never did anything about it. We need
a much more robust way to select the appropriate namespace. One option would
be to just loop through the elements until we find a bindingfactory:

BindingFactory bindingFactory = null;
for (ExtensibilityElement e : extensibilityElements) {
  bindingFactory = bindingFactoryManager.getBinding(e.getElementType
().getNamespaceURI());
  if (bindingFactory != null) break;
}

Regards,
- Dan

On 12/5/06, Li, Tao (Tom) <Ta...@iona.com> wrote:
>
> Hi Andrea,
>
> Currently, if a wsdl file contains ws-policy assertions,
> our cxf can't build service model correctly.
>
> In WSDLServiceBuilder.buildBinding method, it assumed that
> the first ext element is the one specify the protocol (such
> as soap), but if the wsdl has ws-policy assertion, the first
> element of binding may be the wsp:PolicyReference.
>
> our code:
> String ns = ((ExtensibilityElement)binding.getExtensibilityElements()
>        .get(0)).getElementType().getNamespaceURI();
>
> wsdl sample:
>     <wsdl:binding name="BasicHttpBinding_IMtomTest" type="i0:IMtomTest">
>         <wsp:PolicyReference URI="#BasicHttpBinding_IMtomTest_policy" />
>         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
>         ...
>
> But what make me confused is when I look up the wsdl spec
> (http://www.w3.org/TR/wsdl), I found the binding chapter specify
> the binding part should like below:
>
> Digest from http://www.w3.org/TR/wsdl
>
> The grammar for a binding is as follows:
>
> <wsdl:definitions .... >
>     <wsdl:binding name="nmtoken" type="qname"> *
>         <-- extensibility element (1) --> *
>         <wsdl:operation name="nmtoken"> *
>            <-- extensibility element (2) --> *
>            <wsdl:input name="nmtoken"? > ?
>                <-- extensibility element (3) -->
>            </wsdl:input>
>            <wsdl:output name="nmtoken"? > ?
>                <-- extensibility element (4) --> *
>            </wsdl:output>
>            <wsdl:fault name="nmtoken"> *
>                <-- extensibility element (5) --> *
>            </wsdl:fault>
>         </wsdl:operation>
>     </wsdl:binding>
> </wsdl:definitions>
>
>
> Could we add a filter out map in WSDLServiceBuilder to filter out any
> well-known elements namespace which may precedes the protocol element of
> the binding to solve this type problem.
>
> Thanks.
> Tom
>



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

Re: Service Model problem with ws-policy

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

<wsp:PolicyReference URI="#BasicHttpBinding_IMtomTest_policy" /> is the first child of the <binding> element, so it's placed 
correctly according to the binding schema...It references a policy with id "BasicHttpBinding_IMtomTest_policy" located in the same 
wsdl...

Cheers, Sergey


Hi Andrea,

Currently, if a wsdl file contains ws-policy assertions,
our cxf can't build service model correctly.

In WSDLServiceBuilder.buildBinding method, it assumed that
the first ext element is the one specify the protocol (such
as soap), but if the wsdl has ws-policy assertion, the first
element of binding may be the wsp:PolicyReference.

our code:
String ns = ((ExtensibilityElement)binding.getExtensibilityElements()
       .get(0)).getElementType().getNamespaceURI();

wsdl sample:
    <wsdl:binding name="BasicHttpBinding_IMtomTest" type="i0:IMtomTest">
        <wsp:PolicyReference URI="#BasicHttpBinding_IMtomTest_policy" />
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
...

But what make me confused is when I look up the wsdl spec
(http://www.w3.org/TR/wsdl), I found the binding chapter specify
the binding part should like below:

Digest from http://www.w3.org/TR/wsdl

The grammar for a binding is as follows:

<wsdl:definitions .... >
    <wsdl:binding name="nmtoken" type="qname"> *
        <-- extensibility element (1) --> *
        <wsdl:operation name="nmtoken"> *
           <-- extensibility element (2) --> *
           <wsdl:input name="nmtoken"? > ?
               <-- extensibility element (3) -->
           </wsdl:input>
           <wsdl:output name="nmtoken"? > ?
               <-- extensibility element (4) --> *
           </wsdl:output>
           <wsdl:fault name="nmtoken"> *
               <-- extensibility element (5) --> *
           </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
</wsdl:definitions>


Could we add a filter out map in WSDLServiceBuilder to filter out any
well-known elements namespace which may precedes the protocol element of
the binding to solve this type problem.

Thanks.
Tom