besimple / besimplesoap Goto Github PK
View Code? Open in Web Editor NEWNOT MAINTAINED - Build SOAP and WSDL based web services
Home Page: http://besim.pl
NOT MAINTAINED - Build SOAP and WSDL based web services
Home Page: http://besim.pl
If I specify a proxy, it does not work. Because, in file "BeSimple\SoapClient\Curl.php" Line 86, missing a colon, between proxy host and proxy port
$proxyHost = $options['proxy_host'].':'.(isset($options['proxy_port']) ? $options['proxy_port'] : 8080);
Hey there,
I implemented the DemoController using the BeSimpleSoapBundle for Symfony, described by the step-by-step instructions on http://besim.pl/SoapBundle/index.html.
When I send a simple Soap-POST-Request it returns an error.
Soap-Request
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<hello xmlns="http://localhost:8000/ws/DemoApi/1.0/">
<name>[string]</name>
</hello>
</Body>
</Envelope>
Soap-Response
<?xml version="1.0" encoding="UTF-8"?>
<error code="500" message="Internal Server Error">
<exception class="Symfony\Component\Debug\Exception\ContextErrorException" message="Notice: Undefined index: HTTP_SOAPACTION in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43">
<traces>
<trace>
at n/a
in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43
</trace>
<trace>
at Symfony\Component\Debug\ErrorHandler->handle('8', 'Undefined index: HTTP_SOAPACTION', '/Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php', '43', array('content' => '&lt;Envelope xmlns=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
&lt;Body&gt;
&lt;hello xmlns=&quot;http://localhost:8000/ws/DemoApi/1.0/&quot;&gt;
&lt;name&gt;[string]&lt;/name&gt;
&lt;/hello&gt;
&lt;/Body&gt;
&lt;/Envelope&gt;', 'version' => '1', 'location' => 'http://127.0.0.1:8000/ws/DemoApi'))
in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43
</trace>
<trace>
at BeSimple\SoapServer\SoapRequest::create('&lt;Envelope xmlns=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
&lt;Body&gt;
&lt;hello xmlns=&quot;http://localhost:8000/ws/DemoApi/1.0/&quot;&gt;
&lt;name&gt;[string]&lt;/name&gt;
&lt;/hello&gt;
&lt;/Body&gt;
&lt;/Envelope&gt;', '1')
in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapServer.php line 70
</trace>
<trace>
at BeSimple\SoapServer\SoapServer->handle('&lt;Envelope xmlns=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
&lt;Body&gt;
&lt;hello xmlns=&quot;http://localhost:8000/ws/DemoApi/1.0/&quot;&gt;
&lt;name&gt;[string]&lt;/name&gt;
&lt;/hello&gt;
&lt;/Body&gt;
&lt;/Envelope&gt;')
in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-bundle/BeSimple/SoapBundle/Controller/SoapWebServiceController.php line 76
</trace>
<trace>
at BeSimple\SoapBundle\Controller\SoapWebServiceController->callAction('DemoApi')
in line
</trace>
<trace>
at call_user_func_array(array(object(SoapWebServiceController), 'CallAction'), array('DemoApi'))
in /Users/r.schulze/Ablage/Code/mini/symfony/code/app/bootstrap.php.cache line 2956
</trace>
<trace>
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /Users/r.schulze/Ablage/Code/mini/symfony/code/app/bootstrap.php.cache line 2918
</trace>
<trace>
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /Users/r.schulze/Ablage/Code/mini/symfony/code/app/bootstrap.php.cache line 3067
</trace>
<trace>
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /Users/r.schulze/Ablage/Code/mini/symfony/code/app/bootstrap.php.cache line 2317
</trace>
<trace>
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /Users/r.schulze/Ablage/Code/mini/symfony/code/web/app_dev.php line 28
</trace>
<trace>
at require('/Users/r.schulze/Ablage/Code/mini/symfony/code/web/app_dev.php')
in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php line 30
</trace>
</traces>
</exception>
</error>
The same error from my symfony log files:
[2014-07-17 12:17:32] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Notice: Undefined index: HTTP_SOAPACTION in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43" at /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException: Notice: Undefined index: HTTP_SOAPACTION in /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php line 43 at /Users/r.schulze/Ablage/Code/mini/symfony/code/vendor/besimple/soap-server/BeSimple/SoapServer/SoapRequest.php:43)"} []
What am I missing?
Kind regards,
Robert
In our company we are using M$ ISA server with NTLM authentication.
Elegant solution:
BeSimple\SoapClient\SoapClientBuilder
public function withProxy($host, $port, $username = null, $password = null, $proxyAuthType = null)
{
$this->soapOptions['proxy_host'] = $host;
$this->soapOptions['proxy_port'] = $port;
if ($username) {
//$this->soapOptions['proxy_login'] = $username;
$this->soapOptions['proxy_user'] = $username;
$this->soapOptions['proxy_password'] = $password;
if ($proxyAuthType) {
$this->soapOptions['extra_options'] = [ 'proxy_auth' => $proxyAuthType ];
}
}
return $this;
}
BeSimple\SoapClient\Curl
public function __construct(array $options = array(), $followLocationMaxRedirects = 10)
{
...
if (isset($options['proxy_user'])) {
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'] . ':' . $options['proxy_password']);
if (isset($options['extra_options']['proxy_auth'])) {
curl_setopt($this->ch, CURLOPT_PROXYAUTH, $options['extra_options']['proxy_auth']);
}
}
...
}
As 189dd1b allows the use within Symfony 3.x but it's not included in any release yet.
To use this package allongside a symfony 3, one must set the requirment to:
"besimple/soap": "0.2.*@dev" while depending on a certain version number is considered more stable.
By adding a version (tag in git) the dependency could become:
"besimple/soap": "0.2.7"
Trying out this bundle and i see it suggests besimple/soap-client
, however the client builder has a hard dependency on this class use BeSimple\SoapClient\SoapClientBuilder as BaseSoapClientBuilder;
This means this should be in your require, not a suggestion. For it to be a suggestion you would have to make it so this class can be replaced by another one.
I'm not sure how exactly to describe what is there now (http://besim.pl/) as I had to translate it but it definitely does not look like documentation of any sort.
My problems is related with this: BeSimple/BeSimpleSoapBundle#29.
I have to process an xml item with a property "accessories" as described here:
<xs:element name="accessories" minOccurs="0">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="accessory">
<xs:complexType>
<xs:sequence>
[...]
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
So the received XML Object is something like:
<accessories>
<accessory>
<description>Bla</description>
</accessory>
[...]
<accessory>
<description>Bla</description>
</accessory>
</accessories>
This is my accessories var definition:
/**
* @var array
* @Soap\ComplexType("Type\Accessory[]")
*/
private $accessories;
BeSimpleSoap is unable to load this collection, returning allways null when I call $object->getAccessories()
If the received XML object were with "item" elements in sequence there's no problem, but I'm not I would be able to change received data as it's from an external system.
I mean, this works and loads...
<accessories>
<item>
<description>Bla</description>
</item>
[...]
<item>
<description>Bla</description>
</item>
</accessories>
Is there something I can do?
Hey, at first, thanks for your bundle.
I had a stupid issue which took me hours to figure out. I had a mapping like this:
/**
* @Soap\ComplexType("\My\Article")
*/
private $articles = array();
The outcome was a response which had the array items in it, but with empty values, resulting in SOAP Failures like this one:
Encoding: object has no 'Id' property
I just noticed that
@Soap\ComplexType("\My\Article")
should be
@Soap\ComplexType("\My\Article[]")
instead, of course :-/
Is there a way to throw an appropriate exception if an array is mapped wrongly as a non-array type? Might save other clumsy people some hours 👍
Firstly I start by telling that you have done grate job with this Bundle :)
Unfortunately we have an issue with our server response on PROD environment in our application. On DEV environment everything is ok – response is correct and is mapping on objects correctly. We try to fix it but with no result…
Maybe I just mention that we have quite similar problem that this described and fixed about 2 years ago:
BeSimple/BeSimpleSoapBundle#18
Because of that we guess that problem may be caused by switch to Symfony 2.3.
But let me describe everything step by step. This is correct request, response and mapped object on our DEV environment:
Request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://****/api/cbz.1.1">
<SOAP-ENV:Body>
<ns1:pobierzTypyBledow>
<hash>testowy_hasha</hash>
</ns1:pobierzTypyBledow>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Resposne:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://****/api/cbz.1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:pobierzTypyBledowResponse>
<return>
<czySukces>false</czySukces>
<bledy>
<item>
<bladId>1060100</bladId>
<opisBledu>Brak zgody o podanym Id</opisBledu>
<dodatkoweInformacje>W systemie brak zgody o Id: %zgoda_id%.</dodatkoweInformacje>
<czas xsi:nil="true"/>
<wersjaSlownika>4</wersjaSlownika>
</item>
<item>
<bladId>1070200</bladId>
<opisBledu>Nieprawid--owy kod hash</opisBledu>
<dodatkoweInformacje>Podano nieprawid--owy kod identyfikuj--cy zewn--trzne aplikacje. Podaj kod hash kt--ry otrzyma----- od administratora systemu.</dodatkoweInformacje>
<czas xsi:nil="true"/>
<wersjaSlownika>4</wersjaSlownika>
</item>
</bledy>
<listaBledow xsi:nil="true"/>
</return>
</ns1:pobierzTypyBledowResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Object:
stdClass Object
(
[czySukces] =>
[bledy] => stdClass Object
(
[item] => Array
(
[0] => stdClass Object
(
[bladId] => 1060100
[opisBledu] => Brak zgody o podanym Id
[dodatkoweInformacje] => W systemie brak zgody o Id: %zgoda_id%.
[czas] =>
[wersjaSlownika] => 4
)
[1] => stdClass Object
(
[bladId] => 1070200
[opisBledu] => Nieprawidłowy kod hash
[dodatkoweInformacje] => Podano nieprawidłowy kod identyfikujący zewnętrzne aplikacje. Podaj kod hash który otrzymałeś od administratora systemu.
[czas] =>
[wersjaSlownika] => 4
)
)
)
[listaBledow] =>
)
And this is what is happening when we switch to PROD:
Request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http:/****/api/cbz.1.1">
<SOAP-ENV:Body>
<ns1:pobierzTypyBledow>
<hash>testowy_hasha</hash>
</ns1:pobierzTypyBledow>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Resposne:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://***/api/cbz.1.1" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:pobierzTypyBledowResponse>
<return>
<czySukces>false</czySukces>
<bledy>
<SOAP-ENC:Struct>
<bladId>1060100</bladId>
<opisBledu>Brak zgody o podanym Id</opisBledu>
<dodatkoweInformacje>W systemie brak zgody o Id: %zgoda_id%.</dodatkoweInformacje>
<czas/>
<wersjaSlownika>4</wersjaSlownika>
</SOAP-ENC:Struct>
<SOAP-ENC:Struct>
<bladId>1070200</bladId>
<opisBledu>Nieprawid--owy kod hash</opisBledu>
<dodatkoweInformacje>Podano nieprawid--owy kod identyfikuj--cy zewn--trzne aplikacje. Podaj kod hash kt--ry otrzyma----- od administratora systemu.</dodatkoweInformacje>
<czas/>
<wersjaSlownika>4</wersjaSlownika>
</SOAP-ENC:Struct>
</bledy>
<listaBledow/>
</return>
</ns1:pobierzTypyBledowResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Object:
stdClass Object
(
[czySukces] =>
[bledy] => stdClass Object
(
)
[listaBledow] => stdClass Object
(
)
)
Our test client (on PROD and DEV):
class SoapClientController extends Controller {
public function pobierzTypyBledowAction() {
$client = $this -> connect();
$this -> print_r($client -> pobierzTypyBledow('testowy_hash'));
}
private function connect() {
return new \SoapClient("http://****/api/cbz.1.1?wsdl", array('cache_wsdl' => WSDL_CACHE_NONE,
'trace' => true,
'exceptions' => true,
'encoding'=>'UTF-8',
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
));
}
}
(Part of) WSDL (on PROD and DEV):
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://***/api/cbz.1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="cbz.1.1" targetNamespace="http://***/api/cbz.1.1">
<portType name="cbz.1.1PortType">
<operation name="pobierzTypyBledow" parameterOrder="hash">
<input message="tns:pobierzTypyBledowRequest"/>
<output message="tns:pobierzTypyBledowResponse"/>
</operation>
</portType>
<binding name="cbz.1.1Binding" type="tns:cbz.1.1PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="pobierzTypyBledow">
<soap:operation soapAction="http://***/api/cbz.1.1pobierzTypyBledow"/>
<input>
<soap:body use="literal" namespace="http://***/api/cbz.1.1" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" parts="hash"/>
</input>
<output>
<soap:body use="literal" namespace="http://***/api/cbz.1.1" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" parts="return"/>
</output>
</operation>
</binding>
<service name="cbz.1.1Service">
<port name="cbz.1.1Port" binding="tns:cbz.1.1Binding">
<soap:address location="http://***/api/cbz.1.1"/>
</port>
</service>
<types>
<xsd:schema targetNamespace="http://***/api/cbz.1.1">
<xsd:complexType name="Cbz.Bundle.SoapBundle.Objects.ObiektBledu">
<xsd:all>
<xsd:element name="bladId" type="xsd:int" nillable="true"/>
<xsd:element name="opisBledu" type="xsd:string" nillable="true"/>
<xsd:element name="dodatkoweInformacje" type="xsd:string" nillable="true"/>
<xsd:element name="czas" type="xsd:dateTime" nillable="true"/>
<xsd:element name="wersjaSlownika" type="xsd:int" nillable="true"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ArrayOfCbz.Bundle.SoapBundle.Objects.ObiektBledu">
<xsd:sequence>
<xsd:element name="item" type="tns:Cbz.Bundle.SoapBundle.Objects.ObiektBledu" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Cbz.Bundle.SoapBundle.Responses.PobierzTypyBledowResponse">
<xsd:all>
<xsd:element name="czySukces" type="xsd:boolean"/>
<xsd:element name="bledy" type="tns:ArrayOfCbz.Bundle.SoapBundle.Objects.ObiektBledu" nillable="true"/>
<xsd:element name="listaBledow" type="tns:ArrayOfCbz.Bundle.SoapBundle.Objects.ObiektBledu" nillable="true"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="pobierzTypyBledowRequest">
<part name="hash" type="xsd:string"/>
</message>
<message name="pobierzTypyBledowResponse">
<part name="return" type="tns:Cbz.Bundle.SoapBundle.Responses.PobierzTypyBledowResponse"/>
</message>
</definitions>
While we were searching for clue we found that response is correct even on PROD environment if we turn debug to TRUE… So we suspect that problem may be caused by DEBUGER not specifically by application environment.
We don’t have any more ideas how to fix it so please help us :)
Hi,
I'm wondering how to throw SOAP fault using your bundle. Also my goal is to be able to have entries in wsdl file for example like this:
<wsdl:fault name="inputException">
<wsdlsoap:fault name="inputException" use="literal"/>
</wsdl:fault>
Thanks in advance,
Daniel
Because of the missing ability to set curl options in the base classes as provided I had to write my own extended version of the classes here.
So I have a SoapClientBuilder that extends BeSimple\SoapClient\SoapClientBuilder and passes the options down stream.
Another class SoapClient that extends BeSimple\SoapClient\SoapClient and replaces the constructor so that it replaces only the $this->curl with my own Curl class.
Another class Curl that extends BeSimple\SoapClient\Curl that would like to set options in $this->ch BUT IT CAN'T BECAUSE YOU HAVE MADE THE $ch PROPERTY PRIVATE.
Making a property private means that no subclass can access it. So you can see into the future to know that nobody who wants to extend your class will need to access that property.
Can you really see into the future?
I would submit a PR for this but I see from the backlog of PRs that nothing is being done to incorporate those. e.g. if you merged #63 this would partially resolve that problem.
Headers are currently set twice: First in \BeSimple\SoapServer\SoapResponse::send() and then in \BeSimple\SoapBundle\Soap\SoapResponse::sendHeaders().
This results in a fatal error with php-fastcgi.
The php native header() function accepts $replace as second parameter. This would override the previously set content types. Unfortunatly this parameter ist set to "false" in \BeSimple\SoapBundle\Soap\SoapResponse::sendHeaders().
Excuse me, that I choose this way throw "Issues" and not "fork & apply my patch". I don't have experience with it, but I do better in future.
It's not pretty, but is functional.
_- repaired configuration parameter: _binding**
- added wrapped parameters nillable support
- added name support for returned value
_SoapBundle_
diff --git a/DependencyInjection/BeSimpleSoapExtension.php b/DependencyInjection/BeSimpleSoapExtension.php
index a0b8c51..f0f4e8d 100644
--- a/DependencyInjection/BeSimpleSoapExtension.php
+++ b/DependencyInjection/BeSimpleSoapExtension.php
@@ -22,6 +22,9 @@ use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+if (!defined('SOAP_LITERAL_WRAPPED')) {
+ define('SOAP_LITERAL_WRAPPED', 3);
+}
/**
* BeSimpleSoapExtension.
*
@@ -35,6 +38,15 @@ class BeSimpleSoapExtension extends Extension
'rpc-literal' => 'rpcliteral',
'document-wrapped' => 'documentwrapped',
);
+ private $styleMap = [
+ 'rpc' => \SOAP_RPC,
+ 'document' => \SOAP_DOCUMENT,
+ ];
+ private $useMap = [
+ 'encoded' => \SOAP_ENCODED,
+ 'literal' => \SOAP_LITERAL,
+ 'wrapped' => \SOAP_LITERAL_WRAPPED,
+ ];
public function load(array $configs, ContainerBuilder $container)
{
@@ -152,7 +164,10 @@ class BeSimpleSoapExtension extends Extension
private function createWebServiceContext(array $config, ContainerBuilder $container)
{
- $bindingSuffix = $this->bindingConfigToServiceSuffixMap[$config['binding']];
+ $bindingSuffix = $this->bindingConfigToServiceSuffixMap[$config['binding']];
+ list($style, $use) = explode('-', $config['binding']);
+ $config['style'] = $this->styleMap[$style];
+ $config['use'] = $this->useMap[$use];
unset($config['binding']);
$contextId = 'besimple.soap.context.'.$config['name'];
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 9374bff..6cfccd4 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -135,8 +135,15 @@ class Configuration
->scalarNode('binding')
->defaultValue('document-wrapped')
->validate()
- ->ifNotInArray(array('rpc-literal', 'document-wrapped'))
- ->thenInvalid("Service binding style has to be either 'rpc-literal' or 'document-wrapped'")
+ ->ifNotInArray([ 'rpc-literal', 'document-wrapped' /*, 'rpc-encoded', , 'document-literal'*/ ])
+ ->thenInvalid("Service binding style has to be either 'rpc-literal' or 'document-wrapped'!"/* or 'rpc-encoded' or 'document-literal' */)
+ ->end()
+ ->end()
+ ->scalarNode('version')
+ ->defaultValue(2)
+ ->validate()
+ ->ifNotInArray([ 1, 2 ])
+ ->thenInvalid("Service protocol version has to be either 1 or 2")
->end()
->end()
->scalarNode('cache_type')
diff --git a/Resources/config/webservice.xml b/Resources/config/webservice.xml
index 343885c..3f44aa2 100644
--- a/Resources/config/webservice.xml
+++ b/Resources/config/webservice.xml
@@ -69,9 +69,21 @@
<service id="besimple.soap.type.repository" class="%besimple.soap.type.repository.class%">
<argument type="service" id="besimple.soap.server.classmap" />
<call method="addXmlNamespace">
+ <argument>xsi</argument>
+ <argument>http://www.w3.org/2001/XMLSchema-instance</argument>
+ </call>
+ <!--<call method="addXmlNamespace">
<argument>xsd</argument>
<argument>http://www.w3.org/2001/XMLSchema</argument>
</call>
+ <call method="addXmlNamespace">
+ <argument>tm</argument>
+ <argument>http://microsoft.com/wsdl/mime/textMatching/</argument>
+ </call>
+ <call method="addXmlNamespace">
+ <argument>mime</argument>
+ <argument>http://schemas.xmlsoap.org/wsdl/mime/</argument>
+ </call>-->
<call method="addType">
<argument>string</argument>
<argument>xsd:string</argument>
diff --git a/ServiceBinding/DocumentLiteralWrappedRequestHeaderMessageBinder.php b/ServiceBinding/DocumentLiteralWrappedRequestHeaderMessageBinder.php
new file mode 100644
index 0000000..639c97d
--- /dev/null
+++ b/ServiceBinding/DocumentLiteralWrappedRequestHeaderMessageBinder.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace BeSimple\SoapBundle\ServiceBinding;
+
+use BeSimple\SoapBundle\ServiceDefinition\Method;
+use BeSimple\SoapCommon\Definition\Type\TypeRepository;
+/**
+ * Description of DocumentLiteralWrappedRequestHeaderBinder
+ *
+ * @author Michal Mičko <[email protected]>
+ */
+class DocumentLiteralWrappedRequestHeaderMessageBinder extends DocumentLiteralWrappedRequestMessageBinder
+{
+ private $header;
+
+ public function setHeader($header)
+ {
+ $this->header = $header;
+ }
+
+ public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
+ {
+ $this->typeRepository = $typeRepository;
+ $headerDefinition = $messageDefinition->getHeaders()->get($this->header);
+
+ return $this->processType($headerDefinition->getType(), $message);
+ }
+}
diff --git a/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php b/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php
index 5d779b0..e734183 100644
--- a/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php
+++ b/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php
@@ -11,14 +11,22 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
+use BeSimple\SoapCommon\Definition\Type\ArrayOfType;
+use BeSimple\SoapCommon\Definition\Type\ComplexType;
+use BeSimple\SoapCommon\Definition\Type\TypeRepository;
+use BeSimple\SoapCommon\Util\MessageBinder;
/**
* @author Christian Kerl <[email protected]>
*/
class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterface
{
- public function processMessage(Method $messageDefinition, $message)
+ protected $typeRepository;
+
+ public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{
+ $this->typeRepository = $typeRepository;
+
if(count($message) > 1) {
throw new \InvalidArgumentException();
}
@@ -26,10 +34,85 @@ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterfa
$result = array();
$message = $message[0];
- foreach($messageDefinition->getArguments() as $argument) {
- $result[$argument->getName()] = $message->{$argument->getName()};
+ foreach($messageDefinition->getInput()->all() as $argument) {
+ $result[$argument->getName()] = $this->processType($argument->getType(), $message->{$argument->getName()});
}
return $result;
}
+
+ protected function processType($phpType, $message)
+ {
+ $isArray = false;
+
+ $type = $this->typeRepository->getType($phpType);
+ if ($type instanceof ArrayOfType) {
+ $isArray = true;
+ $array = array();
+
+ $type = $this->typeRepository->getType($type->get('item')->getType());
+ }
+
+ // @TODO Fix array reference
+ if ($type instanceof ComplexType) {
+ $phpType = $type->getPhpType();
+
+ if ($isArray) {
+ if (isset($message->item)) {
+ foreach ($message->item as $complexType) {
+ $array[] = $this->checkComplexType($phpType, $complexType);
+ }
+
+ // See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29
+ if (in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) {
+ $assocArray = array();
+ foreach ($array as $keyValue) {
+ $assocArray[$keyValue->getKey()] = $keyValue->getValue();
+ }
+
+ $array = $assocArray;
+ }
+ }
+
+ $message = $array;
+ } else {
+ $message = $this->checkComplexType($phpType, $message);
+ }
+ } elseif ($isArray) {
+ if (isset($message->item)) {
+ $message = $message->item;
+ } else {
+ $message = $array;
+ }
+ }
+
+ return $message;
+ }
+
+ protected function checkComplexType($phpType, $message)
+ {
+ $hash = spl_object_hash($message);
+ if (isset($this->messageRefs[$hash])) {
+ return $this->messageRefs[$hash];
+ }
+
+ $this->messageRefs[$hash] = $message;
+
+ $messageBinder = new MessageBinder($message);
+ foreach ($this->typeRepository->getType($phpType)->all() as $type) {
+ $property = $type->getName();
+ $value = $messageBinder->readProperty($property);
+
+ if (null !== $value) {
+ $value = $this->processType($type->getType(), $value);
+
+ $messageBinder->writeProperty($property, $value);
+ } elseif (!$type->isNillable()) {
+ // @TODO use xmlType instead of phpType
+ throw new \SoapFault('SOAP_ERROR_COMPLEX_TYPE', sprintf('"%s:%s" cannot be null.', ucfirst($phpType), $type->getName()));
+ }
+ }
+
+ return $message;
+ }
}
\ No newline at end of file
diff --git a/ServiceBinding/DocumentLiteralWrappedResponseMessageBinder.php b/ServiceBinding/DocumentLiteralWrappedResponseMessageBinder.php
index 21c72e0..d22c02c 100644
--- a/ServiceBinding/DocumentLiteralWrappedResponseMessageBinder.php
+++ b/ServiceBinding/DocumentLiteralWrappedResponseMessageBinder.php
@@ -11,17 +11,100 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
+use BeSimple\SoapCommon\Definition\Type\ArrayOfType;
+use BeSimple\SoapCommon\Definition\Type\ComplexType;
+use BeSimple\SoapCommon\Definition\Type\TypeRepository;
+use BeSimple\SoapCommon\Util\MessageBinder;
/**
* @author Christian Kerl <[email protected]>
*/
class DocumentLiteralWrappedResponseMessageBinder implements MessageBinderInterface
{
- public function processMessage(Method $messageDefinition, $message)
+ public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{
+ $this->typeRepository = $typeRepository;
+
$result = new \stdClass();
- $result->{$messageDefinition->getName().'Result'} = $message;
+ //$result->{$messageDefinition->getName().'Result'} = $message;
+ foreach ($messageDefinition->getOutput()->all() as $name => $part) {
+ //$result->{$name} = $message;
+ $result->{$name} = $this->processType($part->getType(), $message);
+ break; // only one iteration
+ }
return $result;
}
+
+ private function processType($phpType, $message)
+ {
+ $isArray = false;
+
+ $type = $this->typeRepository->getType($phpType);
+ if ($type instanceof ArrayOfType) {
+ $isArray = true;
+
+ $type = $this->typeRepository->getType($type->get('item')->getType());
+ }
+
+ if ($type instanceof ComplexType) {
+ $phpType = $type->getPhpType();
+
+ if ($isArray) {
+ $array = array();
+
+ // See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29
+ if (is_array($message) && in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) {
+ $keyValue = array();
+ foreach ($message as $key => $value) {
+ $keyValue[] = new $phpType($key, $value);
+ }
+
+ $message = $keyValue;
+ }
+
+ foreach ($message as $complexType) {
+ $array[] = $this->checkComplexType($phpType, $complexType);
+ }
+
+ $message = $array;
+ } else {
+ $message = $this->checkComplexType($phpType, $message);
+ }
+ }
+
+ return $message;
+ }
+
+ private function checkComplexType($phpType, $message)
+ {
+ $hash = spl_object_hash($message);
+ if (isset($this->messageRefs[$hash])) {
+ return $this->messageRefs[$hash];
+ }
+
+ $this->messageRefs[$hash] = $message;
+
+ if (!$message instanceof $phpType) {
+ throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', $phpType, get_class($message)));
+ }
+
+ $messageBinder = new MessageBinder($message);
+ foreach ($this->typeRepository->getType($phpType)->all() as $type) {
+ $property = $type->getName();
+ $value = $messageBinder->readProperty($property);
+
+ if (null !== $value) {
+ $value = $this->processType($type->getType(), $value);
+
+ $messageBinder->writeProperty($property, $value);
+ }
+
+ if (!$type->isNillable() && null === $value) {
+ throw new \InvalidArgumentException(sprintf('"%s::%s" cannot be null.', $phpType, $type->getName()));
+ }
+ }
+
+ return $message;
+ }
}
\ No newline at end of file
diff --git a/ServiceBinding/RpcLiteralResponseMessageBinder.php b/ServiceBinding/RpcLiteralResponseMessageBinder.php
index b6b4361..82d0924 100644
--- a/ServiceBinding/RpcLiteralResponseMessageBinder.php
+++ b/ServiceBinding/RpcLiteralResponseMessageBinder.php
@@ -32,7 +32,8 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
{
$this->typeRepository = $typeRepository;
- return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
+ //return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
+ return $this->processType(current($messageDefinition->getOutput()->all())->getType(), $message);
}
private function processType($phpType, $message)
diff --git a/ServiceDefinition/Annotation/Param.php b/ServiceDefinition/Annotation/Param.php
index 330569b..257b7b3 100644
--- a/ServiceDefinition/Annotation/Param.php
+++ b/ServiceDefinition/Annotation/Param.php
@@ -18,6 +18,7 @@ class Param extends Configuration implements TypedElementInterface
private $value;
private $phpType;
private $xmlType;
+ private $isNillable = false;
public function getValue()
{
@@ -34,6 +35,11 @@ class Param extends Configuration implements TypedElementInterface
return $this->xmlType;
}
+ public function isNillable()
+ {
+ return $this->isNillable;
+ }
+
public function setValue($value)
{
$this->value = $value;
@@ -49,6 +55,11 @@ class Param extends Configuration implements TypedElementInterface
$this->xmlType = $xmlType;
}
+ public function setNillable($isNillable)
+ {
+ $this->isNillable = (bool) $isNillable;
+ }
+
public function getAliasName()
{
return 'param';
diff --git a/ServiceDefinition/Annotation/Result.php b/ServiceDefinition/Annotation/Result.php
index 0d86f8c..52ee7e5 100644
--- a/ServiceDefinition/Annotation/Result.php
+++ b/ServiceDefinition/Annotation/Result.php
@@ -15,9 +15,15 @@ namespace BeSimple\SoapBundle\ServiceDefinition\Annotation;
*/
class Result extends Configuration implements TypedElementInterface
{
+ private $value = 'return';
private $phpType;
private $xmlType;
+ public function getValue()
+ {
+ return $this->value;
+ }
+
public function getPhpType()
{
return $this->phpType;
@@ -28,6 +34,11 @@ class Result extends Configuration implements TypedElementInterface
return $this->xmlType;
}
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
public function setPhpType($phpType)
{
$this->phpType = $phpType;
diff --git a/ServiceDefinition/Loader/AnnotationClassLoader.php b/ServiceDefinition/Loader/AnnotationClassLoader.php
index dcd1500..5fedee1 100644
--- a/ServiceDefinition/Loader/AnnotationClassLoader.php
+++ b/ServiceDefinition/Loader/AnnotationClassLoader.php
@@ -73,14 +73,17 @@ class AnnotationClassLoader extends Loader
foreach ($class->getMethods() as $method) {
$serviceHeaders = $sharedHeaders;
$serviceArguments = array();
- $serviceMethod =
- $serviceReturn = null;
+ $serviceMethod = null;
+ $serviceReturn = [];
foreach ($this->reader->getMethodAnnotations($method) as $annotation) {
if ($annotation instanceof Annotation\Header) {
$serviceHeaders[$annotation->getValue()] = $this->loadType($annotation->getPhpType());
} elseif ($annotation instanceof Annotation\Param) {
- $serviceArguments[$annotation->getValue()] = $this->loadType($annotation->getPhpType());
+ $serviceArguments[$annotation->getValue()] = [
+ 'type' => $this->loadType($annotation->getPhpType()),
+ 'nillable' => $annotation->isNillable()
+ ];
} elseif ($annotation instanceof Annotation\Method) {
if ($serviceMethod) {
throw new \LogicException(sprintf('@Soap\Method defined twice for "%s".', $method->getName()));
@@ -95,7 +98,7 @@ class AnnotationClassLoader extends Loader
throw new \LogicException(sprintf('@Soap\Result defined twice for "%s".', $method->getName()));
}
- $serviceReturn = $annotation->getPhpType();
+ $serviceReturn[$annotation->getValue()] = $annotation->getPhpType();
}
}
@@ -108,15 +111,17 @@ class AnnotationClassLoader extends Loader
$serviceMethod->addHeader($name, $type);
}
- foreach ($serviceArguments as $name => $type) {
- $serviceMethod->addInput($name, $type);
+ /*foreach ($serviceArguments as $name => $type) {
+ $serviceMethod->addInput($name, $type);*/
+ foreach ($serviceArguments as $name => $argument) {
+ $serviceMethod->addInput($name, $argument['type'], $argument['nillable']);
}
if (!$serviceReturn) {
throw new \LogicException(sprintf('@Soap\Result non-existent for "%s".', $method->getName()));
}
- $serviceMethod->setOutput($this->loadType($serviceReturn));
+ $serviceMethod->setOutput(key($serviceReturn), $this->loadType(current($serviceReturn)));
$definition->addMethod($serviceMethod);
}
diff --git a/ServiceDefinition/Method.php b/ServiceDefinition/Method.php
index a93953c..245c7d7 100644
--- a/ServiceDefinition/Method.php
+++ b/ServiceDefinition/Method.php
@@ -13,7 +13,7 @@
namespace BeSimple\SoapBundle\ServiceDefinition;
use BeSimple\SoapCommon\Definition\Method as BaseMethod;
-use BeSimple\SoapCommon\Definition\Type\TypeRepository;
+//use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/**
* @author Christian Kerl <[email protected]>
diff --git a/WebServiceContext.php b/WebServiceContext.php
index dce81a7..32724b9 100644
--- a/WebServiceContext.php
+++ b/WebServiceContext.php
@@ -53,6 +53,11 @@ class WebServiceContext
$this->serviceDefinition = $this->loader->load($this->options['resource'], $this->options['resource_type']);
$this->serviceDefinition->setName($this->options['name']);
$this->serviceDefinition->setNamespace($this->options['namespace']);
+ $this->serviceDefinition->setOptions([
+ 'style' => $this->options['style'],
+ 'use' => $this->options['use'],
+ 'version' => $this->options['version'],
+ ]);
$cache->write('<?php return unserialize('.var_export(serialize($this->serviceDefinition), true).');');
}
_SoapCommon_
diff --git a/Definition/Method.php b/Definition/Method.php
index e79e9d2..6a19d46 100644
--- a/Definition/Method.php
+++ b/Definition/Method.php
@@ -61,14 +61,15 @@ class Method
$this->headers->add($name, $type);
}
- public function addInput($name, $type)
+ public function addInput($name, $type, $nillable = false)
{
- $this->input->add($name, $type);
+ $this->input->add($name, $type, $nillable);
}
- public function setOutput($type)
+ public function setOutput($name, $type)
{
- $this->output->add('return', $type);
+ //$this->output->add('return', $type);
+ $this->output->add($name, $type);
}
public function getHeaders()
_SoapWsdl_
diff --git a/Dumper/AbstractVersion.php b/Dumper/AbstractVersion.php
index c67c035..da33be5 100644
--- a/Dumper/AbstractVersion.php
+++ b/Dumper/AbstractVersion.php
@@ -89,7 +89,7 @@ abstract class AbstractVersion implements VersionInterface
$operation->setAttribute('name', $method->getName());
$soapOperation = $this->document->createElement($this->soapNs.':operation');
- $soapOperation->setAttribute('soapAction', $this->namespace.$method->getName());
+ $soapOperation->setAttribute('soapAction', $this->namespace.'/#'.$method->getName());
$operation->appendChild($soapOperation);
$this->getBindingNode()->appendChild($operation);
@@ -109,8 +109,8 @@ abstract class AbstractVersion implements VersionInterface
if (!$headers->isEmpty()) {
foreach ($headers->all() as $part) {
$soapHeader = $this->document->createElement($this->soapNs.':header');
- $soapHeader->setAttribute('part', $part->getName());
$soapHeader->setAttribute('message', $this->typeNs.':'.$headers->getName());
+ $soapHeader->setAttribute('part', \SOAP_RPC === $this->style ? $part->getName() : 'parameters');
$soapHeader->setAttribute('use', $use);
$soapHeader->setAttribute('namespace', $this->namespace);
$soapHeader->setAttribute('encodingStyle', $this->getEncodingStyle());
diff --git a/Dumper/Dumper.php b/Dumper/Dumper.php
index ef55520..786be81 100644
--- a/Dumper/Dumper.php
+++ b/Dumper/Dumper.php
@@ -34,13 +34,14 @@ class Dumper
const SOAP12_NS = 'soap12';
const SOAP12_NS_URI = 'http://schemas.xmlsoap.org/wsdl/soap12/';
- const SOAP_ENC_NS = 'soap-enc';
+ const SOAP_ENC_NS = 'soapenc';
const SOAP_ENC_URI = 'http://schemas.xmlsoap.org/soap/encoding/';
const XSD_NS = 'xsd';
const XSD_NS_URI = 'http://www.w3.org/2001/XMLSchema';
- const TYPES_NS = 'tns';
+ const TARGET_NS = 'tns';
+ const TYPES_NS = 'ns';
protected $definition;
protected $options;
@@ -153,28 +154,30 @@ class Dumper
protected function addDefinitions()
{
$this->domDefinitions = $this->document->createElement('definitions');
+
+ $this->domDefinitions->setAttribute('name', $this->definition->getName());
+ $this->domDefinitions->setAttribute('targetNamespace', $this->definition->getNamespace());
+
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS, static::WSDL_NS_URI);
- $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::TYPES_NS, $this->definition->getNamespace());
+ $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::TARGET_NS, $this->definition->getNamespace());
+ $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::TYPES_NS, $this->definition->getNamespace().'/types');
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP_NS, static::SOAP_NS_URI);
- $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP12_NS, static::SOAP12_NS_URI);
+ //$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP12_NS, static::SOAP12_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::XSD_NS, static::XSD_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP_ENC_NS, static::SOAP_ENC_URI);
- $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::WSDL_NS, static::WSDL_NS_URI);
+ //$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::WSDL_NS, static::WSDL_NS_URI);
foreach ($this->definition->getTypeRepository()->getXmlNamespaces() as $prefix => $uri) {
$this->domDefinitions->setAttributeNs(static::XML_NS_URI, static::XML_NS.':'.$prefix, $uri);
}
- $this->domDefinitions->setAttribute('name', $this->definition->getName());
- $this->domDefinitions->setAttribute('targetNamespace', $this->definition->getNamespace());
-
$this->document->appendChild($this->domDefinitions);
}
protected function addMethods()
{
- $this->addPortType();
$this->addComplexTypes();
+ $this->addPortType();
$this->addMessages($this->definition->getMessages());
foreach ($this->definition->getMethods() as $method) {
@@ -196,19 +199,43 @@ class Dumper
$messageElement = $this->document->createElement('message');
$messageElement->setAttribute('name', $message->getName());
- foreach ($message->all() as $part) {
- $type = $this->definition->getTypeRepository()->getType($part->getType());
+ if ($this->definition->getOption('style') === \SOAP_RPC) {
- $partElement = $this->document->createElement('part');
- $partElement->setAttribute('name', $part->getName());
+ foreach ($message->all() as $part) {
+ $type = $this->definition->getTypeRepository()->getType($part->getType());
+
+ $partElement = $this->document->createElement('part');
+ $partElement->setAttribute('name', $part->getName());
- if ($type instanceof ComplexType) {
- $partElement->setAttribute('type', static::TYPES_NS.':'.$type->getXmlType());
- } else {
- $partElement->setAttribute('type', $type);
+ if ($type instanceof ComplexType) {
+ $partElement->setAttribute('type', static::TYPES_NS.':'.$type->getXmlType());
+ } else {
+ $partElement->setAttribute('type', $type);
+ }
+
+ $messageElement->appendChild($partElement);
}
+ } else { // \SOAP_DOCUMENT (literal-wrapped)
+
+ $partElement = $this->document->createElement('part');
+ $partElement->setAttribute('name', 'parameters');
+ $partElement->setAttribute('element', static::TYPES_NS.':'.$message->getName());
+
$messageElement->appendChild($partElement);
+
+ $paramsComplexType = new ComplexType('array', $message->getName());
+ foreach ($message->all() as $part) {
+ $paramsComplexType->add($part->getName(), $part->getType(), $part->isNillable());
+ }
+
+ $this->addComplexType($paramsComplexType);
+
+ $paramsElement = $this->document->createElement(static::XSD_NS.':element');
+ $paramsElement->setAttribute('name', $paramsComplexType->getXmlType());
+ $paramsElement->setAttribute('type', static::TYPES_NS.':'.$paramsComplexType->getXmlType());
+
+ $this->domSchema->appendChild($paramsElement);
}
$this->domDefinitions->appendChild($messageElement);
@@ -220,8 +247,10 @@ class Dumper
$types = $this->document->createElement('types');
$this->domDefinitions->appendChild($types);
+ $nsTypes = $this->definition->getNamespace() . '/types';
$this->domSchema = $this->document->createElement(static::XSD_NS.':schema');
- $this->domSchema->setAttribute('targetNamespace', $this->definition->getNamespace());
+ $this->domSchema->setAttribute('targetNamespace', $nsTypes);
+ $this->domSchema->setAttribute(static::XML_NS, $nsTypes);
$types->appendChild($this->domSchema);
foreach ($this->definition->getTypeRepository()->getComplexTypes() as $type) {
@@ -251,6 +280,7 @@ class Dumper
$name = $childType->getName();
}
+ //$element->setAttribute('element', static::TYPES_NS.':'.$name);
$element->setAttribute('type', static::TYPES_NS.':'.$name);
} else {
$element->setAttribute('type', $childType);
@@ -290,7 +320,8 @@ class Dumper
}
$node = $this->document->createElement($type);
- $node->setAttribute('message', static::TYPES_NS.':'.$message->getName());
+ $node->setAttribute('message', static::TARGET_NS.':'.$message->getName());
+ //$node->setAttribute('name', $message->getName());
$operation->appendChild($node);
}
@@ -311,11 +342,11 @@ class Dumper
protected function getVersion($version)
{
- if (\SOAP_1_2 === $version) {
+ /*if (\SOAP_1_2 === $version) {
return $this->getVersion12();
- }
+ }*/
- return $this->getVersion11();
+ return (\SOAP_1_2 === $version)? $this->getVersion12() : $this->getVersion11();
}
protected function getVersion11()
@@ -323,10 +354,10 @@ class Dumper
if (!$this->version11) {
$this->version11 = new $this->options['version11_class'](
static::SOAP_NS,
- static::TYPES_NS,
+ static::TARGET_NS,
$this->options['version11_name'],
$this->definition->getNamespace(),
- static::TYPES_NS.':'.$this->definition->getName().'PortType',
+ static::TARGET_NS.':'.$this->definition->getName().'PortType',
$this->definition->getOption('location'),
$this->definition->getOption('style')
);
@@ -340,10 +371,10 @@ class Dumper
if (!$this->version12) {
$this->version12 = new $this->options['version12_class'](
static::SOAP12_NS,
- static::TYPES_NS,
+ static::TARGET_NS,
$this->options['version12_name'],
$this->definition->getNamespace(),
- static::TYPES_NS.':'.$this->definition->getName().'PortType',
+ static::TARGET_NS.':'.$this->definition->getName().'PortType',
$this->definition->getOption('location'),
$this->definition->getOption('style')
);
Hello,
I already encountered many time the following issue, a reference stored in a composer.lock "disapears" from the commit history.
Our project depends on the readonly repository BeSimple / BeSimpleSoapCommon
Could it be related to your git subtree split ?
[RuntimeException]
Failed to execute git checkout 'e9a8384121e4db63ebcbf791df8c177c64f4bc4a' && git reset --hard 'e9a8384121e4db63ebcbf791df8c177c64f4bc4a'
fatal: reference is not a tree: e9a8384121e4db63ebcbf791df8c177c64f4bc4a
Best regards,
After your update this morning, I am no longer able to install besimplesoap for my Laravel 4 project (4.2.17). Composer details an unresolvable set of dependencies regarding symfony/debug package:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/debug 2.5.x-dev
- Conclusion: don't install symfony/debug 2.5.x-dev
- Conclusion: remove laravel/framework 4.2.x-dev
- Conclusion: don't install symfony/debug v2.5.11
- Conclusion: don't install laravel/framework 4.2.x-dev
- Conclusion: don't install symfony/debug v2.5.10
- Conclusion: don't install laravel/framework v4.2.17
{
- Conclusion: don't install symfony/debug v2.5.9
- Conclusion: don't install laravel/framework v4.2.16
- Conclusion: don't install symfony/debug v2.5.8
- Conclusion: don't install laravel/framework v4.2.15
- Conclusion: don't install symfony/debug v2.5.7
- Conclusion: don't install laravel/framework v4.2.14
- Conclusion: don't install symfony/debug v2.5.6
- Conclusion: don't install laravel/framework v4.2.13
- Conclusion: don't install symfony/debug v2.5.5
- Conclusion: don't install laravel/framework v4.2.12
- Conclusion: don't install symfony/debug v2.5.4
- Conclusion: don't install laravel/framework v4.2.11
- Conclusion: don't install symfony/debug v2.5.3
- Conclusion: don't install laravel/framework v4.2.10
- Conclusion: don't install symfony/debug v2.5.2
- Conclusion: don't install laravel/framework v4.2.9
- Conclusion: don't install symfony/debug v2.5.1
- Conclusion: don't install laravel/framework v4.2.8
- Conclusion: don't install symfony/debug v2.5.0
- Conclusion: don't install laravel/framework v4.2.7
- Conclusion: don't install symfony/debug v2.5.0-RC1
- Conclusion: don't install laravel/framework v4.2.6
- Installation request for opscompliance/soap 1.4.6 -> satisfiable by opscompliance/soap[v1.4.6].
- Conclusion: don't install symfony/debug v2.5.0-BETA2
- laravel/framework v4.2.5 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.4 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.3 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.2 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.1 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.0-BETA1 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- laravel/framework v4.2.0 requires symfony/debug 2.5.* -> satisfiable by symfony/debug[2.5.x-dev, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9].
- Conclusion: don't install symfony/debug v2.5.0-BETA1
- Installation request for laravel/framework 4.2.*@dev -> satisfiable by laravel/framework[4.2.x-dev, v4.2.0, v4.2.0-BETA1, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.13, v4.2.14, v4.2.15, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
If I change my requirement to specifically 0.2.6, everything installs fine.
Hi,
after follow the configuration of this bundle in my Symfony 2 project, I refresh my page and I saw this message :
ClassNotFoundException: Attempted to load class "Classmap" from namespace "BeSimple\SoapServer" in /var/www/fisyx/app/cache/dev/appDevDebugProjectContainer.php line 480. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: BeSimple\SoapCommon\Classmap.
So finally I change the namespace "BeSimple\SoapServer\Classmap" by "BeSimple\SoapCommon\Classmap". And it work well.
How can I do if I want they put "BeSimple\SoapCommon\Classmap" automatically ?
Thank you so much
Regards.
I'm trying to add a type inside another one, but the generated WSDL seems to be wrong.
Example :
Type A :
class TypeA
{
/**
* @Soap\ComplexType("int")
*/
private $id;
/**
* @Soap\ComplexType("Path\Type\TypeB")
*/
private $typeB;
}
Type B :
class TypeB
{
/**
* @Soap\ComplexType("int")
*/
private $id;
/**
* @Soap\ComplexType("string")
*/
private $name;
}
Generated WSDL :
1 <xsd:complexType name="Path.Type.TypeB">
2 <xsd:all>
3 <xsd:element name="id" type="xsd:int"/>
4 <xsd:element name="name" type="xsd:string"/>
5 </xsd:all>
6 </xsd:complexType>
7 <xsd:complexType name="Path.Type.TypeA">
8 <xsd:all>
9 <xsd:element name="id" type="xsd:int"/>
10 <xsd:element name="typeB" type="tns:typeB"/>
11 </xsd:all>
12 </xsd:complexType>
I'm using SoapUI to test my webservice, and when I load the WSDL, I have this error :
Error: type 'typeB@path' not found.
Line 10 should be :
<xsd:element name="typeB" type="tns:Path.Type.TypeB"/>
This looks like a bug, and I don't see how I could bypass this (except by modifying manually WSDL).
This class doesn't exist.
But it is requested in Resources/config/webservice.xml by the key besimple.soap.binder.request_header.documentwrapped.class
So when using document/literal/wrapped, the class WebServiceContext emit a fatal error by emitting a ClassNotFoundException
Hi,
I want to create 2 SOAP method for my webservice. I've to use a specification from my client.
They want 2 SOAP method with same name but different parameters (overriding the signature). How i can do this with your bundles ?
I've allready try this :
/**
* @Soap\Method("estEligibleOperation")
* @Soap\Param("versionWS", phpType = "string")
* @Soap\Param("nomOperateurCommercial", phpType = "string")
* @Soap\Param("referenceMediapost", phpType = "string")
* @Soap\Param("infoRetour", phpType = "string")
* @Soap\Result(phpType = "Vitam\WebservicesBundle\Soap\Type\RetourElligibiliteSoapType")
*/
public function estEligibleOperationAction($versionWS, $nomOperateurCommercial, $referenceMediapost, $infoRetour)
{
}
/**
* @Soap\Method("estEligibleOperation")
* @Soap\Param("versionWS", phpType = "string")
* @Soap\Param("nomOperateurCommercial", phpType = "string")
* @Soap\Param("codeInsee", phpType = "string")
* @Soap\Param("codeRivoli", phpType = "string")
* @Soap\Param("numeroVoie", phpType = "integer")
* @Soap\Param("complementNumeroVoie", phpType = "string")
* @Soap\Param("infoRetour", phpType = "string")
* @Soap\Result(phpType = "Vitam\WebservicesBundle\Soap\Type\RetourElligibiliteSoapType")
*/
public function estEligibleOperation2Action($versionWS, $nomOperateurCommercial, $codeInsee, $codeRivoli, $numeroVoie, $complementNumeroVoie, $infoRetour)
{
}
but it doesn't work and crash the wsdl page viewer without any logs...
If you can help me it would be great :)
thanks.
XuruDragon.
Hi,
has someone an example of soap client which sends a request with mtom attachment?
Please help
Hello!
For some reason after update to latest version of BeSimpleSoapBundle today it stopped to work correctly in our application. More details below:
There is a simple controller action like this:
/**
* @Soap\Method("getAddress")
* @Soap\Param("id", phpType = "int")
* @Soap\Result(phpType = "Foo\Bundle\AddressBundle\Entity\Address")
*/
public function getAction($id)
{
return $this->handleGetRequest($id);
}
It is expected that result XML will be generated using annotations in Address class:
class Address
{
/**
* @Soap\ComplexType("int", nillable=true)
*/
protected $id;
/**
* @Soap\ComplexType("string", nillable=true)
*/
protected $label;
// Other fields
During debug it was found that classes BeSimple\SoapBundle\ServiceBinding\RpcLiteralResponseMessageBinder and BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder uses private property $definitionComplexTypes to map real classes to complex types:
// ...
// BeSimple\SoapBundle\ServiceBinding\RpcLiteralResponseMessageBinder, line 35
private function processType($phpType, $message)
{
$isArray = false;
if (preg_match('/^([^\[]+)\[\]$/', $phpType, $match)) {
$isArray = true;
$phpType = $match[1];
}
if (isset($this->definitionComplexTypes[$phpType])) {
// ...
Property $this->definitionComplexTypes contains name of classes in format:
Foo.Bundle.AddressBundle.Entity.Address
But value of $phpType is a FQCN
Foo\Bundle\AddressBundle\Entity\Address
So
$this->definitionComplexTypes[$phpType])
will always not exist and a $message will be not modified in processType method like it is supposed to be and @soap annotations of class in value of $phpType will be always ignored.
BeSimple\SoapClient\MimeFilter use
s SoapRequest and SoapResponse from SoapCommon, but there are other classes in the same directory as MimeFilter with those names, which causes a conflict. The XmlMimeFilter also uses SoapRequest, and has a similar conflict.
It is probably oversights, where two methods works with same array $options but different keys.
I can't install your library because it requires zend-mime 2.1.* and I already use zend libraries 2.2.5 (barcode,config,validator) with Symfony2.
Can you change your dependencies and require zend-mime > 2.1.0?
Thanks.
Hello, i have a problem when try get wsdl, but in the response get
in url ex:
http://mysymfonyapp.com/ws/DemoApi/1.0/
result:
and in url:
http://mysymfonyapp.com/ws/DemoApi/1.0/?WSDL
download it.
The XML (note that has blank spaces):
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost/Capelws30/Capel_v1/web/app_dev.php/ws/Apli/1.0/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="Apli" targetNamespace="http://localhost/Capelws30/Capel_v1/web/app_dev.php/ws/Apli/1.0/">
<portType name="ApliPortType">
<operation name="goodbye" parameterOrder="name">
<input message="tns:goodbyeRequest"/>
<output message="tns:goodbyeResponse"/>
</operation>
</portType>
<binding name="ApliBinding" type="tns:ApliPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="goodbye">
<soap:operation soapAction="http://localhost/Capelws30/Capel_v1/web/app_dev.php/ws/Apli/1.0/goodbye"/>
<input>
<soap:body use="literal" namespace="http://localhost/Capelws30/Capel_v1/web/app_dev.php/ws/Apli/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" parts="name"/>
</input>
<output>
<soap:body use="literal" namespace="http://localhost/Capelws30/Capel_v1/web/app_dev.php/ws/Apli/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" parts="return"/>
</output>
</operation>
</binding>
<service name="ApliService">
<port name="ApliPort" binding="tns:ApliBinding">
<soap:address location="http://localhost/CapelWS30/Capel_v1/web/app_dev.php/ws/Apli"/>
</port>
</service>
<message name="goodbyeRequest">
<part name="name" type="xsd:string"/>
</message>
<message name="goodbyeResponse">
<part name="return" type="xsd:string"/>
</message>
</definitions>
Good morning, thanks for the BeSimple bundle, it works great!
Since I'm new to using MTOM mechanism and since it's not easy to find php code that supports MTOM attachments in SOAP messages, I would need an example.
In particular, i have to implement a SOAP client that sends a message with attachment (using MTOM mechanism) to a WS service listening. My client without attachments works.
My problem that i can not manage attachment part, I do not know what methods to call and how.
I set the header but I can not dial the message header and attachment.
It would be possible to have an example of a client sending a request with MTOM attachment ?
I attach my code.
Thank you in advance.
--- MY CODE ---
$nome = "richiesta_".time().".zip";
$clientbuilder = $this->get('besimple.soap.client.builder.client_name');
$soapClient= $clientbuilder->build();
$wsdl= $clientbuilder->getWsdl();
$sc = new BeSimpleSoapClient($wsdl, array(
'attachment_type' => BeSimpleSoapHelper::ATTACHMENTS_TYPE_MTOM,
'cache_wsdl' => WSDL_CACHE_NONE,
'trace' => 1,
'exception' => true));
$ss= new SoapCommon\Mime\Part();
$ss->setHeader("Content-Type","applicatio/xop+xml");
$ss->setHeader("type","text/xml");
$ss->setHeader("Content-Transfer-Encoding","base64");
$b53 = new SoapCommon\Mime\MultiPart();
$aa= $ss->getMessagePart();
$b53->getMimeMessage($aa);
$soapClient->getSoapKernel()->addAttachment($ss);
$b53->addPart($ss);
$sc->getSoapKernel()->addAttachment($ss);
// HEADER PARAMETER
// ---------------- my var parameter for header request----------------
// BODY PARAMETER
// ---------------- my var parameter for body request----------------
// HEADER
$CredentialObjectXML = '
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
// ---------------- security part ----------------
</wsse:Security>';
$CredentialObject = new \SoapVar($CredentialObjectXML,XSD_ANYXML);
$header = new \SoapHeader('http://schemas.xmlsoap.org/soap/envelope/','null',$CredentialObject);
$soapClient->__setSoapHeaders($header);
// BODY
$inputparam = new \SoapVar('
<ns1:InstanceMessageCreateRequest>
// ---------------- other body request part ----------------
<attachments>
<!--Zero or more repetitions:-->
<attachment>
<fileset>attachment</fileset>
<filename>filename</filename>
<!--Optional:-->
<contentType>application</contentType>
<data>cid</data>
</attachment>
</attachments>
// ---------------- other body request part ----------------
</ns1:InstanceMessageCreateRequest>', XSD_ANYXML);
// request call
try {
$return = $soapClient->mathod_name($inputparam);
$sc->getSoapKernel()->filterRequest($return);
}
catch (\SoapFault $exception) {
}
));
When try install BeSimpleSoap in PHP 7 a got this error message:
Notice: Use of undefined constant WSDL_CACHE_DISK - assumed 'WSDL_CACHE_DISK' in /var/www/inoserver/vendor/burti/besimple-soap-bundle/BeSimple/SoapBundle/DependencyInjection/BeSimpleSoapExtension.php on line 161
Fatal error: Cannot use BeSimple\SoapBundle\Util\String as String because 'String' is a special class name in /var/www/inoserver/vendor/burti/besimple-soap-bundle/BeSimple/SoapBundle/Converter/TypeRepository.php on line 16
I think is necessary change the "String" class name. Maybe to "StringHelper" or "StringUtil"
Thanks
The Mime parser drops lines that start with a single hyphen. It considers them as the start of a boundary, and when they don't match it moves on to the next line. It should append the line to the content.
Patch and test coming.
Does you bundle has support for WS-SecurityPolicy 1.2?
When access to
.../web/app_dev.php/ws/Apli
Show me the web service, with all methods. But when trying call functions or methods defined it into server, show the message:
Meanwhile, call web service defined into vb extension ......asmx?wsdl
work it.
$client = new \SoapClient($wsdl_url,$params ) ;
$result = $client->functionserver($params );
Help, please.
Thanks.
When I implement SoapClient without opcache in php cli, I have got this error :
Cannot use BeSimple\SoapCommon\SoapRequest as SoapRequest because the name is already in use in vendor/besimple/soap-client/BeSimple/SoapClient/XmlMimeFilter.php
I had to use an alias in XmlMimeFilter.php for SoapRequest like :
use BeSimple\SoapCommon\SoapRequest as SoapCommonRequest;
I found this about this problem
https://bugs.php.net/bug.php?id=66773
Hi,
I need clone a Adobe Content Server 4 (ACS4) soap webservice, I would like do it using this bundle, Is possible do a wsdl like this sample?
https://gist.github.com/mrcmorales/8808773
In this link there are a request method and respond method sample.
Thanks
The date format is defined to Y-m-d\TH:i:s.000\Z if client send request with milliseconds it doesn't works!
The good format must be Y-m-d\TH:i:s.u\Z
Hi,
I can't download correctly my wsdl. I have the follow error when i try to call the client:
ContextErrorException: Warning: DOMDocument::loadXML(): Empty string supplied as input in C:\wamp\www\FlexFront\vendor\besimple\soap-client\BeSimple\SoapClient\WsdlDownloader.php line 159
My configuration is:
// app/config_dev.yml
be_simple_soap:
clients:
high_deal_consultation:
wsdl: http://highdealdev:8080/consultation?wsdl
When i call the service in this normal way
$this->container->get('besimple.soap.client.high_deal_consultation')
I have the error.
However the wsdl is accessible. Any idea?
Tanks,
Stefano
- Installation request for besimple/wsdl2php dev-master -> satisfiable by besimple/wsdl2php[dev-master].
- besimple/wsdl2php dev-master requires besimple/soap-common dev-master -> no matching package found.
because soap-common does not have a dev-master version it seems?
It's easily to show the problem when you set a Client and Server with the same transfer object model.
For example, I have an entity used by Client (classMap) and Server:
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
/**
* @Soap\Alias("MeetingDetail")
*/
class MeetingDetail
{
/**
* @Soap\ComplexType("int", nillable=false)
*/
private $id;
/**
* @Soap\ComplexType("string")
*/
private $name;
/**
* @Soap\ComplexType("PTC\NoventoBundle\TO\ParticipantTypeDetail[]")
*/
private $participantTypeList;
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getParticipantTypeList()
{
return $this->participantTypeList;
}
public function setParticipantTypeList($participantTypeList)
{
$this->participantTypeList = $participantTypeList;
}
}
Service is defined on server side as:
class MobileController extends Controller
{
/**
* Get all usefull data related to a meeting
*
* @Soap\Method("getMeetingDetails")
* @Soap\Param("userId", phpType = "int")
* @Soap\Param("meetingId", phpType = "int")
* @Soap\Result(phpType = "PTC\NoventoBundle\TO\MeetingDetail")
*/
public function getMeetingDetailsAction($userId, $meetingId)
{
...
$this->get('logger')->info('--------- Meeting object Server Side ---------');
$this->get('logger')->info(print_r($meetingDetail, true));
return $meetingDetail;
}
The call is made from client side as:
public function viewMeetingAction($id)
{
$mobileApi = $this->get('besimple.soap.client.mobileapi');
$meetingDetails = $mobileApi->getMeetingDetails($user->getId(), $id);
$this->get('logger')->info('--------- Meeting object Client Side ---------');
$this->get('logger')->info(print_r($meetingDetail, true));
}
Config on client side:
be_simple_soap:
clients:
MobileApi:
wsdl: %ws_location%
classmap:
MeetingDetail: PTC\NoventoMobileBundle\TO\MeetingDetail
ParticipantTypeDetail: PTC\NoventoMobileBundle\TO\ParticipantTypeDetail
Log of meetingDetail on server side, just before sending response:
[2014-09-02 08:47:45] app.INFO: --------- Meeting object Server Side ---------
[2014-09-02 08:47:45] app.INFO: PTC\NoventoBundle\TO\MeetingDetail Object
(
[id:PTC\NoventoBundle\TO\MeetingDetail:private] => 1
[name:PTC\NoventoBundle\TO\MeetingDetail:private] => Symposium annuel des osthéopathes d'Europe
[participantTypeList:PTC\NoventoBundle\TO\MeetingDetail:private] => Array
(
[0] => PTC\NoventoBundle\TO\ParticipantTypeDetail Object
(
[id:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => 2
[name:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => Delegation
[count:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => 4
)
[1] => PTC\NoventoBundle\TO\ParticipantTypeDetail Object
(
[id:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => 3
[name:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => Media
[count:PTC\NoventoBundle\TO\ParticipantTypeDetail:private] => 1
)
)
)
Log of meetingDetail on client side when calling service:
[2014-09-02 08:47:45] app.INFO: --------- Meeting object Client Side ---------
[2014-09-02 08:47:45] app.INFO: PTC\NoventoMobileBundle\TO\MeetingDetail Object
(
[id:PTC\NoventoMobileBundle\TO\MeetingDetail:private] => 1
[name:PTC\NoventoMobileBundle\TO\MeetingDetail:private] => Symposium annuel des osthéopathes d'Europe
[participantTypeList:PTC\NoventoMobileBundle\TO\MeetingDetail:private] => stdClass Object
(
[item] => Array
(
[0] => PTC\NoventoMobileBundle\TO\ParticipantTypeDetail Object
(
[id:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => 2
[name:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => Delegation
[count:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => 4
)
[1] => PTC\NoventoMobileBundle\TO\ParticipantTypeDetail Object
(
[id:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => 3
[name:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => Media
[count:PTC\NoventoMobileBundle\TO\ParticipantTypeDetail:private] => 1
)
)
)
)
As you can see an item node is added in the object.
Currently, the structure of the corresponding complexType in WSDL is:
<xsd:complexType name="ArrayOfParticipantTypeDetail">
<xsd:sequence>
<xsd:element name="item" type="tns:ParticipantTypeDetail" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MeetingDetail">
<xsd:all>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="participantTypeList" type="tns:ArrayOfParticipantTypeDetail"/>
</xsd:all>
</xsd:complexType>
But I think we should have (like with EJB3):
<xsd:complexType name="MeetingDetail">
<xsd:all>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="participantTypeList" type="tns:ParticipantTypeDetail" minOccurs="0" maxOccurs="unbounded"/>
</xsd:all>
</xsd:complexType>
In https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapBundle/Converter/TypeRepository.php
you use a class:
use BeSimple\SoapBundle\ServiceDefinition\ServiceDefinition;
But, it doesn't exist...
https://github.com/BeSimple/BeSimpleSoap/tree/master/src/BeSimple/SoapBundle/ServiceDefinition
There are so many open pull request. Is someone still working on this?
I have an issue with someone consuming one of my web services thats using BeSimpleSoap ...
The response from the webservice looks like -
<customerStatus id="ref6">
<ident>inactive</ident>
</customerStatus>
And then further on in the XML the reference is used -
<customerStatus href="#ref6"/>
Is there any way to disable this ? and just repeat the value ?
Thanks
Jasper Reports WSDL and someone other webservices dont return a xml, only the blank response with attachments, we can fix like this:
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
// strip away everything but the xml.
$response = preg_replace('#^.*(<\?xml.*>)[^>]*$#s', '$1', $response);
return $response;
}
Other solution for this is stop forcing exceptions true on SoapClient
Change:
$options['exceptions'] = true;
To:
$options['exceptions'] = (isset($options['exceptions']) and $options['exceptions'] === true)?true:false false;
You want i change this or you can do?
Hello,
I'm using a complex type, which have a simple array of strings property, declared using this annotation :
@soap\ComplexType("string[]", nillable=true)
This used to work perfectly, but after a recent update of the library, I've got a notice in BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder, line 94 (function processType).
At that line, there is indeed an $array variable, which is not initialized in the case of the type being processed not a ComplexType. The stack trace shows the type being processed, which is "string[]".
Maybe the solution is to replace the uninitialized $array symbol with empty array ?
It happened after this commit c830097
Hi!
First, thanks for this great stuff!
I'm a symfony 2 dev and I found this package very nice and clean. I made it work following the documentation and implemented an internal client to verify that it's ok. But I got an issue and I hope you have some light according your experience.
My partners wanted to try the service with the native PHP SoapClient but it throws this exception:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'http://192.168.0.38/app_dev.php/soap/Placita?wsdl' :
failed to load external entity "http://192.168.0.38/app_dev.php/soap/Placita?wsdl"
The wsdl is downloadable through browser but when the SoapClient is used:
$client = new SoapClient("http://192.168.0.38/app_dev.php/soap/Placita?wsdl");
It doesn't even reach the dev.log of symfony.
Could you help us to figure out the issue please?
Thanks :)
Maybe it will get fixed while i post the issue. However i cannot access the documentation at bisim.pl and it looks like it is not just me.
http://downforeveryoneorjustme.com/bisim.pl
Is the documentation being moved?
Hello,
I've been trying to connect to a Soap webservice using BeSimpleBundle. This webservice has an Api Key, a username and a password. I'm not able to make it work. Has anybody already used it with authentication?
My goal is to have a Soap Envelope header like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.mrted.com/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>XXXXXX</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
I've already used this bundle with a webservice that does not require authentication and it works well.
Here is my configuration:
be_simple_soap:
clients:
test:
wsdl: XXXXX?api_key=XXXXXX
And in my controller:
$soapClientBuilder = $this->get('besimple.soap.client.builder.test');
$soapClientBuilder->withBasicAuthentication('XXXX', 'XXXX');
$soapClient = $soapClientBuilder->build();
$soapClient->testMethod();
I tried many things but the last error I got with this exact configuration is:
Wrong Version 500 Internal Server Error - SoapFault
I even tried to override the version hardcoded on the bundle to see if this was the problem but it isn't.
Obs: I am able to make requests to this webservice using apps like Soap.ui.
Hi.
I updated BeSimpleSoapBundle in my symfony2 project.
I've got this error log, when I use associative array in result annotation.
[2013-10-17 09:41:15] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Notice: Undefined index: alias in ... /vendor/besimple/soap-bundle/BeSimple/SoapBundle/ServiceDefinition/Loader/AnnotationClassLoader.php line 184" at ... /vendor/besimple/soap-bundle/BeSimple/SoapBundle/ServiceDefinition/Loader/AnnotationClassLoader.php line 184 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException: Notice: Undefined index: alias in ... /vendor/besimple/soap-bundle/BeSimple/SoapBundle/ServiceDefinition/Loader/AnnotationClassLoader.php line 184 at ... /vendor/besimple/soap-bundle/BeSimple/SoapBundle/ServiceDefinition/Loader/AnnotationClassLoader.php:184)"} []
This is my controller code:
<?php
namespace Developers\apiBundle\Controller;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;
class instanceController extends ContainerAware
{
/**
* Check account
* If account not exist, system create one
*
* @Soap\Method("getAccount")
* @Soap\Result(phpType = "BeSimple\SoapCommon\Type\KeyValue\String[]")
*
*/
public function getAccountAction()
{
return array(
'name' => 'pablo'
);
}
}
Any ideas?.
Thanks.
When I want to do app/console config:dump be_simple_soap
, I get the following error:
Configuration class "BeSimple\SoapBundle\DependencyInjection\Configuration" should implement ConfigurationInterface in order to be dumpable
client.xml
looks like this:
<service id="besimple.soap.client.builder" class="%besimple.soap.client.builder.class%" abstract="true">
<argument /> <!-- wsdl URI -->
<argument type="collection">
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="besimple.soap.classmap" />
<argument type="service" id="besimple.soap.converter.collection" />
<argument type="service" id="besimple.soap.cache" />
</service>
The constructor of BeSimple\SoapBundle\Soap\SoapClientBuilder
looks like this:
public function __construct($wsdl, array $options, Classmap $classmap = null, TypeConverterCollection $converters = null)
So some services like besimple.soap.cache
are never used.
WsdlDownloader save file without validation:
$soap = new \BeSimple\SoapClient\SoapClient('https://google.com');
It leads to "SOAP-ERROR: Parsing WSDL: ..."
Seems like a promising library, but the documentation is missing. It's good to have an example of how to install composer, but missing here are examples of how to make even simple requests.
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.