Note that there are some explanatory texts on larger screens.

plurals
  1. POSOAP-ERROR: Encoding: Violation of encoding rules?
    primarykey
    data
    text
    <p>I am trying to use Yii to provide a web service. The auto-generated wsdl is below. I can successfully consume the web service from the command line, but through a web browser, I get </p> <pre><code>SOAP-ERROR: Encoding: Violation of encoding rules </code></pre> <p>I am new to SOAP, so I am not sure how to debug the problem. Here is the PHP code I am using to consume the web service:</p> <pre><code>&lt;?php $client=new SoapClient('{url omitted for security}', array('trace'=&gt;1,'exceptions'=&gt;1)); try { $result = $client-&gt;getPerson(90043412); var_dump($result); } catch (SoapFault $fault) { echo $fault-&gt;getMessage() . '&lt;br /&gt;'; echo 'REQUEST &lt;br /&gt;'; echo '&lt;pre&gt;'; echo $client-&gt;__getLastRequestHeaders(); echo $client-&gt;__getLastRequest(); echo '&lt;/pre&gt;'; echo 'RESPONSE &lt;br /&gt;'; echo '&lt;pre&gt;'; echo $client-&gt;__getLastResponseHeaders(); echo $client-&gt;__getLastResponse(); echo '&lt;/pre&gt;'; echo 'TRACE &lt;br /&gt;'; echo '&lt;pre&gt;'; var_dump($fault-&gt;getTrace()); echo '&lt;/pre&gt;'; } ?&gt; </code></pre> <p>Here is the WSDL:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:PersonControllerwsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" name="PersonController" targetNamespace="urn:PersonControllerwsdl"&gt; &lt;wsdl:types&gt; &lt;xsd:schema targetNamespace="urn:PersonControllerwsdl"&gt; &lt;xsd:complexType name="Person"&gt; &lt;xsd:all&gt; &lt;xsd:element name="PIDM" type="xsd:integer"/&gt; &lt;xsd:element name="FirstName" type="xsd:string"/&gt; &lt;xsd:element name="MiddleName" type="xsd:string"/&gt; &lt;xsd:element name="LastName" type="xsd:string"/&gt; &lt;xsd:element name="PrefFirstName" type="xsd:string"/&gt; &lt;xsd:element name="CPOBox" type="xsd:string"/&gt; &lt;xsd:element name="Classification" type="xsd:string"/&gt; &lt;xsd:element name="Email" type="xsd:string"/&gt; &lt;xsd:element name="PhotoFile" type="xsd:string"/&gt; &lt;/xsd:all&gt; &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="getPersonRequest"&gt; &lt;wsdl:part name="PIDM" type="xsd:int"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="getPersonResponse"&gt; &lt;wsdl:part name="return" type="tns:Person"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="PersonControllerPortType"&gt; &lt;wsdl:operation name="getPerson"&gt; &lt;wsdl:documentation&gt;&lt;/wsdl:documentation&gt; &lt;wsdl:input message="tns:getPersonRequest"/&gt; &lt;wsdl:output message="tns:getPersonResponse"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="PersonControllerBinding" type="tns:PersonControllerPortType"&gt; &lt;soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="getPerson"&gt; &lt;soap:operation soapAction="urn:PersonControllerwsdl#getPerson" style="rpc"/&gt; &lt;wsdl:input&gt; &lt;soap:body use="encoded" namespace="urn:PersonControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;soap:body use="encoded" namespace="urn:PersonControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="PersonControllerService"&gt; &lt;wsdl:port name="PersonControllerPort" binding="tns:PersonControllerBinding"&gt; &lt;soap:address location="https://localhost/whoswho/person/service?ws=1"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/definitions&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload