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
chandraYeruvaRechandraYeruvaRe 

Calling a webservice using a standalone client

Hi,
I have developed a simple apex class with a sebservice in it.I want to invoke that web service using a soap client.I was able to geenrate the enterpriseWSDL and got a bunch of java classes using wsdl2java tool.Now can you plz explain how to write a clint or a standalone program to invoke that web service.if possible some code snippet.

Simple apex class
global class MyWebService {
 webservice static void SayHello(String name){
System.debug('hello '+name);
        }
}

I had created a bunch of java files by using the utility of axis WSDL2java.It created almost 11 classes

1) InvalidFieldFault
2) InvalidIdFault
3) InvalidNewPasswordFault
4) InvalidQueryLocatorFault
5) InvalidSObjectFault
6) LoginFault
7) MalformedQueryFault
8) MalformedSearchFault
9) SforceServiceCallbackHandler
10) SforceServiceStub
11) UnexpectedErrorFault.

After creating all the java clsses,I had put them on eclipse and  ensure that they will compile.Now i need to write a soap client to call the webservice Mywebservice and get the response.can anyone plz help me on this.thanks in advance

SankarSankar

Hi chandra,

 

I am also standing at the same point without any clues. Did you successfully generated the response. if so please share the solution.

 

 

Thanks

SuperfellSuperfell

run WSDL2Java on the WSDL for your apex class.

using the enterpise stub call login to get a sessionId (plenty of examples in the api docs).

create an instance of the stub created in 1

set the sessionHeader of the stub using the sessionId from 2

call sayHello on the stub.

 

 

 

SankarSankar
Thank you simon as you said i am able to do it.