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:
enterprise.wsdl - This web reference does not conform to WS-I Basic Profile v1.1 R2718: A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations as the wsdl:portType to which it refers. * Binding 'SoapBinding', in Service Description 'urn:enterprise.soap.sforce.com'
Writing file 'SforceService.cs'
relevant WSDL parts (I think)
<!-- 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...
generate the C# from the wsdl wsdl enterprise.wsdl -n:Sforce -o:SforceService.cs
the XmlAnyElement cannot have an empty namspace, so pop open SforceService.cs and remove it
this... [System.Xml.Serialization.XmlAnyElement(Namespace="")] public System.Xml.XmlElement[] Any { get { return this.anyField; } set { this.anyField = value; } }
becomes... public System.Xml.XmlElement[] Any { get { return this.anyField; } set { this.anyField = value; } }
wsdl generates xml serialization against private members which doesn't work and has to be fixed
Unhandled Exception: System.InvalidOperationException: Member LoginScopeHeaderValueField not found in class Sforce.SforceService.
this... [System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValueField")]
becomes... [System.Web.Services.Protocols.SoapHeaderAttribute("LoginScopeHeaderValue")]
search and replace ValueField" for ValueField"
then you might get this, which is a failure because mono does not install any root certificates in the trust store so https fails
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]
it is fixed with mozroots which will get all the certs mozilla ships with...
mozroots --import --sync
then everything works as describe
Sforce.SforceService binding = new Sforce.SforceService(); Sforce.LoginResult loginResult = binding.login("someuser", "somepass"); etc...