本文介绍了从Salesforce中的WSDL生成Apex代码时遇到WSDL解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在解析Amazon Product Advertising API时出现以下错误.

Getting the following error while parsing the Amazon Product Advertising API.

错误:无法解析wsdl:simpleType-> element Name不能为null. 1295

Error: Failed to parse wsdl: simpleType->element Name can not be null. 1295

WSDL链接: http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl

有没有解决方法?

推荐答案

我拉下WSDL并在第1292和1295行进行了以下更改.请注意两个内部simpleType上的新名称属性.

I pulled the WSDL down and made the following changes on lines 1292 and 1295. Note the new name attributes on both the inner simpleTypes.

<xs:simpleType name="positiveIntegerOrAll">
<xs:union>
    <xs:simpleType name="positiveTestOne">
        <xs:restriction base="xs:positiveInteger"/>
    </xs:simpleType>
    <xs:simpleType name="positiveTestTwo">
        <xs:restriction base="xs:string">
        <xs:enumeration value="All"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:union>
</xs:simpleType>

此后,我能够使用此修改后的文件成功创建Apex类.我没有测试实际调用它,但是生成它时没有错误.

After this I was able to successfully create an Apex class using this modified file. I didn't test actually calling it, but there were no errors when generating it.

Salesforce使用内部的wsdl2apex工具,该工具不支持许多WSDL功能.列出了受支持的WSDL功能.除此之外,您经常可以破解源WSDL以获得合理水平的支持.

Salesforce uses an internal wsdl2apex tool that doesn't support a number of WSDL features. There is a list of Supported WSDL Features. Beyond that you can often hack the source WSDL to get a reasonable level of support.

这篇关于从Salesforce中的WSDL生成Apex代码时遇到WSDL解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:10