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

Some servers answer with HTTP Status 500 without user agent set #8

Open
jfastnacht opened this issue Sep 12, 2016 · 4 comments
Open

Comments

@jfastnacht
Copy link

Tried to convert the REQIF definition with xsd2php and got an error which is caused by xsd-reader:

> C:\webserver\php-7.0.8\composer.bat build

C:\Users\fastnacht\PhpstormProjects\staffgraph-req>"C:\webserver\php-7.0.8\php.exe" "C:\webserver\php-7.0.8\composer.phar" build 
> xsd2php convert:php reqif.xsd --ns-map=http://www.omg.org/spec/ReqIF/20110401/reqif.xsd;jfastnacht/REQIF --ns-dest=jfastnacht/REQIF/;src/jfastnacht/REQIF
Namespaces:
    XML namepsace: http://www.omg.org/spec/ReqIF/20110401/reqif.xsd => PHP namepsace: jfastnacht/REQIF
Target directories:
    PHP namepsace: jfastnacht/REQIF/ => Destination directory: src/jfastnacht/REQIF
Reading reqif.xsd

Script xsd2php convert:php reqif.xsd --ns-map=http://www.omg.org/spec/ReqIF/20110401/reqif.xsd;jfastnacht/REQIF --ns-dest=jfastnacht/REQIF/;src/jfastnacht/REQIF handling the build event returned with an error

Warning: DOMDocument::load(http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-datatypes-1.xsd): failed to open stream: HTTP request failed! HTTP/1.0 500 Server Error
 in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webservices\xsd-reader\src\SchemaReader.php on line 758

Warning: DOMDocument::load(): I/O warning : failed to load external entity "http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-datatypes-1.xsd" in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webservices\xsd-reader\src\SchemaReader.php on line 758


  [GoetasWebservices\XML\XSDReader\Exception\IOException]                      
  Can't load the file http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-  
  datatypes-1.xsd                                                              


convert:php [--ns-map NS-MAP] [--ns-dest NS-DEST] [--alias-map ALIAS-MAP] [--naming-strategy NAMING-STRATEGY] [--] <src> (<src>)...

PHP Warning:  DOMDocument::load(http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-datatypes-1.xsd): failed to open stream: HTTP request failed! HTTP/1.0 500 Server Error
 in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webservices\xsd-reader\src\SchemaReader.php on line 758
PHP Warning:  DOMDocument::load(): I/O warning : failed to load external entity "http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-datatypes-1.xsd" in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webservices\xsd-reader\src\SchemaReader.php on line 758

  [RuntimeException]                                                           
  Error Output:                                                                


    [GoetasWebservices\XML\XSDReader\Exception\IOException]                    

    Can't load the file http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtm  
  l-                                                                           
    datatypes-1.xsd                                                            



  convert:php [--ns-map NS-MAP] [--ns-dest NS-DEST] [--alias-map ALIAS-MAP] [  
  --naming-strategy NAMING-STRATEGY] [--] <src> (<src>)...                     
  PHP Warning:  DOMDocument::load(http://www.w3.org/TR/xhtml-modularization/S  
  CHEMA/xhtml-datatypes-1.xsd): failed to open stream: HTTP request failed! H  
  TTP/1.0 500 Server Error                                                     
   in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webser  
  vices\xsd-reader\src\SchemaReader.php on line 758                            
  PHP Warning:  DOMDocument::load(): I/O warning : failed to load external en  
  tity "http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml-datatypes-1.xs  
  d" in C:\Users\fastnacht\PhpstormProjects\staffgraph-req\vendor\goetas-webs  
  ervices\xsd-reader\src\SchemaReader.php on line 758                          


build [--dev] [--no-dev] [--] [<args>]...


Process finished with exit code 1 at 13:53:33.
Execution time: 16.898 ms.

Composer build script:

"scripts": {
  "build": "xsd2php convert:php reqif.xsd --ns-map=http://www.omg.org/spec/ReqIF/20110401/reqif.xsd;jfastnacht/REQIF --ns-dest=jfastnacht/REQIF/;src/jfastnacht/REQIF"
}

Fixed it with a comment on https://secure.php.net/manual/de/domdocument.load.php#91384 by adding:

$opts = array(
    'http' => array(
        'user_agent' => 'PHP libxml agent',
    )
);
$context = stream_context_create($opts);
libxml_set_streams_context($context);

between

$xml = new DOMDocument('1.0', 'UTF-8');
if (!$xml->load($file)) {

Might help someone else with the same problem. This is just a quick and dirty solution if you need it right now.

@goetas
Copy link
Member

goetas commented Sep 12, 2016

https://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtm%20l-%20datatypes-1.xsd gives 404 not found

Looks that your projects references it somewhere

@goetas
Copy link
Member

goetas commented Sep 12, 2016

Fixed it with a comment on https://secure.php.net/manual/de/domdocument.load.php#91384 by adding:

i see, interesting

@jfastnacht
Copy link
Author

Was just playing around with xsd2php, have to take a deeper look to get other the other stuff working, but I thought it might be a good idea to share this before continuing.

@goetas
Copy link
Member

goetas commented Sep 12, 2016

100% good idea. I was not aware of this issue

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

No branches or pull requests

2 participants