f00b4r / nusoap

:smirk: Fixed NuSOAP for PHP 5.6 - 8.2
https://f00b4r.github.io/nusoap/
318 stars 355 forks source link

unexpected element type - string instead of QName on PHP 7.1. It works fine on PHP 5.6 #8

Closed ms999 closed 6 years ago

ms999 commented 7 years ago

Hello,

thank you for the library. It definitely fixed issues with PHP 5.6. When I tried to run it on PHP7.1 - looks like PHP7 chose diferent type and I got this exception on the Java service that talks to my PHP service:

wsclient.WSClient (WSClient.java:88) - Error, Webservice result: java.rmi.RemoteException: Runtime exception; nested exception is: unexpected element type: expected={http://www.w3.org/2001/XMLSchema}QName, actual={http://www.w3.org/2001/XMLSchema}string

Thanks!

f3l1x commented 7 years ago

Hi.

Huh, I must say I do not known how to fix it. Do have any clues?

ghost commented 7 years ago

It is Java Exception not nusoap or php issue. try to use nusoap client. if your soap service build using nusoap server.

f3l1x commented 7 years ago

I get it, but I guess it's not problem at Java side, because you know, Java is here for long-time and it's well-tested.

ms999 commented 6 years ago

Hello,

as I suspected the problem was in PHP7 changes.

https://stackoverflow.com/questions/40038144/nusoap-soap-env-xml-was-empty-didnt-parse-message

$HTTP_RAW_POST_DATA is never defined in PHP7+.

This feature was DEPRECATED in PHP 5.6.0, and REMOVED as of PHP 7.0.0. If set to TRUE, PHP will always populate the $HTTP_RAW_POST_DATA containing the raw POST data. Otherwise, the variable is populated only when the MIME type of the data is unrecognised.

I fixed this by using file_get_contents("php://input") instead of $HTTP_RAW_POST_DATA in the service invocation:

@$server->service(file_get_contents("php://input"));

Everything is great, I am closing the issue.

Thanks!