I'm trying to create a simple web service to retrieve the name of the dress(just for trying) based on the price inputted by the user but i'm getting the error message
Exception: Function ("DressPerPrice") is not a valid method for this service
I did some research and i found that it could be because of cache but in my server i have already specified to disable caching:
The server.php file:
<?php
header("Cache-Control: no-cache");
header("Pragma: no-cache");
require_once('dbconnect.class.php');
require_once('PriceHandler.class.php');
dbconnect::initialise();
ini_set("soap.wsdl_cache_enabled","0"); //disable caching
$server = new SoapServer('http://localhost/WebService/UDDI/90210Store.wsdl');
$server->setClass('PriceHandler');
$server->setPersistence(SOAP_PERSISTENCE_REQUEST);
$server->handle();
dbconnect::close();
?>
The WSDL 90210Store.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://www.shehzad.edu/webservice" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:this="http://www.shehzad.edu/webservice" xmlns="http://schemas.xmlsoap.org/wsdl/" xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/ http://schemas.xmlsoap.org/wsdl/wsdl.xsd http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd">
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.shehzad.edu/webservice" elementFormDefault="qualified">
<xs:element name="Input" type="xs:string"/>
<xs:complexType name="DressType">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Price" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfDresses">
<xs:sequence>
<xs:element name="DressPerPrice" minOccurs="1" maxOccurs="unbounded" type="this:DressType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Result" type="this:ArrayOfDresses"/>
</xs:schema>
</types>
<!--input message-->
<message name="getDressPerPriceRequest">
<part name="input" element="this:Input"/>
</message>
<!--output message-->
<message name="getDressPerPriceResponse">
<part name="result" element="this:Result"/>
</message>
<portType name="DressPerPricePortType">
<operation name="viewDressPerPrice">
<input message="this:getDressPerPriceRequest"/>
<output message="this:getDressPerPriceResponse"/>
</operation>
</portType>
<binding name="DressPerPriceBinding" type="this:DressPerPricePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="viewDressPerPrice">
<soap:operation soapAction="http://www.shehzad.edu/webservice"/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
</binding>
<service name="DressPerPriceService">
<port name="DressPerPricePort" binding="this:DressPerPriceBinding">
<soap:address location="http://localhost/WebService/Server/Server.php"/>
</port>
</service>
The class which keeps the method/function used by the server(PriceHandler.class.php):
<?php
class PriceHandler{
public function dressPerPrice($param)
{
$sql = "SELECT (name,price) FROM product WHERE
price LIKE '%".$param."%';";
$db_result = mysql_query($sql);
if(!db_result)
{
echo ("Query failed: ".mysql_error());
}
$ns = "http://www.shehzad.edu/webservice";
$dressPerPrice = array();
$result = array();
if(mysql_num_rows($db_result) > 0)
{
while($row = mysql_fetch_assoc($db_result))
{
$dressPerPrice[] = array('Name' => $row['name'] , 'Price' => $row['price']);
}
mysql_free_result($db_result);
$result = array('DressPerPrice'=>$dressPerPrice);
}
return $result;
}
}
?>
The category.html file(where the form is):
<!DOCTYPE HTML>
<html>
<head><h1>Dresses</h1></head>
<body>
<p>
<center>
<table border="1" style="border-collapse:collapse;">
<form id = "get_dress" action="Client.php" method="post">
<tr><td colspan="2">
<h3><center>Getting dresses per price</center></h3>
</td>
</tr>
<tr><td>Enter field to search for: </td>
<td><input type="text" name="search_input"></td>
</tr>
<tr style="text-align:center;"><td colspan="2"><input type="submit" value="SUBMIT" name="submit"></td></tr>
</form>
</table>
</center>
</p>
</body>
</html>
If you need any other codes please let me know.
I don't really know what could be causing the error. I'm new to web services please be lenient. Thanks.