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
maybemedicmaybemedic 

"No operation available for request" in apex code

Hello All,
             I am fairly new to apex development. I have developed an apex class that would accept an xml string, parse it and returns the parsed elements back. Just for testing purposes. I am getting the following exception back,,,

"No operation available for request {http://soap.sforce.com/schemas/class/TerminateAC}processXmlDataStream"

Here I am not trying to hit a secure URL, just using http:// since we are passing the token that we get as a result of the login call(EndpointURL), just to avoid using certificates. I have done this earlier and it works. I am just wondering that if my client is not able to find the service at

https://cs2-api.salesforce.com/services/Soap/class/TerminateAC

The simple code I developed is,

Code:
global class TerminateAC
{
webservice static String[] processXmlDataStream(String data )
{
XmlStreamReader xmlReader = new XmlStreamReader(data);
String[] gotAC = new String[0];
String xmlText = '';
//String[] result = new String[0];
try
{
while (xmlReader.hasNext())
{
if (xmlReader.getEventType() == XmlTag.START_ELEMENT && xmlReader.getLocalName() == 'AC')
{
//xmlReader.next();
if(xmlReader.getEventType() == XmlTag.START_ELEMENT && xmlReader.getLocalName() == 'A')
{
xmlText = xmlReader.getText();
gotAC.add(xmlText);
System.debug('Got data ---> ' + xmlText);

}
if(xmlReader.getEventType() == XmlTag.START_ELEMENT && xmlReader.getLocalName() == 'C')
{
xmlText = xmlReader.getText();
gotAC.add(xmlText);
System.debug('Got data ---> ' + xmlText);
}
}
else if (xmlReader.getEventType() == XmlTag.END_ELEMENT && xmlReader.getLocalName() == 'AC')
break;
xmlReader.next();
}
}
catch(XmlException ex)
{
ex.getMessage();
}
catch(Exception ex)
{
ex.getMessage();
}
return gotAC;
}//End ProcessXmlStreamData

static testMethod void testProcessXmlDataStream() {
String sText = '';

String xmlData = '<—xml version="1.0" encoding="UTF-8"–>';
xmlData += '<AC xsi:noNamespaceSchemaLocation="AC.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
xmlData += '<A>a0770000002IHMz</A>';
xmlData += '<A>a0770000002yHvz</A>';
xmlData += '<A>a0770000002IoMz</A>';
xmlData += '<C>a077000000iIpMz</C>';
xmlData += '<C>a077000j002IlMz</C>';
xmlData += '</AC>';

TerminateAC.processXmlDataStream(xmlData);
}

}

 I am not able to get where I am going wrong. I'd like to know if there is a way to get stack trace when we run a code in force.com platform??

I verified an earlier WSDL from an apex class with the one I generated, I dont see a problem with mine, only that in the earlier working version(different interface), the return type is a user define class and to keep things simple I've used a String[ ]. I believe SOAP supports it.The data I am sending is

<?xml version="1.0" encoding="UTF-8"?> <AC xmlns="http://www.xyz.com/schemas/CopyFiles/Schema.xsd">     <A>123456</A>     <C>2345</C> </AC>


I'd appreciate any help in this regard. Thanks all.
SuperfellSuperfell
Typically that error means you sent the request to the wrong URL, check your URL against the one in the WSDL for your apex class.
maybemedicmaybemedic
Simon,
             Thanks for your response. I was using a diff URL for login. I fixed it. I'd like to know if there is a way to look at the debug statements on the server side at runtime. I believe thats possible if we do a "Run Tests" on force.com, but if I want to see whats happening on the server side when I invoke a apex WS, is there any log that I can see or is it possible to programatically retrieve the log. Thanks for your time again.
SuperfellSuperfell
You can collect the log in the response of your WebService request by asking for it in the request, see the DebuggingHeader soap header.