Skip to Content
avatar image
Former Member

PHP SoapClient LoginService.wsdl Invalid document structure


I am struggling with B1WS-Soap. This is my Code:



try {

    $client = new SoapClient("", array('trace' => 1,'soap_version' => SOAP_1_2));

  $options = array(

    'DatabaseServer' => '',

    'DatabaseName' => 'SBODEMODE',

    'DatabaseType' => 'dst_MSSQL2012',

    'CompanyUsername' => 'manager',

    'CompanyPassword' => 'secret',

    'Language' => 'ln_German',

    'LicenseServer' => '',


  $something = $client->Login($options);


}catch (Exception $e) {

    echo "<pre>";




This is the error:

SoapFault Object ( [message:protected] =&amp;gt; Invalid XML [string:Excepti -

Somewhere I read there could be encoding issues... Can someone post demo-code? Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 03, 2015 at 11:03 PM

    Hi Kevin,

    the issue is indeed related to encoding.

    PHP adds encoding="UTF-8" in the xml declaration - DI Server cannot handle that.

    If you open your B1WSHandler.cs you will see the following lines :

     // Remove encoding="utf-8" => .NET adds it and DI Server doesn't accept it!
    int index = request.IndexOf("encoding=\"utf-");
    if (index > 0 && index < 50)
         request = request.Remove(index, 16);

    So, .NET is adding encoding="utf-8" and this is removed. You have to do the same for PHP.

    An easy workaround would be to change your B1WSHandler.cs to:

    int index = request.ToUpper().IndexOf("ENCODING=\"UTF-");
    if (index > 0 && index < 50)
       request = request.Remove(index, 16);



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Maik Delly

      Hi Maik,

      I tried both, SOAP and COM but I still get SOAPFaults:

      <pre><?xml version="1.0"?><env:Envelope xmlns:env=""><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value><env:Subcode><env:Value>-10</env:Value></env:Subcode></env:Code><env:Detail><Command>Login</Command></env:Detail></env:Fault></env:Body></env:Envelope> 

      I don't know what I am doing wrong. DI does not respond with any error message so I could investigate what the issue could be.