![](/img/trans.png)
[英]CXF: Add implicit headers to WSDL and WADL responses for a CXF SOAP/REST web service
[英]Can CXF produce SOAP responses that do not comply to the WSDL?
我將CXF用於SOAP Web服務。 是否有任何情況導致生成的SOAP響應不符合WSDL? 我讓CXF通過wsdl2java從WSDL生成代碼。
例如,我有一些帶有minOccurs=1
實體。 CXF是否會強制相應的Java元素不為null?
還有其他差異嗎?
一個示例:我具有以下WSDL類型:
<xsd:complexType name="PropertyList">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1" name="property"
type="pms-xsd:Property" />
</xsd:sequence>
</xsd:complexType>
轉換為:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PropertyList", propOrder = {
"property"
})
public class PropertyList {
@XmlElement(required = true)
protected List<Property> property;
...
以我的理解,這要求存在List property
(以XmlElement的形式),但不存在至少一個WSDL要求的Property。 這是可能的問題,還是我理解不對?
要實施模式,您需要啟用模式驗證。 請檢查此處以啟用架構驗證。 下面顯示了一個示例代碼片段。
<jaxws:endpoint name="{http://apache.org/hello_world_soap_http}SoapPort"
wsdlLocation="wsdl/hello_world.wsdl"
createdFromAPI="true">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
注意:為了正常工作,您需要正確設置wsdl位置。 這樣,在模式驗證期間將引用WSDL文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.