Skip to content

Instantly share code, notes, and snippets.

@kasperg
Created July 24, 2014 17:15
Show Gist options
  • Save kasperg/b879e13ce6e47875a422 to your computer and use it in GitHub Desktop.
Save kasperg/b879e13ce6e47875a422 to your computer and use it in GitHub Desktop.
wsdl2phpgenerator base type generation demo
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="abstract"
targetNamespace="urn:www.example.org:abstract"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:www.example.org:abstract"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="urn:www.example.org:abstract"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:complexType name="ProjectTypeItem">
<xsd:sequence>
<xsd:element name="project" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
<xsd:element name="type" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProjectTypeCatItem">
<xsd:complexContent>
<xsd:extension base="tns:ProjectTypeItem">
<xsd:sequence>
<xsd:element name="catidentifier" type="xsd:string" minOccurs="1" maxOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</schema>
</wsdl:types>
<wsdl:message name="echoRequest">
<wsdl:part name="name" type="xsd:string"/>
<wsdl:part name="author" type="tns:Author"/>
</wsdl:message>
<wsdl:message name="echoResponse">
<wsdl:part name="return" type="tns:Book"/>
</wsdl:message>
<wsdl:message name="echoLiteralRequest">
<wsdl:part name="author" element="tns:Author"/>
</wsdl:message>
<wsdl:message name="echoLiteralResponse">
<wsdl:part name="return" element="tns:Author"/>
</wsdl:message>
<wsdl:message name="echoDerivedRequest">
<wsdl:part name="parameter" type="tns:BaseClass"/>
</wsdl:message>
<wsdl:message name="echoDerivedResponse">
<wsdl:part name="return" type="tns:BaseClass"/>
</wsdl:message>
<wsdl:portType name="AbstractService">
<wsdl:operation name="echo" parameterOrder="obj typename">
<wsdl:input message="tns:echoRequest" name="echoRequest"/>
<wsdl:output message="tns:echoResponse" name="echoResponse"/>
</wsdl:operation>
<wsdl:operation name="echoLiteral">
<wsdl:input message="tns:echoLiteralRequest"/>
<wsdl:output message="tns:echoLiteralResponse"/>
</wsdl:operation>
<wsdl:operation name="echoDerived">
<wsdl:input message="tns:echoDerivedRequest" name="echoDerivedRequest"/>
<wsdl:output message="tns:echoDerivedResponse" name="echoDerivedResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AbstractServiceSoapBinding"
type="tns:AbstractService">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="echo">
<wsdlsoap:operation style="rpc" soapAction=""/>
<wsdl:input name="echoRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:www.example.org:abstract" use="encoded"/>
</wsdl:input>
<wsdl:output name="echoResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:www.example.org:abstract" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="echoLiteral">
<wsdlsoap:operation style="document" soapAction=""/>
<wsdl:input name="echoLiteralRequest">
<wsdlsoap:body namespace="urn:www.example.org:abstract" use="literal"/>
</wsdl:input>
<wsdl:output name="echoLiteralResponse">
<wsdlsoap:body namespace="urn:www.example.org:abstract" use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="echoDerived">
<wsdlsoap:operation style="rpc" soapAction=""/>
<wsdl:input name="echoDerivedRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:www.example.org:abstract" use="encoded"/>
</wsdl:input>
<wsdl:output name="echoDerivedResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:www.example.org:abstract" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AbstractServiceService">
<wsdl:port name="AbstractService"
binding="tns:AbstractServiceSoapBinding">
<wsdlsoap:address location="http://localhost:8080/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?php
class ProjectTypeItem
{
/**
*
* @var string $project
* @access public
*/
public $project = null;
/**
*
* @var string $type
* @access public
*/
public $type = null;
/**
*
* @param string $project
* @param string $type
* @access public
*/
public function __construct($project, $type)
{
$this->project = $project;
$this->type = $type;
}
}
<?php
include_once('ProjectTypeItem.php');
class ProjectTypeCatItem extends ProjectTypeItem
{
/**
*
* @var string $catidentifier
* @access public
*/
public $catidentifier = null;
/**
*
* @param string $project
* @param string $type
* @param string $catidentifier
* @access public
*/
public function __construct($project, $type, $catidentifier)
{
parent::__construct($project, $type);
$this->catidentifier = $catidentifier;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment