This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Problem with ckBeanPropertyStrategy

Ask help about existing plugins, or find advice about the way to build up your own.

Problem with ckBeanPropertyStrategy

by gepp81 » Wed Jun 06, 2012 11:02 pm

Hi people!

I have this class:

Code: Select all
<?php
/**
 * @PropertyStrategy('ckBeanPropertyStrategy')
 */
class Persona {

    private $nombre;
    private $apellido;

    /**
     * @param string $nombre
     * @param string $apellido
     */
    public function __constructor($nombre, $apellido) {
        $this->nombre = $nombre;
        $this->apellido = $apellido;
    }

    /**
     * @return string
     */
    public function getNombre() {
        return $this->nombre;
    }

    /**
     * @param string $nombre
     */
    public function setNombre($nombre) {
        $this->nombre = $nombre;
    }

    /**
     * @return string
     */
    public function getApellido() {
        return $this->apellido;
    }

    /**
     * @param string $apellido
     */
    public function setApellido($apellido) {
        $this->apellido = $apellido;
    }
   
    /**
     *
     * @return string
     */
    public function devolverNombreApellido(){
        return $this->nombre . $this->apellido;
    }
}


This generate the next wsdl file:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="Servicios" targetNamespace="http://prueba.com.ar/" xmlns:tns="http://prueba.com.ar/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://prueba.com.ar/">
      <xsd:complexType name="StringArray">
        <xsd:sequence>
          <xsd:element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StringArrayElement" type="tns:StringArray"/>
      <xsd:complexType name="Persona">
        <xsd:sequence>
          <xsd:element name="nombre" type="xsd:string"/>
          <xsd:element name="apellido" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PersonaElement" type="tns:Persona"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:portType name="ServiciosPortType">
    <wsdl:operation name="ConvertirString" parameterOrder="cadena">
      <wsdl:input message="tns:ConvertirStringRequest"/>
      <wsdl:output message="tns:ConvertirStringResponse"/>
    </wsdl:operation>
    <wsdl:operation name="String" parameterOrder="cadena">
      <wsdl:input message="tns:StringRequest"/>
      <wsdl:output message="tns:StringResponse"/>
    </wsdl:operation>
    <wsdl:operation name="CrearPersona" parameterOrder="nombre apellido edad">
      <wsdl:input message="tns:CrearPersonaRequest"/>
      <wsdl:output message="tns:CrearPersonaResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ServiciosBinding" type="tns:ServiciosPortType">
    <soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ConvertirString">
      <soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://prueba.com.ar/ConvertirString" style="rpc"/>
      <wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="cadena" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:input>
      <wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="String">
      <soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://prueba.com.ar/String" style="rpc"/>
      <wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="cadena" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:input>
      <wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="CrearPersona">
      <soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://prueba.com.ar/CrearPersona" style="rpc"/>
      <wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="nombre apellido edad" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:input>
      <wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://prueba.com.ar/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:message name="ConvertirStringRequest">
    <wsdl:part name="cadena" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="ConvertirStringResponse">
    <wsdl:part name="result" type="tns:StringArray"/>
  </wsdl:message>
  <wsdl:message name="StringRequest">
    <wsdl:part name="cadena" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="StringResponse">
    <wsdl:part name="result" type="xsd:string"/>
  </wsdl:message>
  <wsdl:message name="CrearPersonaRequest">
    <wsdl:part name="nombre" type="xsd:string"/>
    <wsdl:part name="apellido" type="xsd:string"/>
    <wsdl:part name="edad" type="xsd:int"/>
  </wsdl:message>
  <wsdl:message name="CrearPersonaResponse">
    <wsdl:part name="result" type="tns:Persona"/>
  </wsdl:message>
  <wsdl:service xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ServiciosService">
    <wsdl:port xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ServiciosPort" binding="tns:ServiciosBinding">
      <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://prueba.com.ar/Servicios.php"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


the app.yml.
Code: Select all
# your environment for webservice mode
soap:
  # enable the `ckSoapParameterFilter`
  enable_soap_parameter: on
  ck_web_service_plugin:
    # the location of your wsdl file
    wsdl: %SF_WEB_DIR%/Servicios.wsdl
    # the class that will be registered as handler for webservice requests
    handler: ServiciosHandler
    soap_options:
      classmap:
        # mapping of wsdl types to PHP types
        StringArray: ckGenericArray
        Persona: ckGenericObjectAdapter_Persona


In the wsdl file between this lines.
</wsdl:types>
here
<wsdl:portType name="ServiciosPortType">

should show the methods of the class person?
Like this(e.g. is the other wsdl):
Code: Select all
<message name="__construct">
<part name="p1" type="xsd:string"/>
</message>
<message name="__constructResponse"/>
<message name="makeArray"/>
<message name="makeArrayResponse"/>

The soap client generate the class Persona whit your properties (or variables) but don't generate the methods.
gepp81
Junior Member
 
Posts: 3
Joined: Wed Jun 22, 2011 4:12 pm