PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » SOAP » Bug #3317

Wrong WSDL base structure

Details

Submitted2005-01-27 20:57 UTC
FromHruska at gratex dot com
Assignedyunosh
StatusNo Feedback
PackageSOAP
PHP Version4.3.10
OSLinux RedHat
Roadmaps(Not assigned)

Comments

[2005-01-27 20:57 UTC] Hruska at gratex dot com

Description:
------------
Example for auto WSDL generation with DISCO server generates wrong XML.

(8? characters are unrecognisable chars. I cant find where that bug incease, but i think what it's simple to correct.

The same result is from SOAP version 0.7.3 and 0.8.1 too.

Reproduce code:
---------------
<?php
require_once 'SOAP/Server.php';

// Your class
class HelloServer {
var $__dispatch_map = array();

function HelloServer() {
// Define the signature of the dispatch map
$this->__dispatch_map['sayHello'] =
array('in' => array('inputString' => 'string'),
'out' => array('outputString' => 'string'),
);
}

// Required function by SOAP_Server
function __dispatch($methodname) {
if (isset($this->__dispatch_map[$methodname]))
return $this->__dispatch_map[$methodname];
return NULL;
}

// Your function
function sayHello($inputString)
{
return 'Hello '.$inputString;
}
}

// Fire up PEAR::SOAP_Server
$server = new SOAP_Server;

// Fire up your class
$helloServer = new HelloServer();

// Add your object to SOAP server (note namespace)
$server->addObjectMap($helloServer,'urn:HelloServer');

// Handle SOAP requests coming is as POST data
if (isset($_SERVER['REQUEST_METHOD']) &&
$_SERVER['REQUEST_METHOD']=='POST') {
$server->service($HTTP_RAW_POST_DATA);
} else {
// Deal with WSDL / Disco here
require_once 'SOAP/Disco.php';

// Create the Disco server
$disco = new SOAP_DISCO_Server($server,'HelloServer');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING']) &&
strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
echo $disco->getWSDL(); // if we're talking http://www.example.com/index.php?wsdl
} else {
echo $disco->getDISCO();
}
exit;
}
?>

Expected result:
----------------
<?xml version="1.0"?>
<definitions name="HelloServer"
targetNamespace="urn:HelloServer"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:HelloServer"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<types xmlns="http://schemas.xmlsoap.org/wsdl/">
</types>

<portType name="HelloServerPort">
<operation name="sayHello">
<input message="tns:sayHelloRequest" />
<output message="tns:sayHelloResponse" />
</operation>
</portType>
<binding name="HelloServerBinding" type="tns:HelloServerPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/" />
<operation name="sayHello">
<soap:operation soapAction="urn:HelloServer#helloserver#sayHello" />
<input>
<soap:body use="encoded" namespace="urn:HelloServer"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:HelloServer"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="HelloServerService">
<documentation />
<port name="HelloServerPort" binding="tns:HelloServerBinding">
<soap:address location="http://localhost/wsdl/hello_server.php" />
</port>
</service>
<message name="sayHelloRequest">
<part name="inputString" type="xsd:string" />
</message>
<message name="sayHelloResponse">
<part name="outputString" type="xsd:string" />
</message>
</definitions>

Actual result:
--------------
<?xml version="1.0"?><definitions name="HelloServer" targetNamespace="urn:HelloServer" xmlns:(8?="http://schemas.xmlsoap.org/wsdl/" xmlns:(8? ="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:HelloServer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types xmlns="http://schemas.xmlsoap.org/wsdl/">
</types>
<portType name="HelloServerPort">
<operation name="sayHello">
<input message="tns:sayHelloRequest" />
<output message="tns:sayHelloResponse" />
</operation>
</portType>
<binding name="HelloServerBinding" type="tns:HelloServerPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/" />
<operation name="sayHello">
<soap:operation soapAction="urn:HelloServer#helloserver#sayHello" />
<input>
<soap:body use="encoded" namespace="urn:HelloServer" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>

<soap:body use="encoded" namespace="urn:HelloServer" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="HelloServerService">
<documentation />
<port name="HelloServerPort" binding="tns:HelloServerBinding">
<soap:address location="http://www.selekcia.com/soap/index.php" />
</port>
</service>
<message name="sayHelloRequest">
<part name="inputString" type="xsd:string" />
</message>
<message name="sayHelloResponse">
<part name="outputString" type="xsd:string" />
</message>
</definitions>

[2005-09-16 10:33 UTC] whillas at gmail dot com

YEAH!

Its completely screwed. This is a major issue man! I have a Java client typing to talk to my server and it can't understand the messages my SOAP server is sending it. This makes SOAP_Server completely useless! Is there active development on this project?

Does anyone know if NuSOAP handles this properly?