Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect SoapServer output #2878

Open
SharkMachine opened this issue Jun 7, 2014 · 6 comments
Open

Incorrect SoapServer output #2878

SharkMachine opened this issue Jun 7, 2014 · 6 comments

Comments

@SharkMachine
Copy link

Output from PHP:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url">
   <SOAP-ENV:Body>
      <ns1:IntegerReturnValue>
         <IntegerResult>
            <IntegerValue>1</IntegerValue>
         </IntegerResult>
      </ns1:IntegerReturnValue>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Output from HHVM:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="" xmlns:ns2="http://url">
   <SOAP-ENV:Body>
      <ns2:IntegerReturnValue>
         <IntegerResult>
            <IntegerValue>1</IntegerValue>
         </IntegerResult>
      </ns2:IntegerReturnValue>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

As you can see, xmlns:ns1 is incorrect and there shouldn't even be xmlns:ns2 at all.

@SharkMachine
Copy link
Author

Here's a code example:

PHP:

<?php
class SimpleSoap {
    public function TestCall($params) {
        return array('success' => true);
    }
}
$srv = new SoapServer('simplesoap.wsdl', array(
    'cache_wsdl'   => WSDL_CACHE_NONE,
    'soap_version' => SOAP_1_2,
));
$srv->setClass('SimpleSoap');
$srv->handle();

WSDL:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="wso2" targetNamespace="http://localevohhvm" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localevohhvm">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localevohhvm">
            <xsd:element name="ParametersForTestCall">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element minOccurs="1" maxOccurs="1" name="integerValue" type="xsd:int" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="TestCallReturnValue">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element minOccurs="1" maxOccurs="1" name="success" type="xsd:boolean" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="TestCallRequest">
        <wsdl:part name="TestCallRequest" element="tns:ParametersForTestCall" />
    </wsdl:message>
    <wsdl:message name="TestCallResponse">
        <wsdl:part name="TestCallResponse" element="tns:TestCallReturnValue" />
    </wsdl:message>

    <wsdl:portType name="EvolutionPortType">
        <wsdl:operation name="TestCall">
            <wsdl:input message="tns:TestCallRequest" />
            <wsdl:output message="tns:TestCallResponse" />
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="EvolutionSoapBinding" type="tns:EvolutionPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="TestCall">
            <soap:operation soapAction="http://localevohhvm/TestCall" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="EvolutionService">
        <wsdl:port name="EvolutionPort" binding="tns:EvolutionSoapBinding">
            <soap:address location="http://localevohhvm/simplesoap/simplesoap.php" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

@JoelMarcey
Copy link
Contributor

@SharkMachine Hi! Did you have an associated client with your sample? The code you gave doesn't do much without a client :)

@SharkMachine
Copy link
Author

I think the simplest way to test this is to use a software called SoapUI (which I used myself). You can easily create a test client with it by loading the WSDL file.

Using a PHP client created with SoapClient probably would not work with HHVM as the response from SoapServer is not well-formed. But if you want to try it, here is an example client:

<?php
$client = new SoapClient('simplesoap.wsdl', array(
    'location' => 'http://localevohhvm/simplesoap/simplesoap.php',
    'cache_wsdl'   => WSDL_CACHE_NONE,
    'soap_version' => SOAP_1_2,
));

$arguments = array('integerValue' => 1);
$response = $client->__soapCall('TestCall', $arguments);
var_dump($response);

@SharkMachine
Copy link
Author

Apparently PHP SoapClient works just fine, but that's not the case for some other implementations. For example SoapUI will just display the raw response as it doesn't recognise it properly and some .NET implementations have problems as well.

@GITAZZOUZ
Copy link

I used a PHP SoapClient which works fine with my HHVM server , but i have a problem with c# soap client; i get empty response :
error message :
There is a problem with the XML that was received from the network. See inner exception for more details.

@llimos
Copy link

llimos commented Sep 20, 2015

This is still a problem with 3.9.0. The dummy xmlns:ns1="" is causing .NET clients to reject the response with the message The empty namespace requires a null or empty prefix.. It works fine on all versions of PHP.

The xmlns:ns2 attribute is used correctly - only the ns1 is a problem (on PHP since it doesn't have the bogus ns1 it uses ns1 as the main one - but the ns2 isn't the problem)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants