Hi guys,
Ganiha ra ko sige ug sulbad ani pero wala pa jud nako na sulbad. Basin naa mo idea usaon ni siya.
Basically akong gustong buhaton is to return an array of strings.
mao ni akong WSDL file:
then mao ni akong server iplementation. php akong gamit:Code:<?xml version="1.0"?> <definitions name="DemoService" targetNamespace="urn:DemoService" xmlns:typens="urn:DemoService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:TreonService"> <xsd:complexType name="ArrayOfString"> <xsd:sequence> <xsd:element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:schema> </types> <message name="ArrayOfStringMessage"> <part name="return" type="typens:ArrayOfString" /> </message> <portType name="DemoServicePort"> <operation name="ReturnArrayOfString"> <output message="typens:ArrayOfStringMessage"/> </operation> </portType> <binding name="DemoServiceBinding" type="typens:DemoServicePort"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="ReturnArrayOfString"> <soap:operation soapAction="urn:DemoServiceAction" /> <output> <soap:body use="encoded" namespace="urn:DemoService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> </binding> <service name="DemoServiceEndpoint"> <port name="DemoServicePort" binding="typens:DemoServiceBinding"> <soap:address location="http://localhost/demo.php" /> </port> </service> </definitions>
Mao ni akong clientCode:<?php function ReturnArrayOfString() { return array('asdf', 'asdf', 'asdf'); } $opts = Array(); $opts['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP; $server = new SoapServer('demo.wsdl', $opts); $server->addFunction('ReturnArrayOfString'); $server->handle(); ?>
ang error mugawas kay:Code:<?php ini_set('soap.wsdl_cache_ttl', 0); $client = new SoapClient('http://localhost/demo.wsdl'); $res = $client -> ReturnArrayOfString(); var_dump($res); ?>
Taba-ngi ko ug debug please. Bag.o pa man ko sa ani so if naa moy ika-suggest I would love to hear it.Code:Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Procedure 'ReturnArrayOfString' not present in ...
Best regards,
Ish



Reply With Quote
