php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50064 SOAP response by is not encoded
Submitted: 2009-11-03 16:28 UTC Modified: 2009-11-07 00:28 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ckl at ecw dot de Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.11 OS: Windows XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ckl at ecw dot de
New email:
PHP Version: OS:

 

 [2009-11-03 16:28 UTC] ckl at ecw dot de
Description:
------------
I developed a Spring-WS webservice which I try to call by PHP.
WSDL file:
---
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://www.ecw.de/adg/person/schema/beans" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.ecw.de/adg/person/schema/beans" targetNamespace="http://www.ecw.de/adg/person/schema/beans">
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns="http://www.ecw.de/adg/person/schema/beans" xmlns:pb="http://www.ecw.de/adg/person/schema/beans" xmlns:schemas="http://www.ecw.de/adg/person/schema/beans" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" attributeFormDefault="unqualified" elementFormDefault="unqualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="1.0" targetNamespace="http://www.ecw.de/adg/person/schema/beans" xmlns:tns="http://www.ecw.de/adg/person/schema/beans">
	<xs:annotation>
		<xs:appinfo>
			<jaxb:globalBindings>
				<xjc:simple/>
			</jaxb:globalBindings>
		</xs:appinfo>

	</xs:annotation>

	<xs:complexType name="person">
		<xs:sequence>
			<xs:element maxOccurs="1" minOccurs="1" name="canonicalName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="commonName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="createTimeStamp" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="description" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="name" nillable="true" type="xs:string"/>

			<xs:element maxOccurs="1" minOccurs="1" name="objectCategory" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="whenCreated" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="distinguishedName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="mail" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="displayName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="objectClass" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="sAMAccountName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="memberOf" nillable="true" type="pb:groupCollection"/>
			<xs:element maxOccurs="1" minOccurs="1" name="employeeNumber" nillable="true" type="xs:string"/>

			<xs:element maxOccurs="1" minOccurs="1" name="givenName" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="0" name="homeDirectory" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="homePhone" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="lastLogon" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="logonCount" nillable="true" type="xs:int"/>
			<xs:element maxOccurs="1" minOccurs="1" name="mailNickname" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="allowDialin" nillable="true" type="xs:boolean"/>
			<xs:element maxOccurs="1" minOccurs="1" name="profilePath" nillable="true" type="xs:string"/>
			<xs:element maxOccurs="1" minOccurs="1" name="userPrincipalName" nillable="true" type="xs:string"/>

			<xs:element maxOccurs="1" minOccurs="1" name="additionalAttributes" nillable="true" type="pb:additionalAttributesCollectionType"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="groupCollection">
		<xs:sequence>
			<xs:element maxOccurs="unbounded" minOccurs="0" name="groupName" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="additionalAttributesCollectionType">
		<xs:sequence>
			<xs:element maxOccurs="unbounded" minOccurs="0" name="attribute" nillable="false" type="pb:additionalAttributeType">
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="additionalAttributeType">
		<xs:sequence>

			<xs:element maxOccurs="1" minOccurs="1" name="value" type="xs:string"/>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required"/>
	</xs:complexType>

	<xs:complexType name="defaultAuthenticationResponse">
		<xs:sequence>
			<xs:element default="false" maxOccurs="1" minOccurs="1" name="valid" nillable="false" type="xs:boolean"/>
			<xs:element default="0" minOccurs="0" name="statusCode" nillable="true" type="xs:integer"/>

			<xs:element maxOccurs="1" minOccurs="0" name="reason" nillable="true" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>


	<xs:element name="findUserRequest">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="sAMAccountName" type="xs:string"/>
			</xs:sequence>

		</xs:complexType>
	</xs:element>
	<xs:element name="findUserResponse">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="person" type="pb:person"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="isUserAAARequest">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="1" minOccurs="1" name="sAMAccountName" nillable="false" type="xs:string"/>
				<xs:element maxOccurs="1" minOccurs="1" name="credential" nillable="false" type="xs:string"/>
				<xs:element maxOccurs="1" minOccurs="1" name="neededGroups" nillable="false" type="pb:groupCollection"/>
				<xs:element maxOccurs="1" minOccurs="1" name="memberShipIsNeededInAllGroups" nillable="false" type="xs:boolean"/>
			</xs:sequence>

		</xs:complexType>
	</xs:element>
	<xs:element name="isUserAAAResponse" type="pb:defaultAuthenticationResponse"/>

	<xs:element name="isUserAuthenticatedRequest">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="1" minOccurs="0" name="sAMAccountName" nillable="false" type="xs:string"/>
				<xs:element maxOccurs="1" minOccurs="1" name="credential" nillable="false" type="xs:string"/>

			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="isUserAuthenticatedResponse" type="pb:defaultAuthenticationResponse"/>

	<xs:element name="isUserAuthorizedRequest">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="1" minOccurs="0" name="sAMAccountName" nillable="false" type="xs:string"/>

				<xs:element maxOccurs="1" minOccurs="1" name="neededGroups" nillable="false" type="pb:groupCollection"/>
				<xs:element maxOccurs="1" minOccurs="1" name="memberShipIsNeededInAllGroups" nillable="false" type="xs:boolean"/>

			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="isUserAuthorizedResponse" type="pb:defaultAuthenticationResponse"/>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="isUserAuthenticatedRequest">

    <wsdl:part element="tns:isUserAuthenticatedRequest" name="isUserAuthenticatedRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="findUserResponse">
    <wsdl:part element="tns:findUserResponse" name="findUserResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="findUserRequest">
    <wsdl:part element="tns:findUserRequest" name="findUserRequest">

    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="isUserAuthorizedResponse">
    <wsdl:part element="tns:isUserAuthorizedResponse" name="isUserAuthorizedResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="isUserAAAResponse">
    <wsdl:part element="tns:isUserAAAResponse" name="isUserAAAResponse">
    </wsdl:part>

  </wsdl:message>
  <wsdl:message name="isUserAuthenticatedResponse">
    <wsdl:part element="tns:isUserAuthenticatedResponse" name="isUserAuthenticatedResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="isUserAAARequest">
    <wsdl:part element="tns:isUserAAARequest" name="isUserAAARequest">
    </wsdl:part>
  </wsdl:message>

  <wsdl:message name="isUserAuthorizedRequest">
    <wsdl:part element="tns:isUserAuthorizedRequest" name="isUserAuthorizedRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="Person">
    <wsdl:operation name="isUserAAA">
      <wsdl:input message="tns:isUserAAARequest" name="isUserAAARequest">
    </wsdl:input>
      <wsdl:output message="tns:isUserAAAResponse" name="isUserAAAResponse">

    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="isUserAuthorized">
      <wsdl:input message="tns:isUserAuthorizedRequest" name="isUserAuthorizedRequest">
    </wsdl:input>
      <wsdl:output message="tns:isUserAuthorizedResponse" name="isUserAuthorizedResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findUser">

      <wsdl:input message="tns:findUserRequest" name="findUserRequest">
    </wsdl:input>
      <wsdl:output message="tns:findUserResponse" name="findUserResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="isUserAuthenticated">
      <wsdl:input message="tns:isUserAuthenticatedRequest" name="isUserAuthenticatedRequest">
    </wsdl:input>
      <wsdl:output message="tns:isUserAuthenticatedResponse" name="isUserAuthenticatedResponse">

    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="PersonSoap11" type="tns:Person">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="isUserAAA">
      <soap:operation soapAction=""/>
      <wsdl:input name="isUserAAARequest">
        <soap:body use="literal"/>

      </wsdl:input>
      <wsdl:output name="isUserAAAResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="isUserAuthorized">
      <soap:operation soapAction=""/>
      <wsdl:input name="isUserAuthorizedRequest">
        <soap:body use="literal"/>

      </wsdl:input>
      <wsdl:output name="isUserAuthorizedResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="findUser">
      <soap:operation soapAction=""/>
      <wsdl:input name="findUserRequest">
        <soap:body use="literal"/>

      </wsdl:input>
      <wsdl:output name="findUserResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="isUserAuthenticated">
      <soap:operation soapAction=""/>
      <wsdl:input name="isUserAuthenticatedRequest">
        <soap:body use="literal"/>

      </wsdl:input>
      <wsdl:output name="isUserAuthenticatedResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="PersonService">
    <wsdl:port binding="tns:PersonSoap11" name="PersonSoap11">
      <soap:address location="http://localhost:8080/ADG/personService"/>

    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
