通过Web服务从数据库检索时图像不显示

时间:2015-03-08 20:16:56

标签: php database web-services soap

我正在尝试根据用户输入的价格从数据库中获取图像的名称,价格和名称,然后将其显示在页面上,但图像未显示。

这是一张照片:

enter image description here
这是我的client.php代码:

<?php

if(isset($_POST['search_input']))
{
try
{
    $input = $_POST['search_input'];

    $wsdl = "http://localhost/WebService/UDDI/90210Store.wsdl";

    $options = array('cache_wsdl'=>WSDL_CACHE_NONE, 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS);

    $client = new SoapClient($wsdl, $options);

    $response = $client->viewDressPerPrice($input);


    if(isset($response->DressPerPrice))
    {
        $HTMLDocument = "<!DOCTYPE html>
                         <html>
                         <head><h3>Dresses</h3></head>
                         <body>
                         <table border='1'>";

                         foreach($response->DressPerPrice as $record)
                         {
                             $HTMLDocument .= "<tr><td>".$record->Name."</td>";
                             $HTMLDocument .="<td>".$record->Price."</td>";
                             $HTMLDocument .="<td><a href=".$record->Image."><img src=".$record->Image."/></a></td></tr>"; //adding it in the image tag
                         }

                         $HTMLDocument .= "</table>
                                           </body>
                                           </html>";
        echo $HTMLDocument;
    }

    else
    {
        echo "This field is not found in database";
    }
}

catch(Exception $e)
{
echo 'Exception: '.$e->getMessage();
}

catch(SOAPFault $exception)
{
echo 'SOAP Exception: '.$exception->getMessage();
}

}

else
{
header("Location: http://localhost/WebService/Client/Category.html");
}

?>

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:element name="Image" type="xs:anyURI"/> 
     </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>
</definitions>

这些照片在客户端文件夹本身中,所以它不能因此而存在。任何帮助将不胜感激。感谢。

0 个答案:

没有答案