Web服务 - 找到Java模型和WSDL模型之间的不匹配,用于wsdl操作

时间:2017-05-01 15:11:05

标签: web-services

@WebServiceClient(name = "SalesCustomerSelectService", wsdlLocation = "abc.wsdl", targetNamespace = "url path + api=SalesCustomerSelect") 
public class SalesCustomerSelectService extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("sx url + &api=SalesCustomerSelect", "SalesCustomerSelectService");
public final static QName SalesCustomerSelect = new QName("sx url + &api=SalesCustomerSelect", "SalesCustomerSelect");
static {
    URL url = null;
    try {
        url = new URL("url path + SalesCustomerSelect.wsdl");
    } catch (MalformedURLException e) {
        java.util.logging.Logger.getLogger(SalesCustomerSelectService.class.getName())
            .log(java.util.logging.Level.INFO, 
                 "Can not initialize the default wsdl from {0}", "url pathSalesCustomerSelect.wsdl");
    }
    WSDL_LOCATION = url;
}
@WebEndpoint(name = "SalesCustomerSelect")
public SalesCustomerSelect getSalesCustomerSelect() {
    return super.getPort(SalesCustomerSelect, SalesCustomerSelect.class);
    }
}


@WebService(targetNamespace = "url path + api=SalesCustomerSelect", name = "SalesCustomerSelect")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SalesCustomerSelect {

@WebMethod(operationName = "SalesCustomerSelect", action = "url path + api=SalesCustomerSelect")
@Action(input = "https://gwws.greywolf.com/sx/ws.aspx?result=ws&v=1&api=SalesCustomerSelect", output = "https://gwws.greywolf.com/sx/ws.aspx?result=ws&v=1&api=SalesCustomerSelect", fault = {})
@WebResult(name = "SalesCustomerSelectResponseContainerList", targetNamespace = "url path + api=SalesCustomerSelect", partName = "parameters")
public SalesCustomerSelectResponseContainerList salesCustomerSelect(
    @WebParam(partName = "parameters", name = "SalesCustomerSelectRequestContainer", targetNamespace = "url path + api=SalesCustomerSelect")
    SalesCustomerSelectRequestContainer parameters) throws FaultMsg;
}

在我的主要课程中,我正在按照此门户网站中的建议更改端点网址

this.erpUrl实际上是一个网址路径

final QName SERVICE_NAME = new QName(this.erpUrl+"api=SalesCustomerSelect", "SalesCustomerSelectService");
final QName SERVICE_NAME1 = new QName(this.erpUrl+"api=SalesCustomerSelect", "SalesCustomerSelect");

try{
    wsdlURL = new URL(this.erpWsdl + "api=SalesCustomerSelect");
}
catch(Exception e){}

SalesCustomerSelectService customerService = new SalesCustomerSelectService(wsdlURL, SERVICE_NAME);
SalesCustomerSelect customerPort = customerService.getPort(SERVICE_NAME1, SalesCustomerSelect.class);

我收到错误

2017-05-01 17:44:27.248  WARN 8904 --- [io-8080-exec-20] c.s.x.internal.ws.model.JavaMethodImpl   : Input Action on WSDL operation SalesCustomerSelect and @Action on its associated Web Method salesCustomerSelect did not match and will cause problems in dispatching the requests
2017-05-01 17:44:27.248  WARN 8904 --- [io-8080-exec-20] c.s.x.internal.ws.model.JavaMethodImpl   : Mismatch between Java model and WSDL model found, For wsdl operation {https://gwws.greywolf.com/sxtest/ws.aspx?result=ws&v=1&api=SalesCustomerSelect}SalesCustomerSelect,There is no matching wsdl fault with detail QName {https://gwws.greywolf.com/sx/ws.aspx?result=ws&v=1&api=SalesCustomerSelect}FaultContainer

1 个答案:

答案 0 :(得分:1)

您是否可以发布Java模型和WSDL的代码供我们解密。 我觉得缺少一些有助于破译问题的细节。 我希望这样的事情可以作为问题的完整陈述。

Mismatch between Java model and WSDL model found, For wsdl operation {http://www.csapi.org/wsdl/parlayx/sms/send/v2_2/interface}sendSms,There is no matching wsdl fault with detail QName {http://www.csapi.org/schema/parlayx/common/v2_1}PolicyException_type

在上面的示例中,错误是由于Java模型名称中的错误匹配,其名称为@XmlType(name = "PolicyException_type" 和WSDL中的操作名称。

计数器检查ObjectFactory类,它显然不匹配,因为Java模型引用PolicyException_type作为名称,其中作为操作名称的对象工厂中的操作名称是:PolicyException,如下所示

@XmlElementDecl(namespace = "http://www.csapi.org/schema/parlayx/common/v2_1", name = "PolicyException")

我希望这会有所帮助。