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
Nurav1982Nurav1982 

Apex SOAP Web Service Error - 501 Labs

Hello All,

 

I am trying to complete this lab (8-1 Creating a Custom SOAP Web Service) from 501 Labs.

 

When I did this with the assigned org during our training, I did not have any issues.

 

When I tried doing the same exercise in my own developer edition I am seeing this error.

 

Objective of the exercise : To allow insertion of job candidate and application via webservice API.In this the webservice is called from a VF page.

 

webservice name =

CandidateKeyWebService

and it has a method called "submitEmployeeReferral"

 

This is the contents from the pop up window

 

=========

 

AJAX Toolkit Shell
Features: autocompletion of property names with Tab, multiline input with Shift+Enter, input history with Up/Down Values and functions: ans, print(string), props(object), blink(node), clear(), load(scriptURL), scope(object)


Request: server- /services/Soap/package/CandidateKeyWebService
<textarea cols=80 rows=5 wrap=hard>&lt;se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;se:Header xmlns:sfns="http://soap.sforce.com/schemas/package/CandidateKeyWebService"&gt;&lt;sfns:SessionHeader&gt;&lt;sessionId&gt;00D90000000qFRD!AREAQMLtrkAQzPhCsf_KMIB5rE5rnPPap0YFtJyDdsz_3GcQs_fom5q7dGXJyBdG1TGaMY83V7CI0.gU.93nw49Bdt5hDKnx&lt;/sessionId&gt;&lt;/sfns:SessionHeader&gt;&lt;/se:Header&gt;&lt;se:Body&gt;&lt;submitEmployeeReferral xmlns="http://soap.sforce.com/schemas/package/CandidateKeyWebService"&gt;&lt;a&gt;a009000000PLJx8AAH&lt;/a&gt;&lt;b&gt;&lt;type&gt;Candidate__c&lt;/type&gt;&lt;First_Name__c&gt;a&lt;/First_Name__c&gt;&lt;Last_Name__c&gt;b&lt;/Last_Name__c&gt;&lt;Phone__c&gt;&lt;/Phone__c&gt;&lt;Mobile__c&gt;&lt;/Mobile__c&gt;&lt;Email__c&gt;a@a.com&lt;/Email__c&gt;&lt;/b&gt;&lt;/submitEmployeeReferral&gt;&lt;/se:Body&gt;&lt;/se:Envelope&gt;</textarea>


Response : status - 500
<textarea cols=80 rows=5 wrap=hard>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Body&gt;&lt;soapenv:Fault&gt;&lt;faultcode&gt;soapenv:Client&lt;/faultcode&gt;&lt;faultstring&gt;No such parameter a defined for the operation, please check the WSDL for the service.&lt;/faultstring&gt;&lt;/soapenv:Fault&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</textarea>


faultcode    soapenv:Client
faultstring    No such parameter a defined for the operation, please check the WSDL for the service.

====================

 

Q : I am new to webservices debugging etc and since this error did not come during our training, I am at a loss to understand where and how to start debugging.

 

Can someone point me out in a right direction or give me a clue as to what could be wrong ?

Best Answer chosen by Nurav1982
King KooKing Koo

Hi Nurav

 

That's because the call to the web service from your VF page is not using the right parameters.

 

If you open up your VF page, look for the function called save, you have this line

 

var success = sforce.apex.execute("CandidateKeyWebService","submitEmployeeReferral",{a:posId,b:candidate});

 

you will need to change the a and b so that they match what's defined in your webservice method's signature, that is, if your submitEmployeeReferral has this signature:

 

webService static Boolean submitEmployeeReferral(String posId, Candidate__c c)

 

then your call to the web service needs to look like this:

 

var success = sforce.apex.execute("CandidateKeyWebService","submitEmployeeReferral",{posId:posId,c:candidate});

 

That fixes the problem for me.

 

King

All Answers

sfdcfoxsfdcfox
Your code, as posted, is all screwed up. Try using the "Insert code" button on the forum editor to properly format the request and response errors. Also, it would help if you included the code that you're using to build/call this WSDL.
King KooKing Koo

Hi Nurav

 

That's because the call to the web service from your VF page is not using the right parameters.

 

If you open up your VF page, look for the function called save, you have this line

 

var success = sforce.apex.execute("CandidateKeyWebService","submitEmployeeReferral",{a:posId,b:candidate});

 

you will need to change the a and b so that they match what's defined in your webservice method's signature, that is, if your submitEmployeeReferral has this signature:

 

webService static Boolean submitEmployeeReferral(String posId, Candidate__c c)

 

then your call to the web service needs to look like this:

 

var success = sforce.apex.execute("CandidateKeyWebService","submitEmployeeReferral",{posId:posId,c:candidate});

 

That fixes the problem for me.

 

King

This was selected as the best answer