本文介绍了mono wsdl工具无法解析salesforce enterprise.wsdl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道为什么单声道wsdl工具不喜欢该wsdl吗? Microsoft对其进行了解析. XMethods在线wsdl验证程序对其进行解析.单声道似乎不喜欢它,我也不了解为什么.

Anyone know why this wsdl is not liked by the mono wsdl tool? Microsoft parses it. XMethods online wsdl validator parses it. Mono just doesn't seem to like it and I do not know enough to understand why.

# the error
mmcaughan@mmcaughan-dsktop:~/Projects/sftest$ wsdl enterprise.wsdl
Web Services Description Language Utility
Mono Framework v2.0.50727.1433

在生成代码时会出现一些警告:

There where some warnings while generating the code:

编写文件'SforceService.cs'

Writing file 'SforceService.cs'

有关WSDL的部分(我认为)

  <!-- Soap PortType -->
    <portType name="Soap">
        <operation name="login">
            <documentation>Login to the Salesforce.com SOAP Api</documentation>
            <input message="tns:loginRequest"/>
            <output message="tns:loginResponse"/>
            <fault message="tns:LoginFault" name="LoginFault"/>
            <fault message="tns:UnexpectedErrorFault" name="UnexpectedErrorFault"/>
            <fault message="tns:InvalidIdFault" name="InvalidIdFault"/>
        </operation>


 <!-- Soap Binding -->
    <binding name="SoapBinding" type="tns:Soap">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="login">
            <soap:operation soapAction=""/>
            <input>
                <soap:header use="literal" message="tns:Header" part="LoginScopeHeader"/>
                <soap:body parts="parameters" use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="LoginFault">
                <soap:fault name="LoginFault" use="literal"/>
            </fault>
            <fault name="UnexpectedErrorFault">
                <soap:fault name="UnexpectedErrorFault" use="literal"/>
            </fault>
            <fault name="InvalidIdFault">
                <soap:fault name="InvalidIdFault" use="literal"/>
            </fault>
        </operation>

推荐答案

现在更老更明智了...

Older and more wiser now...

从wsdl生成C#wsdl enterprise.wsdl -n:Sforce -o:SforceService.cs

generate the C# from the wsdlwsdl enterprise.wsdl -n:Sforce -o:SforceService.cs

XmlAnyElement不能有一个空的命名空间,因此请打开SforceService.cs并将其删除

the XmlAnyElement cannot have an empty namspace, so pop open SforceService.cs and remove it

这个...[System.Xml.Serialization.XmlAnyElement(Namespace =")]public System.Xml.XmlElement []任意{ 得到 { 返回this.anyField; } 放 { this.anyField =值; }}

this...[System.Xml.Serialization.XmlAnyElement(Namespace="")]public System.Xml.XmlElement[] Any { get { return this.anyField; } set { this.anyField = value; }}

成为...public System.Xml.XmlElement []任意{ 得到 { 返回this.anyField; } 放 { this.anyField =值; }}

becomes...public System.Xml.XmlElement[] Any { get { return this.anyField; } set { this.anyField = value; }}

wsdl针对私有成员生成xml序列化,该序列不起作用并且必须修复

wsdl generates xml serialization against private members which doesn't work and has to be fixed

未处理的异常:System.InvalidOperationException:在类Sforce.SforceService中找不到成员LoginScopeHeaderValueField.

Unhandled Exception: System.InvalidOperationException: Member LoginScopeHeaderValueField not found in class Sforce.SforceService.

这个...[System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValueField")]

this...[System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValueField")]

成为...[System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValue")]

becomes...[System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValue")]

搜索并用ValueField"替换为ValueField"

search and replace ValueField" for ValueField"

然后您可能会收到此消息,这是失败的,因为mono没有在信任存储区中安装任何根证书,因此https失败

then you might get this, which is a failure because mono does not install any root certificates in the trust store so https fails

未处理的异常:System.Net.WebException:写入请求时出错:身份验证或解密失败. 在System.Net.WebConnectionStream.WriteHeaders()[0x00000] 在System.Net.WebConnectionStream.SetHeaders(System.Byte []缓冲区)处[0x00000] 在(包装检查带有检查的远程调用)System.Net.WebConnectionStream:SetHeaders(byte []) 在System.Net.HttpWebRequest.SendRequestHeaders处(布尔型property_error)[0x00000]

Unhandled Exception: System.Net.WebException: Error writing request: The authentication or decryption has failed. at System.Net.WebConnectionStream.WriteHeaders () [0x00000] at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer) [0x00000] at (wrapper remoting-invoke-with-check) System.Net.WebConnectionStream:SetHeaders (byte[]) at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error) [0x00000]

mozroots已修复,它将获得mozilla附带的所有证书...

it is fixed with mozroots which will get all the certs mozilla ships with...

mozroots --import --sync

mozroots --import --sync

然后一切都按描述行事

Sforce.SforceService绑定=新的Sforce.SforceService();Sforce.LoginResult loginResult = binding.login("someuser","somepass");等等...

Sforce.SforceService binding = new Sforce.SforceService();Sforce.LoginResult loginResult = binding.login("someuser", "somepass");etc...

这篇关于mono wsdl工具无法解析salesforce enterprise.wsdl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:09