6

I have two salesforce orgs and I am trying to do SOAP integration between these two via WSDL import.

From the first Salesforce Org (let us say S1)

I did the following

a) Clicked on the "WSDL" of my webservice class.

enter image description here

b) When I clicked on the hyperlink though, it took me to a web page like shown below.

enter image description here

c) So I saved the webpage as ".wsdl" shown below.

enter image description here

d) In the second salesforce org (let us say S2) i did the following.

Clicked on "Generate from WSDL"

enter image description here

e) It asked me to choose the file and here I chose the "AccountAdd.wsdl" file

enter image description here

f) It gave me a success response for parsing as shown below.

enter image description here

g) But when I try to generate the apex code it gave me the following error.

enter image description here

I have also attached the class that I tried for this activity.

global class AccountAdd
{

webservice static Account AddingNewAccount(Account a)
{

//custom logic
return null;

}


}

This is just a placeholder class without adding actual methods which I will add later. For now I just wanted to try an import/export of WSDL.

Also I have added the second salesforce org (S2) in the Remote Site Settings on S1 as shown below.

enter image description here

Question :

Can someone please let know as to why I am getting error in S2 (Step g)when trying to generated apex code of the AccountAdd.wsdl ?

4

The native version of Wsdl2Apex doesn't support {http://www.w3.org/2001/XMLSchema}anyType because WebserviceCallout.invoke can't.

By having Account in the methods Arguments and return type Salesforce is going to generate xsd:complexType's for all sorts of supporting types. A number of these will have elements like:

<xsd:element name="NewValue" minOccurs="0" type="xsd:anyType" nillable="true"/>
<xsd:element name="OldValue" minOccurs="0" type="xsd:anyType" nillable="true"/>

Also, generally speaking, wsdl2apex has great difficulty handling sObject types in a WSDL due to the use of <xsd:extension base="tns:sObject">. It won't generate the required base class fields and WebserviceCallout.invoke doesn't support inheritance.

Since it is now working for you I suspect you have altered the definition of the webservice method so that it no longer takes/returns an Account object.

If that isn't the case, you might like to try the FuseIT SFDC Explorer (Disclosure: The is my current employer). It has an alternative version of Wsdl2Apex that can handle several of these problems. anyType is still problematic, but you may no care about the types that actually use it.

If you are really keen, there is also the open source version of wsdl2apex, which you code modify as required.

0

This is no longer an issue.

I did complete the class and after completing it I tried doing the same (generate/export/import) and now the apex code was successfully generated in the second org.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.