简体   繁体   English

针对wsdl:types中的架构验证jaxws soap请求

[英]Validate jaxws soap request against schema inside wsdl:types

I'm wanting to validate a soap request against the schema inside this wsdl. 我想针对此wsdl中的架构验证一个soap请求。

<wsdl:types >
    <xsd:schema targetNamespace="http://ws.thecompany.com/FormSubmissionService20100824" 
                xmlns:request="http://xmlschema.thecompany.com/generic/FormHeader20100824" xmlns:response="http://xmlschema.thecompany.com/generic/FormResponse20100824">

        <xsd:import namespace="http://xmlschema.thecompany.com/generic/FormHeader20100824" schemaLocation="../schema/generic/FormHeader20100824.xsd"/>
        <xsd:import namespace="http://xmlschema.thecompany.com/generic/FormResponse20100824" schemaLocation="../schema/generic/FormResponse20100824.xsd"/>

        <xsd:element name="submitFormRequest" type="request:FormHeader"/>
        <xsd:element name="submitFormResponse" type="response:FormResponse"/>

        </xsd:schema>
</wsdl:types>

<!-- Message Definition -->
<wsdl:message name="submitFormRequest">
    <wsdl:part element="thecomp:submitFormRequest" name="request" />
</wsdl:message> 

Loading a javax.xml.validation.Validator for the schema validating against a < thecomp:submitFormRequest> element doesn't work, neither does attempting to load the wsdl as the schema. 加载用于针对< thecomp:submitFormRequest>元素进行验证的模式的javax.xml.validation.Validator无效,尝试将wsdl加载为模式也不起作用。

Ideas please? 有什么想法吗? (using jax-ws, was7) (使用jax-ws,was7)

Cheers 干杯

I extracted the request/response into its own schema file: 我将请求/响应提取到其自己的模式文件中:

    <wsdl:types > 
    <xsd:schema>
        <xsd:import namespace="http://ws.acc.co.nz/ACCFormSubmissionService20100824" 
                schemaLocation="../schema/ws/ACCFormSubmissionService20100824.xsd" />
    </xsd:schema>               
</wsdl:types>

Validating against the new schema namespace/xsd works as required. 针对新模式的名称空间/ xsd进行验证可按要求进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM