piotrooo / wsdl-creator Goto Github PK
View Code? Open in Web Editor NEWPHP WSDL Creator using PHPdoc (annotations, reflections).
License: MIT License
PHP WSDL Creator using PHPdoc (annotations, reflections).
License: MIT License
Tests should be run in Actions
Hello,
I am trying to generate wsdl for a method which rteturn complex type
so i added this line
as if i added this @classname=WSAccount
it told me that WSAccount this class not found
but now after adding namespace it generates it and give element name App\Services\WSAccount
Please I need any help in this am i do some thing wrong ?
Hi,
pls how to return Doctrine entity from a WS method?
If I have a class that I want to generate a WSDL for, and it has a namespace, the resulting targetNamespace in the WSDL will generate an invalid URI.
For example
namespace App\Controller;
use WSDL\WSDLCreator;
$wsdl = new WSDLCreator('\App\Controller\ExampleSoapServer', 'http://localhost/ExampleSoapServer.php');
$wsdl->setNamespace('http://localhost/');
$wsdl->renderWSDL();
class ExampleSoapServer {
...
}
generates
<definitions
name="\App\Controller\ExampleSoapServer"
targetNamespace="http://localhost/\app\controller\examplesoapserver"
xmlns:tns="http://localhost/\app\controller\examplesoapserver"
....
Either the namespace should be stripped from the end class name, or the slashes in the fully qualified class name should be converted for use in the URI, and the leading slash removed, so there isn't a double slash.
First I not speak Inglish, apology my writing.
This library has been useful for my, but have several features than not work for my.
In the class DocumentLiteralWrapped
$args = $this->_parseArgs($args, $parameters);
alway return emty array and I comment this line and work.
$obj = new stdClass();
$obj->$returnVariable = $return;
return $obj;
Not work ok, I renplace with.
return array($returnVariable =>$return);
and work.
In documentation you write ->setBindingStyle(new DocumentLiteralWrapped()); but not work for my.
Not return xml with the wsdl struct.
I was just rounding out my understanding of the document/literal type, and I saw that you have a definition for DocumentLiteralWrapped
but that WSDL generation does not follow the conventions of this method (ref: http://www.ibm.com/developerworks/library/ws-usagewsdl/ and http://atmanes.blogspot.com.au/2005/03/wrapped-documentliteral-convention.html).
Those conventions are:
I'm not sure about item 3, because I've only done work with the wrapper array, and haven't looked at the object array, or object, to see what XML that produces.
However, items 4 and 5 definitely fail.
In my working code, where I have a methods called getAuthor and getAuthors, I would expect the element attribute on the input message parts to be getAuthor and getAuthors respectively. Instead, they are getAuthorRequestParameters, and getAuthorsRequestParameters. That's item 4.
And for item 5, I would expect the element attribute on the output message parts to be getAuthorResponse and getAuthorsResponse respectively. However, they are getAuthorResponseParameters and getAuthorsResponseParameters for the two operations.
I'll do some work on items 4 and 5, and submit a pull request when I'm done.
I am currently investigating, whether I can replace the outdated nusoap library with yours.
However I find one thing alarming in my test implementation.
The application is rather large, so there are many functions available to soap, some have the same parameter names.
The generated wsdl looks like this:
<xsd:element name="login" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element name="login" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/>
So I have elements defined multiple times, hopefully all of them with the same type, so it might not cause a real problem. But it might also mean, that I cannot use this library for my purpose.
Wouldn't it be better to not define simple types on a global level?
Annotations should be cached for performance issue.
I have this error when try get the wsdl from http://localhost/servicios_pesona/server.php?wsdl.
Fatal error: Class 'WSDL\XML\Styles\Style' not found in /var/www/servicios_pesona/wsdl_creator/XML/Styles/DocumentLiteralWrapped.php on line 14
My file server.php
<?php
include_once 'wsdl_creator/DocumentLiteralWrapper.php';
include_once 'wsdl_creator/WSDLCreator.php';
include_once 'wsdl_creator/XML/Styles/DocumentLiteralWrapped.php';
$wsdl = new WSDLCreator('Persona', 'http://localhost/servicios_pesona/persona_soap.php');
$wsdl->setNamespace("http://www.servicios_persona.com/")->setBindingStyle(new DocumentLiteralWrapped());
if (isset($_GET['wsdl'])) {
$wsdl->renderWSDL();
exit;
}
$wsdl->renderWSDLService();
$server = new SoapServer('http://localhost/servicios_pesona/server.php?wsdl', array(
'uri' => $wsdl->getNamespaceWithSanitizedClass(),
'location' => $wsdl->getLocation(),
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL
));
$server->setObject(new DocumentLiteralWrapper(new ObjectSoapServer()));
$server->handle();
I use from php alone, without Symfony, i can do this?
I have the following method signature I want to meet:
DetailedInfoResponse[] userInfo (String secretKey, DetailedInfoRequest[] requests)
Both DetailedInfoResponse and DetailedInfoRequest are objects that have their own properties. With the current syntax, how can I define the class?;
I've tried the following and it works but the type is generalized to "ns:ArrayOfRequests".
* @WebMethod
* @WebParam(param="object[] $requests { int $correlationNumber string $token }",header=false)
* @WebParam(param="string $secretKey",header=false)
* @WebResult(param="object[] $reponse{ int $correlationNumber string $userId }")
WSDL output:
<definitions name="RGS" targetNamespace="/"><types><xsd:schema targetNamespace="https://rgs.com"><xsd:complexType name="ArrayOfRequests"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:Request[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:element name="Request" nillable="true" type="ns:Request"/><xsd:complexType name="Request"><xsd:sequence><xsd:element name="correlationNumber" type="xsd:int"/><xsd:element name="token" type="xsd:string"/></xsd:sequence></xsd:complexType><xsd:complexType name="ArrayOfReponse"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:Reponse[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:element name="Reponse" nillable="true" type="ns:Reponse"/><xsd:complexType name="Reponse"><xsd:sequence><xsd:element name="correlationNumber" type="xsd:int"/><xsd:element name="userId" type="xsd:string"/></xsd:sequence></xsd:complexType></xsd:schema></types><message name="userInfoRequest"><part name="requests" type="ns:ArrayOfRequests"/><part name="secretKey" type="xsd:string"/></message><message name="userInfoResponse"><part name="reponse" type="ns:ArrayOfReponse"/></message><portType name="RGSPortType"><operation name="userInfo"><input message="tns:userInfoRequest"/><output message="tns:userInfoResponse"/></operation></portType><binding name="RGSBinding" type="tns:RGSPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="userInfo"><soap:operation soapAction="//#userInfo"/><input><soap:body use="literal" namespace="/"/></input><output><soap:body use="literal" namespace="/"/></output></operation></binding><service name="RGSService"><port name="RGSPort" binding="tns:RGSBinding"><soap:address location="/soap-server"/></port></service></definitions>
If I do the following then the definitions of UserInfoRequest and UserInfoResponse are excluded however the types are as I expect them.
* @WebMethod
* @WebParam(param="UserInfoRequest[] $requests { int $correlationNumber string $token }",header=false)
* @WebParam(param="string $secretKey",header=false)
* @WebResult(param="UserInfoResponse[] $reponse{ int $correlationNumber string $userId }")
WSDL output:
<definitions name="RGS" targetNamespace="/"><types><xsd:schema targetNamespace="https://rgs.com"><xsd:complexType name="ArrayOfRequests"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="xsd:UserInfoRequest[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:complexType name="ArrayOfReponse"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="xsd:UserInfoResponse[]"/></xsd:restriction></xsd:complexContent></xsd:complexType></xsd:schema></types><message name="userInfoRequest"><part name="requests" type="ns:ArrayOfRequests"/><part name="secretKey" type="xsd:string"/></message><message name="userInfoResponse"><part name="reponse" type="ns:ArrayOfReponse"/></message><portType name="RGSPortType"><operation name="userInfo"><input message="tns:userInfoRequest"/><output message="tns:userInfoResponse"/></operation></portType><binding name="RGSBinding" type="tns:RGSPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="userInfo"><soap:operation soapAction="//#userInfo"/><input><soap:body use="literal" namespace="/"/></input><output><soap:body use="literal" namespace="/"/></output></operation></binding><service name="RGSService"><port name="RGSPort" binding="tns:RGSBinding"><soap:address location="/soap-server"/></port></service></definitions>
I tried looking in the documentation and unit test but could not find anything.
Thanks in advance for your help!
Is there any plan to release what is now on master
branch?
On 2.0 tag, there is a hard dependency on obsolete version of doctrine/annotations
package version.
Thanks for a great library.
Hi,
I have a problem with this WSDL http://dev.ugglapraktiken.se/api/flexpay/?wsdl.
The placeOrder-method multiple parameters and two of them are of the wrapper type. The problem is that inly the last wrapper type is rendered as a complex type in the WSDL. The function definition and markdown looks like this:
/**
* Place an order
*
* @param string $apiUser
* @param string $apiKey
* @param wrapper $user @className=Customer
* @param wrapper $purchase @className=Purchase
* @return wrapper $purchaseResult @className=PurchaseResult
*/
public function placeOrder($apiuser = null, $apikey = null, $user = null, $purchase = null) {
// Some code
}
If I change the order of the wrapped parameters, the Customer-object is rendered instead.
The sever-code looks like this:
use WSDL\DocumentLiteralWrapper;
use WSDL\WSDLCreator;
use WSDL\XML\Styles\DocumentLiteralWrapped;
$wsdl = new WSDLCreator("FlexpayUggla", __URL__ . "/api/flexpay");
$wsdl->setBindingStyle(new DocumentLiteralWrapped());
$wsdl->setNamespace(__URL__);
if (isset($_GET["wsdl"])) {
$wsdl->renderWSDL();
exit;
}
//$wsdl->renderWSDLService();
$server = new SoapServer(__URL__ . "/api/flexpay?wsdl", array(
"uri" => $wsdl->getNamespaceWithSanitizedClass(),
"location" => $wsdl->getLocation(),
"style" => SOAP_DOCUMENT,
"use" => SOAP_LITERAL
));
$server->setClass(new DocumentLiteralWrapped(new FlexpayUggla()));
$server->handle();
Thank you in advance!
hello sir,
congratulation on the amazing work
i had a question please
can i return the output to be like that
object(stdClass)#2 (3) { ["id"]=> int(1127) ["accountNumber"]=> string(5) "10995" ["lastModification"]=> string(19) "2017-07-02 11:42:59" }
i mean std object instead of json
thank you so much i do really appreciate any help in this
This is a very small issue, but I noticed in composer.json
that your author.email is "[email protected]". Did you mean @gmail.com?
Add GitHub features:
Hi Piotrooo:
I need create a complex type in my wsdl definition:
<xs:complexType name="casillaValorWebVO">
<xs:sequence>
<xs:element minOccurs="0" name="codCasilla" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="valor" nillable="true" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="valorCompuestoHojas" nillable="true" type="ns1:stringArrayArray"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="valorFecha" nillable="true" type="xs:dateTime"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="valorLogico" nillable="true" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="enviarDatos">
<xs:sequence>
<xs:element minOccurs="0" name="Rue" type="xs:string"/>
<xs:element minOccurs="0" name="ProcedimientoWebVO" type="tns:procedimientoWebVO"/>
<xs:element minOccurs="0" name="Modelo" type="xs:string"/>
<xs:element name="Version" type="xs:int"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="CasillaValorWebVO" type="tns:casillaValorWebVO"/>
</xs:sequence>
</xs:complexType>
ItΒ΄s possible?
This is mine code source:
``
class WebServiceController extends Controller
{
/**
``
But the wdsl generate is :
<types>
<xsd:schema xmlns="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types" targetNamespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types">
<xsd:complexType name="ArrayOfCasillaValorWebVO">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:GestorRseHttpControllersCasillaValorWebVO[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="GestorRseHttpControllersCasillaValorWebVO">
<xsd:sequence>
<xsd:element name="codCasilla" type="xsd:string"/>
<xsd:element name="valor" type="xsd:string"/>
<xsd:element name="valorFecha" type="xsd:datetime"/>
<xsd:element name="valorLogico" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="GestorRseHttpControllersCasillaValorWebVO" nillable="true" type="ns:GestorRseHttpControllersCasillaValorWebVO"/>
<xsd:complexType name="EnviarDatos">
<xsd:sequence>
<xsd:element name="casillaValorWebVO" type="ns:ArrayOfCasillaValorWebVO"/>
<xsd:element name="rue" type="xsd:string"/>
<xsd:element name="modelo" type="xsd:string"/>
<xsd:element name="version" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="EnviarDatos" nillable="true" type="ns:EnviarDatos"/>
</xsd:schema>
</types>
WSDL creator add the class path GestorRseHttpControllersCasillaValorWebVO and my webservice clients send
soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller">
<soapenv:Header/>
<soapenv:Body>
<web:altaSolicitudAuditor soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<typ:EnviarDatos xsi:type="typ:EnviarDatos" xmlns:typ="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types">
<codigoModelo xmlns="">003</codigoModelo>
<version >1</version>
<rue>13231231223111111</rue>
<casillaValorWebVO>
<codCasilla>0</codCasilla>
<valor>0032077700677</valor>
</casillaValorWebVO>
<casillaValorWebVO>
<codCasilla>1</codCasilla>
<valor>3635117767227137777171</valor>
</casillaValorWebVO>
<casillaValorWebVO>
<codCasilla>2</codCasilla>
<valor/>
</casillaValorWebVO>
<casillaValorWebVO>
<codCasilla>10</codCasilla>
<valor>987654321</valor>
</casillaValorWebVO>
<casillaValorWebVO>
<codCasilla>11</codCasilla>
<valor>A1</valor>
</casillaValorWebVO>
<casillaValorWebVO>
<codCasilla>12</codCasilla>
<valor>22/10/2013</valor>
</casillaValorWebVO>
</typ:EnviarDatos>
</web:altaSolicitudAuditor>
</soapenv:Body>
</soapenv:Envelope>
casillaValorWebVO not found in my method class.
can you help me!! I am working with Laravel 5.2
Thanks.
I'am trying to embeed an array of Simple types inside a response, as this:
class SetPoliciesResponse extends Response {
/**
* @type int[]
*/
public $PolicyIds = array();
}
The parent class:
abstract class Response {
/**
*
* @type string
*/
public $Id;
/**
*
* @type string
*/
public $Status;
/**
*
* @type string
*/
public $StartTime;
/**
*
* @type string
*/
public $EndTime;
/**
*
* @type integer
*/
public $ErrorCode;
/**
*
* @type string
*/
public $ErrorString;
/**
*
* @type string
*/
public $WarningString;
}
On the Server class:
/**
* @return wrapper $Response @className=SetPoliciesResponse
*/
But I am getting this:
<xsd:element name="SetPoliciesResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="PolicyIds" type="xsd:int"/>
<xsd:element name="Id" type="xsd:string"/>
<xsd:element name="Status" type="xsd:string"/>
<xsd:element name="StartTime" type="xsd:string"/>
<xsd:element name="EndTime" type="xsd:string"/>
<xsd:element name="ErrorCode" type="xsd:integer"/>
<xsd:element name="ErrorString" type="xsd:string"/>
<xsd:element name="WarningString" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
I am doing something wrong? There is any markup that I am lacking?
Thanks!
hello, now I want to create a wsdl for sap .
// create wsdl
include 'wsdl-creator/vendor/autoload.php';
include 'ServiceOrder.php';
use WSDL\WSDLCreator;
if(isset($_GET['wsdl'])) {
$wsdl = new WSDL\WSDLCreator('ServiceOrder','http://lenovo.local.com/bin/soap/ServiceOrderServer.php');
$wsdl->renderWSDL();
}
and i get a wsdl file
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ServiceOrder" targetNamespace="http://example.com/serviceorder" xmlns:tns="http://example.com/serviceorder" 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="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://example.com/serviceorder/types">
<types>
<xsd:schema targetNamespace="http://example.com/serviceorder/types" xmlns="http://example.com/serviceorder/types">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:complexType name="ServiceOrder">
<xsd:sequence>
<xsd:element name="vendor" type="xsd:string"/>
<xsd:element name="cciName" type="xsd:string"/>
<xsd:element name="cityOfCci" type="xsd:string"/>
<xsd:element name="stateOfCci" type="xsd:string"/>
<xsd:element name="customerName" type="xsd:string"/>
<xsd:element name="mobileNumber" type="xsd:string"/>
<xsd:element name="email" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
<xsd:element name="modelNumber" type="xsd:string"/>
<xsd:element name="serialNumber" type="xsd:string"/>
<xsd:element name="imei1" type="xsd:string"/>
<xsd:element name="imei2" type="xsd:string"/>
<xsd:element name="purchaseDate" type="xsd:string"/>
<xsd:element name="warrantyEndDate" type="xsd:string"/>
<xsd:element name="entitlementCheck" type="xsd:string"/>
<xsd:element name="customerReportProblemDetails" type="xsd:string"/>
<xsd:element name="createDate" type="xsd:string"/>
<xsd:element name="customerCarryInDate" type="xsd:string"/>
<xsd:element name="repairFinishDate" type="xsd:string"/>
<xsd:element name="defectivePartName" type="xsd:string"/>
<xsd:element name="replacePartName" type="xsd:string"/>
<xsd:element name="soNumber" type="xsd:string"/>
<xsd:element name="soStatus" type="xsd:string"/>
<xsd:element name="cidStatus" type="xsd:string"/>
<xsd:element name="soType" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ServiceOrder" nillable="true" type="ns:ServiceOrder"/>
</xsd:schema>
</types>
<message name="getManySOInfoRequest">
<part name="imei" type="xsd:string"/>
<part name="serialNumber" type="xsd:string"/>
<part name="customerName" type="xsd:string"/>
<part name="phone" type="xsd:string"/>
<part name="email" type="xsd:string"/>
<part name="soNumber" type="xsd:string"/>
</message>
<message name="getManySOInfoResponse">
<part name="serviceOrder" element="ns:ServiceOrder"/>
</message>
<portType name="ServiceOrderPortType">
<operation name="getManySOInfo">
<input message="tns:getManySOInfoRequest"/>
<output message="tns:getManySOInfoResponse"/>
</operation>
</portType>
<binding name="ServiceOrderBinding" type="tns:ServiceOrderPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getManySOInfo">
<soap:operation soapAction="http://example.com/serviceorder/#getManySOInfo"/>
<input>
<soap:body use="literal" namespace="http://example.com/serviceorder"/>
</input>
<output>
<soap:body use="literal" namespace="http://example.com/serviceorder"/>
</output>
</operation>
</binding>
<service name="ServiceOrderService">
<port name="ServiceOrderPort" binding="tns:ServiceOrderBinding">
<soap:address location="http://crmdemo.maitrox.com/mgs/bin/soap2/ServiceOrderServer.php"/>
</port>
</service>
</definitions>
they use sap call our webservice
but get a error
Element '{http://example.com/serviceorder/types}ServiceOrder' missing
i want to solve this problem , can you help me ?
@rhelms current I added clients to testing generated wsdl. Almost all things are ok, but is problem with arrays in requests. I think your changes make some issues with it. For properly arrays is needed to construct wsdl like:
<xsd:complexType name="ArrayOfEmployees">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" arrayType="ns:Employee[]" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
and this piece of wsdl generate correct array of employees.
But after changes with Document literal wrapper it products:
<xsd:complexType name="ArrayOfEmployeesList">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="employeesList" nillable="true" type="ns:Employee" />
</xsd:sequence>
</xsd:complexType>
which generates something like this:
stdClass Object
(
[employeesList] => Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)
[1] => stdClass Object
(
[id] => 2
[department] => Logistic
)
)
)
and this is incorrect array, must be like this:
Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)
[1] => stdClass Object
(
[id] => 2
[department] => Logistic
)
)
Have you any idea how to fix it?
You can test clients using shell command ./clinet
in wsdl-creator/examples/Clients
I have a problem , I need to put together a WSDL with the following structure:
<soap:Body>
<SetAvailabilityList>
<classificationList>
<ClassificationAvailability>
<AcommodationAmount>int</AcommodationAmount>
<StopSale>boolean</StopSale>
<AvailabilityBlock>boolean</AvailabilityBlock>
<AvailabilityDateFrom>dateTime</AvailabilityDateFrom>
<AvailabilityDateTo>dateTime</AvailabilityDateTo>
</ClassificationAvailability>
<ClassificationAvailability>
<AcommodationAmount>int</AcommodationAmount>
<StopSale>boolean</StopSale>
<AvailabilityBlock>boolean</AvailabilityBlock>
<AvailabilityDateFrom>dateTime</AvailabilityDateFrom>
<AvailabilityDateTo>dateTime</AvailabilityDateTo>
</ClassificationAvailability>
</classificationList>
</SetAvailabilityList>
</soap:Body>
I'm doing well
/**
* @desc class
* @param object $classificationList @(object=$ClassificationAvailability @int=$AcommodationAmount)
* @return array $SetAvailabilityListResult
*/
public function SetAvailabilityList($classificationList)
{
}
See title..
How :)
Hi,
I am using this generator quite successfully with PHP SOAP clients.
But I am having problems in visual studio 2013. I've tried to Google the issue, but the suggestions and solutions tend to go over my head.
When generating the proxies, visual studio issues this warning which I've included in screenshot below.
But I can can make the call without triggering an exception but the returned value is always null.
Maybe there is a problem with the namespaces or with the SOAP style. I read in many posts that rpc/literal is not a common combination.
You can get the generated wsdl and description from
http://conscalc.elxws7.com/ConsCalc/Server.php?wsdl and
http://conscalc.elxws7.com/ConsCalc/Server.php?desc
Is it possible to define soap:header in WSDL file as required?
@rhelms there is another issue. I use document literal wrapped, this is definition of method:
/**
* @param string $name
* @param int $age
* @return string $nameWithAge
*/
public function getNameWithAge($name, $age)
{
return 'Your name is: ' . $name . ' and you have ' . $age . ' years old';
}
When I call this method like this:
$response = $soapClient->getNameWithAge('john', 23);
Nothing happen. Params $name
and $age
are empty. But when I change method to:
/**
* @param string $name
* @param int $age
* @return string $nameWithAge
*/
public function getNameWithAge($params)
{
return 'Your name is: ' . $params->name . ' and you have ' . $params->age . ' years old';
}
and call method:
$params = new stdClass();
$params->name = 'john';
$params->age = 5;
$response = $soapClient->getNameWithAge($params);
everything is working.
I think in DocumentLiteralWrapper
must be a parser for input params which allows to call method with two parameters as it is in first example of method definition. Or there is another way to call this method using two params - as in the PHPDoc.
Hi
I've got a question about how to correctly generate an array of type.
I've got a getAuthors() soap function that I want to return an array of Authors.
On the function, I use
@return wrapper[] $authors @className=\App\Soap\Author
and on the function, I return an array of \App\Soap\Author objects.
However, when I use SoapUI to get the result, I get the following
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://intalio-webservice.reubenh3.dev.otw.internal/app/soap/intaliowebservicesoapserver" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getAuthorsResponse>
<authors>
<SOAP-ENC:Struct>
<id>1</id>
<name>Doug Tidwell</name>
<created/>
<modified/>
</SOAP-ENC:Struct>
<SOAP-ENC:Struct>
<id>2</id>
<name>Reuben Helms</name>
<created/>
<modified/>
</SOAP-ENC:Struct>
</authors>
</ns1:getAuthorsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
In place of SOAP-ENC:Struct, I would like to see .
Whilst this might be outside the bounds of the WSDL creator, I was wondering if you'd know what would need to happen, for this to be interpreted correctly by SoapServer.
I currently have a classmap on the SoapServer, that maps author to \App\Soap\Author, and that works great for a getAuthor function that returns a single author.
Hello, i'm verry sorry but, I've installed the package via composer from here
https://packagist.org/packages/piotrooo/wsdl-creator
and now I would like to try o generate a wsdl from my class file ...
i've tested to changed included class in examples\document_literal\service.php
but nothing change in the generated wsdl ...
I'm sorry but is it possible to have a quick start example ? which I can use with my own class ?
thanks a lot
I want to generate something like this you can help me
? ?this is my class soap
class ServerController extends Controller
{
public function __construct() {
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 0);
ini_set('default_socket_timeout', 300);
ini_set('max_execution_time', 0);
}
public function wsdlCreator()
{
$location = url('url');
$namespace = $location;
$class = "\\App\\Http\\Controllers\\class";
$wsdl = new WSDLCreator($class, $location);
$wsdl->setBindingStyle(new RpcEncoded());
// $wsdl->setBindingStyle(new DocumentLiteralWrapped());
$wsdl->setNamespace($namespace);
if (isset($_GET['wsdl'])) {
$wsdl->renderWSDL();
exit;
}
$wsdl->renderWSDLService();
$server = new \SoapServer(
url('url?wsdl'),
array(
'exceptions' => 1,
'trace' => 1,
)
);
$server->setClass('App\Http\Controllers\class');
$server->handle();
exit;
}
}
Is there a way to remove the xsd:type from the return ?
$wsdl = new WSDL\WSDLCreator('\Namespace\ClassName', 'http://localhost/webservice.php');
generates wrong xml namspace:
xmlns:tns="http://test.net/\namespace\classname"
Try to use recent PHPUnit loaded from composer.
Hi there,
Thanks for you wunderfull package!
Can you please don't make use of dev dependancies?
"letsdrink/ouzo-goodies": "dev-master",
"doctrine/annotations": "1.7.x-dev"
doctrine/annotations is now on v1.7.0. And maybe you van make a "normal" version of the current dev-master of the letsdrink/ouzo-goodies?
Thanks again!
Tim
Magic methods shuld be removed from WSDL.
/**
- @webmethod
- @param object $enviarSolicitud @(wrapper[] $CasillaValorWebVO @classname=\GestorRse\Http\Controllers\CasillaValorWebVO) @int=$modelo @(wrapper[] $DocAdjuntoWebVO @classname=\GestorRse\Http\Controllers\DocAdjuntoWebVO) @int=$version @(wrapper $ProcedimientoWebVO @classname=\GestorRse\Http\Controllers\ProcedimientoWebVO)
- @return string $returnInfo
*/
I need to create a method that has as a parameter an object composed of 1 class, 2 class array and two integer values. But only get the first class described in the method, other values ββdoes not recover.
There is a problem as a parameter to define such a complex object?
In wsdl generated, not describe more types than $CasillaValorWebVO:
<definitions xmlns:tns="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller" 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="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types" name="WebServiceController" targetNamespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller">
<types>
<xsd:schema xmlns="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types" targetNamespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/types">
<xsd:complexType name="ArrayOfCasillaValorWebVO">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:GestorRseHttpControllersCasillaValorWebVO[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="GestorRseHttpControllersCasillaValorWebVO">
<xsd:sequence>
<xsd:element name="codCasilla" type="xsd:string"/>
<xsd:element name="valor" type="xsd:string"/>
<xsd:element name="valorFecha" type="xsd:datetime"/>
<xsd:element name="valorLogico" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="GestorRseHttpControllersCasillaValorWebVO" nillable="true" type="ns:GestorRseHttpControllersCasillaValorWebVO"/>
<xsd:complexType name="EnviarSolicitud">
<xsd:sequence>
<xsd:element name="CasillaValorWebVO" type="ns:ArrayOfCasillaValorWebVO"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="EnviarSolicitud" nillable="true" type="ns:EnviarSolicitud"/>
</xsd:schema>
</types>
<message name="enviarSolicitudRequest">
<part name="enviarSolicitud" element="ns:EnviarSolicitud"/>
</message>
<message name="enviarSolicitudResponse">
<part name="returnInfo" type="xsd:string"/>
</message>
<message name="verificarCodigoORSERequest">
<part name="nif" type="xsd:string"/>
<part name="codigoORSE" type="xsd:string"/>
</message>
<message name="verificarCodigoORSEResponse">
<part name="returnInfo" type="xsd:string"/>
</message>
<portType name="WebServiceControllerPortType">
<operation name="enviarSolicitud">
<input message="tns:enviarSolicitudRequest"/>
<output message="tns:enviarSolicitudResponse"/>
</operation>
<operation name="verificarCodigoORSE">
<input message="tns:verificarCodigoORSERequest"/>
<output message="tns:verificarCodigoORSEResponse"/>
</operation>
</portType>
<binding name="WebServiceControllerBinding" type="tns:WebServiceControllerPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="enviarSolicitud">
<soap:operation soapAction="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/#enviarSolicitud"/>
<input>
<soap:body use="encoded" namespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="verificarCodigoORSE">
<soap:operation soapAction="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller/#verificarCodigoORSE"/>
<input>
<soap:body use="encoded" namespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://localhost/gestor_rse/public/servicio/gestorrse/http/controllers/webservicecontroller" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="WebServiceControllerService">
<port name="WebServiceControllerPort" binding="tns:WebServiceControllerBinding">
<soap:address location="http://localhost/gestor_rse/public/servicio"/>
</port>
</service>
</definitions>
/**
* @WebMethod
* @WebParam(param="string $token", header=true)
* @WebParam(param="object $user { string $name int $age }")
* @WebResult(param="object $userContext { string $token int $id object $userInfo { string $name int $age } }")
*/
public function getUserContext($token, $user)
{
return $user;
}
The code above doesn't work.
My Soap client return Too few arguments to function getUserContext(), 1 passed and exactly 2 expected
It looks like the $token variable is not handle.
@piotrooo do you know what can be a reason? I based on your test files
When generating a WSDL that is Rpc Encoded, encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
must appear on the soap:body elements in the binding
sections.
Similar issue can be shown here [http://www.herongyang.com/WSDL/PHP-SOAP-Call-RPC-Method-Based-Web-Service.html]
If this is missing, then the following SOAP Fault will be generated when the request is handled (when the WSDL is referenced in the SoapServer):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This function is only supported when PHP is installed as an Apache module.
In WSDLCreator.php line 85 "public function renderWSDLService()"
Remplace $headers = apache_request_headers(); with:
if (!function_exists('apache_request_headers')) {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach ($_SERVER as $key => $val) {
if (preg_match($rx_http, $key)) {
$arh_key = preg_replace($rx_http, '', $key);
$rx_matches = array();
// do some nasty string manipulations to restore the original letter case
// this should work in most cases
$rx_matches = explode('_', $arh_key);
if (count($rx_matches) > 0 and strlen($arh_key) > 2) {
foreach ($rx_matches as $ak_key => $ak_val)
$rx_matches[$ak_key] = ucfirst($ak_val);
$arh_key = implode('-', $rx_matches);
}
$arh[$arh_key] = $val;
}
}
$headers = $arh;
}else{
$headers = apache_request_headers();
}
Source: http://stackoverflow.com/questions/2916232/call-to-undefined-function-apache-request-headers
Hello,
i was trying to try out the wsdl creator but encountered a missing file in the repository:
require_once 'vendor/autoload.php';
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.