---

Response from Spring-WS (fetched by proxying the request/response):
---
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <ns3:person xmlns:ns3="http://www.ecw.de/adg/person/schema/beans">
         <canonicalName xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
         <commonName xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
         <createTimeStamp xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
         <description>desc</description>
         <name>name</name>
         <objectCategory>CN=Person,CN=Schema,CN=Configuration,DC=dc,DC=com</objectCategory>
         <whenCreated>200000000</whenCreated>
         <distinguishedName>CN=...</distinguishedName>
         <mail>mail@domain.com</mail>
         <displayName>display-name</displayName>
         <objectClass>top</objectClass>
         <sAMAccountName>test</sAMAccountName>
         <memberOf>
            <groupName>Some groupname</groupName>
         </memberOf>
         <employeeNumber>123</employeeNumber>
         <givenName>test</givenName>
         <homePhone xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
         <lastLogon>129017292450890526</lastLogon>
         <logonCount>7021</logonCount>
         <mailNickname>test</mailNickname>
         <allowDialin>false</allowDialin>
         <profilePath>\\srv\profiles</profilePath>
         <userPrincipalName>test@domain.com</userPrincipalName>
         <additionalAttributes xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
      </ns3:person>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
---

It seems to be that SOAPClient or the underlying XML library (SimpleXML? - not sure which XML-library is used by SOAPClient) is not able to handle the namespaces in response.

