function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tushar SethTushar Seth 

I want to work with Metadata API and write an apex code to use Metadata API

I have to work in Metadata API to customize my salesforce org through Apex.

 

I have generated WSDL for Metadata API as well as Enterprise

but when I am generating apex code for these WSDL it is showing errors to both the files

1. Enterprise WSDL - Apex Generation FailedUnsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType

2. MetaData API- "Apex Generation Failed Class name 'Metadata' already in use. Please edit WSDL to remove repeated names"  

 

For Enterprise error changing anyType to string couldn't solve my error.

 

Please assist me if any one have any idea to get rid of this issue.

 

Thanks in advance.

 

Regards,

Tushar Seth

Apex LearnerApex Learner

No luck for me too :(

Amit VaidyaAmit Vaidya

Hi,

 

In metadata file, there is service tag as shown below:

 

<service name="MetadataService">
<documentation>Manage your Salesforce.com metadata123</documentation>
<port binding="tns:MetadataBinding" name="MetadataWebSvc">
<soap:address location="https://cs11-api.salesforce.com/services/Soap/m/26.0"/>
</port>
</service>

 

Just change the name attribute value of the port tag to something different and then try to generate.

It worked for me.

 

Thanks,

Amit Vaidya

Preeti LalwaniPreeti Lalwani
Why would you want to worry about migrating metadata manually?  Flosum (http://www.flosum.com) is a great tool which automates all of this functionality.
vikash mishra 8vikash mishra 8

Hi @Amit Vaidya,

I have changed the name attribute value as "Metadataaa". But after that, I am getting below error:

The following generated class(es) have compilation errors:
Error: AsyncSoapSforceCom200604Metadataaa
Error: Dependent class is invalid and needs recompilation: Class soapSforceCom200604Metadataaa : Script too large: public class soapSforceCom200604Metadataaa { public class ReportTypeColumnTranslation { ... at 3:14

Error: soapSforceCom200604Metadataaa
Error: Script too large: public class soapSforceCom200604Metadataaa { public class ReportTypeColumnTranslation { ... at 3:14g

 

Please  guide me right path.

Thank you.

 

Anurag Reddy KanchimireddyAnurag Reddy Kanchimireddy
Hi Vikash,
I too got the same issue, did you solved it by any chance?? Please let me know.

Thank you.
Mark Brown 33Mark Brown 33
Hi Vikash / Anurag did either of you resolve this, I have the same problem now :(
Anurag Reddy KanchimireddyAnurag Reddy Kanchimireddy
Yes Mark.
enk raoenk rao
Hello Vikash/Anurag/Mark,
Is this issue resolved? i am facing the same issue and i see the generating apex class has more than 1 million characters which is causing the script too large issue. As per Apex Class the character count should not exceed 1 million.
Mohit SharmaMohit Sharma
Hi All,

If anyone has the solution to this, could you please post it here. 
enk raoenk rao
Hello Mohit
For the script too large error, use FuseIt SFDC explorer. Download it and convert Metadata WSDL to Apex. Then copy the Generated class, go to salesforce Apex Class section from Salesforce UI and paste it and save it. It should resolve the issue.