• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

How do I address a specific function in a web service using AJAX?

Dear Experts!

I am trying to call a SOAP based web service using AJAX.

How do I address a specific function/method in the web service?

And which parameter name should be used for the POST of the SOAP XML?

I do not want to use any js libs.

I expect I should use a parameter for the name of the function/method in the web service, but which name should this parameter have?

The web service is PHP based.

The WS is entirely SOAP based, only using a SOAP request XML message and SOAP reponse XML message.

In anticipation
Thank you

Best regards,
Henrik
0
Henrik_Nyholm
Asked:
Henrik_Nyholm
  • 2
1 Solution
 
devlab2012Commented:
you can address a specific as:

http://your_web_service_uri/method_name

see the following link for passing parameters using POST:
http://beradrian.wordpress.com/2007/07/19/passing-post-parameters-with-ajax/

name of parameters should be same as the names used in your web service.
0
 
Henrik_NyholmAuthor Commented:
Dear devlab2012!

Thanks for reply.

Anyway, then how do I make a PHP file accepting '/method_name' as query string?

Thank you,

Henrik
0
 
devlab2012Commented:
I am not very sure about how it works in PHP, but you can try passing it as a query string variable as follows:

http://mydomain.com/my_web_service.php?MethodName=MyTestMethod

In your php file, you can check the value of MethodName using $_GET["MethodName"] and do the processing accordingly.

Also, check the following link for creating a basic web service in PHP:
http://davidwalsh.name/web-service-php-mysql-xml-json
0

Featured Post

Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now