且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Salesforce 中从 WSDL 生成 Apex 代码时出现 WSDL 解析错误

更新时间:2022-05-24 22:11:35

我拉低了 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 使用不支持许多 WSDL 功能的内部 wsdl2apex 工具.有一个支持的 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.