在不带复杂类型的情况下缓存cxf SOAP WSDL

Apach cxf soap wsdl without complexType(在不带复杂类型的情况下缓存cxf SOAP WSDL)

本文介绍了在不带复杂类型的情况下缓存cxf SOAP WSDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Apachecxf创建一个Soap Web服务,当我发布我的Web服务时,我得到一个不带复杂类型的wsdl部分,这是我的代码:

我的接口:

@WebService(targetNamespace = "http://v4.ws.provider.acp.com/", name = "IGetAuthorizationDetails")
public interface IGetAuthorizationDetailsWebService {

    @WebMethod(operationName = "getAuthorizationDetailsV4")
    @RequestWrapper(localName = "getAuthorization_V4", targetNamespace = "http://request.message.provider.acp.com/", className = "ws.model.request.GetAuthorizationDetailsV4")
    @ResponseWrapper(localName = "getAuthorizationDetails_V4Response", targetNamespace = "http://response.message.provider.acp.com/", className = "ws.model.response.GetAuthorizationDetails4Response")
    @WebResult(name = "GetAuthorizationDetailsV4Rs", targetNamespace = "")
    public GetAuthorizationDetailsV4Rs getAuthorizationDetails4(

            @WebParam(name = "GetAuthorizationDetailsV4Rq", targetNamespace = "")
            @Valid GetAuthorizationDetailsV4Rq request
    ) throws TechnicalException;
}

我的配置:

  @Bean
    public ISearchAuthorizationWebServicePort getISearchAuthorizationWebServicePort(){
        return new ISearchAuthorizationWebServicePort();
    }

@Bean
    public Endpoint getIGetAuthorizationDetailsEndpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus,  getIGetAuthorizationDetailsWebServicePort());
        endpoint.publish("/GetAuthorizationDetailsTest/V4");

        return endpoint;
    }

我的请求对象:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GetAuthorizationDetailsV4Rq", namespace = "http://request.message.provider.acp.com/", propOrder = {
        "referenceNumber",
})
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper=false)
public class GetAuthorizationDetailsV4Rq extends AbstractMessageV4Rq {

    @XmlElement(name = "referenceNumber")
    @Pattern(regexp = "^[A-Za-z0-9]*$", message = "ReferenceNumber must contains only alphanumeric characters")
 private String referenceNumber ;
   

}

这是生成的wsdl:

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.api.controller.ws/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns4="http://schemas.xmlsoap.org/soap/http" xmlns:ns1="http://v4.ws.provider.acp.com/" name="IGetAuthorizationDetailsWebServicePortService" targetNamespace="http://ws.api.controller.ws.pwc/">
<wsdl:import location="http://localhost:8082/home/GetAuthorizationDetails/V4?wsdl=IGetAuthorizationDetails.wsdl" namespace="http://v4.ws.provider.acp.com/"> </wsdl:import>
<wsdl:binding name="IGetAuthorizationDetailsWebServicePortServiceSoapBinding" type="ns1:IGetAuthorizationDetails">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getAuthorizationDetailsV4">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="getAuthorizationDetailsV4">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAuthorizationDetailsV4Response">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="TechnicalException">
<soap:fault name="TechnicalException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IGetAuthorizationDetailsWebServicePortService">
<wsdl:port binding="tns:IGetAuthorizationDetailsWebServicePortServiceSoapBinding" name="IGetAuthorizationDetailsWebServicePortPort">
<soap:address location="http://localhost:8082/home/GetAuthorizationDetails/V4"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

为什么在我生成的wsdl中找不到我的请求属性,如&referenceNumber&qot;

wsdl

检查导入的推荐答案,查看是否在其中定义了请求对象。查看您的wsdl中的这一行:

<wsdl:import location="http://localhost:8082/home/GetAuthorizationDetails/V4?wsdl=IGetAuthorizationDetails.wsdl" namespace="http://v4.ws.provider.acp.com/"> </wsdl:import>
如果在浏览器中打开http://localhost:8082/home/GetAuthorizationDetails/V4?wsdl=IGetAuthorizationDetails.wsdl,它包含什么内容?您的类型和参考编号在里面吗?

最后,在定义Web服务及其所有组件元素时,我将尝试只使用一个XML名称空间。在我看来,现在您有两个名称空间:

http://request.message.provider.acp.com/
http://v4.ws.provider.acp.com/

.而CXF正在分两个部分创建wsdl。使用一个命名空间应该会给您提供一个没有导入的完整的wsdl,并且只有一个URL可用。另请参阅:CXF autogenerates WSDL imports itself?

这篇关于在不带复杂类型的情况下缓存cxf SOAP WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在不带复杂类型的情况下缓存cxf SOAP WSDL

基础教程推荐