It is probably a versioning issue.
Version 30.0 of the Metadata WSDL includes createdBy
and createdByName
elements (marked with x ... x below) that were not present in earlier versions and the elements must be in exact sequence:
<xsd:complexType name="DeployResult">
<xsd:sequence>
<xsd:element name="canceledBy" minOccurs="0" type="xsd:string"/>
<xsd:element name="canceledByName" minOccurs="0" type="xsd:string"/>
<xsd:element name="checkOnly" type="xsd:boolean"/>
<xsd:element name="completedDate" minOccurs="0" type="xsd:dateTime"/>
x <xsd:element name="createdBy" type="xsd:string"/> x
x <xsd:element name="createdByName" type="xsd:string"/> x
<xsd:element name="createdDate" type="xsd:dateTime"/>
<xsd:element name="details" type="tns:DeployDetails"/>
...
Your error suggests that the code you are running was built using a version of the Metadata API before 30.0 but the org you are connecting to is returning API 30.0 or later data (that contains the unexpected createdBy
and createdByName
elements). Not sure why the versions are not being automatically matched.
So getting or building an API 30.0 version of whatever tool you are using would be one way to fix this.