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
Force.comForce.com 

How to write an Apex web service that will be invoked from an external system?

Hello,

 

I need to write an Apex web service that will be invoked from an external system. To test this out, I am trying to call this webservice from another Salesforce instance.

 

I have a global WebService class named "BillingIntegration". I have generated its WSDL file in xml format using the WSDL link on the class name. Few code lines from the WSDL file are shown below:

 

<definitions targetNamespace="http://soap.sforce.com/schemas/class/Billing_Integration">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://soap.sforce.com/schemas/class/Billing_Integration">
<xsd:element name="DebuggingInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="debugLog" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

 

 

I have saved the xml code in a text file with .wsdl extension and then followed these steps:

* From Apex Classes, clicked on "Generate WSDL" button

* Selected the saved WSDL file.

* Clicked on "Parse WSDL" button.

Error: Failed to parse wsdl: Parse error: Found invalid XML. only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1)

 

I cant figure out, how to resolve this error and generate the apex class through WSDL file, Plz help.

 

Thanks!

 

Best Answer chosen by Admin (Salesforce Developers) 
Force.comForce.com

Issue has been resolved now..

Earlier I was saving the content of the WSDL file by copying all data and pasting it in text file.

 

Instead the right attempt was to right click on the WSDL link and choose 'save link as' option to save the WSDL file.

All Answers

Force.comForce.com

Issue has been resolved now..

Earlier I was saving the content of the WSDL file by copying all data and pasting it in text file.

 

Instead the right attempt was to right click on the WSDL link and choose 'save link as' option to save the WSDL file.

This was selected as the best answer
Shri RajShri Raj
Your solution helped me. Thank you!
Michael McCartneyMichael McCartney
After saving it as wsdl file, I now get a different error message. The message is below:

Error: Failed to parse wsdl: Found schema import from location http://54.201.111.184:8070/WebserviceJtrac/TicketInformationRFtoJtrac?xsd=1. External schema import not supported

How can I sort this out?

Regards,
Sahoong
Michael McCartneyMichael McCartney
Hello,

I have downloaded an entreprise wsdl but I want to know if there is a way in which I can just download the wsdl for a specific page in Salesforce rather than the entire wsdl? I was doing similar operation with Workday before but Workday has wsdl for different section of their cloud like Get_Workers, Get_Job_Family_Group, Get_Organisation, Get_Location. It makes it a lot easier. I am working with RemedyForce and I just want to download the wsdl for Incident Creation alone and a class to use to call it as well.

Any help will be highly appreciated.

Thank you.

Sincerely,
Michael.
Pradeep K VeeravalliPradeep K Veeravalli

Using Mozilla browser while parsing generates same Error. I am able to eliminate this Error when parsed the same WSDL form IE & Chrome.

Regards,
Pradeep