Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Java Development
- :
- apex ksoap java
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
apex ksoap java
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-24-2012 03:05 AM
Hello. Does anyone know how to acces apex classes through ksoap2 using java (android). This is what i have so far:
My login.
SoapObject binding = new SoapObject(NAMESPACE, "login"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(binding); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.call(SOAP_ACTION, envelope);
From a succesful login i get the session id:
sessionId=result.getProperty("sessionId").toString ();Then i form a header:
headerOut = new Element[1]; Element sessionHeader = new Element().createElement(NAMESPACE,"SessionHeader"); Element sessionIdNode=sessionHeader.createElement(NAMESPAC E, "sessionId"); sessionIdNode.addChild(Node.TEXT, sessionId); sessionHeader.addChild(Node.ELEMENT,sessionIdNode) ; headerOut[0]=sessionHeader;
Now i can access the data by SOQL queries but i want to acces my apex classes too. (Oh and i got the url to access queries from the login response.)
But what i cant do is access my created Apex classes.
For example this simple one:
global class HelloWorld {
webservice static String hello() {
return 'Hi';
}
}
I try to acces this by:
SoapObject request2 = new SoapObject(NAMESPACE2, METHOD_NAME2);
SoapSerializationEnvelope envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope2.headerOut=headerOut;
envelope2.setOutputSoapObject(request2);
HttpTransportSE androidHttpTransport2 = new HttpTransportSE(URL2);
SoapObject result2=null;
try
{
androidHttpTransport2.call(SOAP_ACTION2, envelope2)
....just like the login but i get the namespace and the url from an apex class wsdl file and form a sessionheader, same method works with queries.
Do you guys have some ideas what could be wrong? I tried all the possible url and namespace changes i could think off, and all other things i could have tried. With some settings i get the error SoapFault message=No service available for class 'HelloWorldr.' with others my application just crashes.
Hope you understood my problem. If not then sorry, english is not my native language

