下面的绑定在运行构建时出错:
[wsdlc] [错误]无效的扩展元素:“jaxws:provider”(在命名空间“http://java.sun.com/xml/ns/jaxws”中)
如果我放在绑定之外,骨架没有变化。我的目标是基于wsdl生成基于提供者的端点。
<jaxws:bindings
wsdlLocation="mywsdl.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxws http://java.sun.com/xml/ns/jaxws" xmlns:javaee="http://java.sun.com/xml/ns/javaee">
<jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='MyPortType']">
<jaxws:provider>true</jaxws:provider>
</jaxws:bindings>
</jaxws:bindings>
答案 0 :(得分:0)
<jaxws:provider>
元素的正确位置位于<jaxws:binding>
命名空间元素wsdl
上的<port>
元素中。
例如:
<portType name="MyWebServicePortType">
<jaxws:bindings>
<jaxws:class name="MyWebService"/>
</jaxws:bindings>
<operation name="doSomething">
<!-- operation (and fault) definition -->
</operation>
</portType>
<binding name="MyWebServiceBinding" type="tns:MyWebServicePortType">
<!-- .. binding definition .. -->
</binding>
<service name="MyWebService">
<jaxws:bindings>
<jaxws:class name="MyWebServiceClient"/>
</jaxws:bindings>
<port name="MyWebServicePort" binding="tns:MyWebServiceBinding">
<jaxws:bindings>
<!-- PROVIDER ELEMENT LOCATION BELOW -->
<jaxws:provider>true</jaxws:provider>
</jaxws:bindings>
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
如上所示添加<jaxws:provider>
元素会导致生成<portType>
类而不是。在上面的情况中,不会生成MyWebService
。
有关详细信息,请参阅此处: