2015-01-06 3 views
0

내가 가지고있는 다음과 같은 인터페이스 :CXF @XmlElement가 작동하지 (= TRUE 필수)

@WebMethod(action = "create") 
VoidResponse create( 
           @WebParam(name="description") @XmlElement(required=true) String description, 
           @WebParam(name="userId") @XmlElement(required=true) String userId, 
           @WebParam(name="accountImage") String accountImage...); 

이것은 생성 된 WSDL 복잡한 유형 :

<xs:complexType name="create"> 
<xs:sequence> 
<xs:element name="description" type="xs:string"/> 
<xs:element name="userId" type="xs:string"/> 
<xs:element minOccurs="0" name="accountImage" type="xs:string"/> 
</xs:sequence> 
</xs:complexType> 

우리가 볼 수 있듯이, 설명 및 userId는 필수 입력란입니다. 올바른 것 같지만 요청을하거나 설명 필드를 생략하거나 비어있는 등을 보내면 CXF는 soapFault를 throw하지 않습니다.

내가 뭘 잘못하고 있니?

+0

@XmlElement에 대한 import 문을 추가 할 수 있습니까? 어쩌면 이것은 잘못된 것일 수 있습니다. – heaphach

답변

0

와 서비스에 주석을 봄

<jaxws:endpoint ...> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> ... </jaxws:endpoint>

이상을 사용하는 아래의 경우처럼 뭔가. 당신은

@WebService(name = "abc", targetNamespace = "xyz", wsdlLocation="/path to wsdl") 
@EndpointProperties(value = { 
    @EndpointProperty(key="schema-validation-enabled", value="true") 
}) 
public interface MyFirstSOAPWebService{ 
    @WebMethod(action = "create") 
    VoidResponse create( 
          @WebParam(name="description") @XmlElement(required=true) String description, 
          @WebParam(name="userId") @XmlElement(required=true) String userId, 
          @WebParam(name="accountImage") String accountImage...); 
} 

있습니다 웹 서비스 인터페이스에 설정 아래에 추가하여 수동으로 활성화해야합니다 : 그러나 wsdlLocation 설정과 함께 필수입니다 스키마 검증 가능 CXF 필요가 XSD를 알고 있기 때문에 들어오는 요청의 유효성을 검사합니다. wsdl 위치에서 필수 xsds를 제공합니다.

0

jaxws : 끝점 정의에서 스키마 유효성 검사를 설정할 수 있습니까? 당신은 스키마 검증을 수행하지 않는 기본 CXF으로 @org.apache.cxf.annotations.SchemaValidation

관련 문제