0

I am new to web services, and I need to call a specific method from my web service. I had created a web service using NetBeans IDE, and now I need to call that using JavaScript.

function validateForm(frm)
{
document.forms[0].action="http://localhost:8084/Web_Service_Example/CircleFunctions?wsdl"
document.forms[0].method="get"
document.forms[0].submit()
}

It is running properly on my local system.
Now I need to call the method of my web service

public class CircleFunctions {
public int sum()
{
int a = 20;
int b = 40;
int c = a+b;
return c;
}
}

How can I call the sum() method of my CircleFunctions Class. And is it possible to send the parameter to the method?

phwd
  • 19,975
  • 5
  • 50
  • 78
pra....
  • 23
  • 9
  • 1
    Duplicate of http://stackoverflow.com/questions/10477163/how-to-call-a-specific-method-of-my-web-service-from-java-script – dragon66 May 08 '12 at 12:49
  • 1
    @dragon66 yes, this is duplicate of that Question, as previous was not answered. – pra.... May 08 '12 at 12:51
  • I used to do webservices call from backend Java not JavaScript. I haven't have a chance to read carefully the answers to your old post. But if it's soap-based webservice, I don't think it works the way like a REST type one. You got to wrap information in a Soap envolope. I am not an expert to answer it. Here is a link which might help you: http://www.ibm.com/developerworks/webservices/library/ws-wsajax/ – dragon66 May 08 '12 at 13:13
  • 1
    Don't re-ask question because the one from yesterday was not answered. Please update the original. Otherwise, the information will be sharded across multiple pages, instead of one useful resource – Dan McClain May 08 '12 at 14:30

1 Answers1

0

It looks like you are trying to call SOAP from JavaScript. I do not normally recommend this. A REST architecture is much more in line with the JavaScript way of doing things. However, let me refer you to the following SO question.

My suggestion is for you to use REST for Java -> JavaScript and SOAP for Java -> Java.

Community
  • 1
  • 1
Andrew White
  • 52,720
  • 19
  • 113
  • 137