Reproduce code:
---------------
<?php
define('WSDL', 'path_to_wsdl');

// tried already all possible combinations with and without uri
$client = new SoapClient(WSDL, array('trace' => true, 'version' => SOAP_1_1, 'exceptions' => true, 'uri' => 'http://www.ecw.de/adg/person/schema/beans'));

$func = "findUser"
$req['findUserRequest']['sAMAccountName'] = 'test';

// tried already all possible combinations with and without uri
$result = $client->__soapCall($func, $req, array('uri' => "http://www.ecw.de/adg/person/schema/beans"));

print_r($result); // results in NULL and *not* object
?>

Expected result:
----------------
expected: object { name = 'test' , .... }


Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-04 22:39 UTC] srinatar@php.net
will it be to provide a test case where this problem is reproduced. This would allow us to look further on this issue. the below provided information doesn't seem to be enough to reproduce this problem

when I tried your interface.wsdl, I get the below error :

Message = SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Missing <message> with name 'tns:findUserResponse' in /export/home/sriramn/scripts/PHP/soap-client-3.php:10
Stack trace:

looks like the interface.wsdl is missing some information. 

to answer your other question, php internally uses libxml2 to parse the xml file. 
 [2009-11-05 11:25 UTC] ckl at ecw dot de
srinatar, which test case do you need?
The problem is, that the WSDL file is automatically created by Spring-WS. Spring-WS parses a XSD-file and creates the WSDL below.

It seems to be, that your SOAP test-case does not make use of the <wsdl:definitions ... xmlns:tns="http://www.ecw.de/adg/person/schema/beans"> namespace definition.
The given WSDL above is valid and can be parsed by PHP on my system.

Do you have any suggestions?

Could your and my problem be related to libxml2 (thanks for the hint) and namespace parsing?
 [2009-11-07 00:28 UTC] srinatar@php.net
Ok, i am able to reproduce this issue when using php on windows and unable to do so when using php on linux. php on windows uses libxml2 2.7.3 version. i wonder, if this issue has some thing to do with how libxml2 (dependent library) is built on windows. 

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri May 29 05:01:25 2020 UTC