+ Start a Discussion
chandraYeruvaRechandraYeruvaRe 

Developing a new web service

Hi all,
I am new to force.com and wanna learn what is force.com technology is.I am very much interested to learn webservices creation and invoking the same from a java program.

i found the web services api doc and crated a web service like this using an apex class.
global class Mywebservice
{
 webservice public static mywebservice()
{
System.debug('trying toi insert somehtning.');
}

public testcase
{
Mywebservice.myswebservice();
}

}

Now i am facing the problem.Shall i need to do anythning extra so that this service can be deployed. i donno really ???

after this I went to setup->create->API and clicked on enterpriseWSDL link and got the WSDL file to my computer.I went and verified if my webservice description is there or not  (it is not there).

I did the same to generate the partner wsdl and verified i didnot got anythng .. :(.

can anyone please tell me how to deploy the web service and how to invoke it by using what WSDL or does i need special permissions to do so?

thanks
chandra.

SuperfellSuperfell
The WSDL for your apex class is available from the setup -> develop -> classes page.
chandraYeruvaRechandraYeruvaRe

 

Simon,

I used the wsdl generated by web service and generated the java code using WSDL2 java emitter.

I got 2 java Files.

 

Now how can i invoke the service defined by me.can i put this cod e in quick samples and run as it is ? or does i need to build a client seperately. please advice

 

thanks

 

SuperfellSuperfell
depends on which of the 50 or so java soap toolkits you are using, but there should be a class that rpresents the server, you need to construct one of those (sometimes via a factory class), and construct one of the enterprise or partner client stubs, call login, use the sessionId from the login call to call the first stub.
chandraYeruvaRechandraYeruvaRe

I am using axis 2 -1.4 and jdk 1.6 for developement.

 

now in after succesful login how can i invoke my method .? literally donno how to do this. ?

please help

SuperfellSuperfell
same way as you called login, create an instance of the other service (helloWorldService?), set the sessionId in the sessionHeader property, call the helloWorld method. (there may be some variation on this depending on how the particular version of axis2 manages headers, for example you might have to pass a sessionHeader to the helloWorld method, rather than setting a property on the stub).