在 Salesforce 中从 WSDL 生成 Apex 代码时出现 WSDL 解析错误 [英] Getting WSDL parse error while generating Apex code from WSDL in Salesforce

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

问题描述

解析亚马逊产品广告 API 时出现以下错误.

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

错误:无法解析 wsdl:simpleType->元素名称不能为空.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 使用不支持许多 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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