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

doc/lit (document/literal) style/use "unable to serialize result" #118

Open
blantonl opened this issue Apr 21, 2024 · 0 comments
Open

doc/lit (document/literal) style/use "unable to serialize result" #118

blantonl opened this issue Apr 21, 2024 · 0 comments

Comments

@blantonl
Copy link

When specifying document/literal return types an error is generated:

 <SOAP-ENV:Fault>
         <faultcode xsi:type="xsd:string">SOAP-ENV:Server</faultcode>
         <faultstring xsi:type="xsd:string">unable to serialize result</faultstring>
         <faultactor xsi:type="xsd:string"/>
         <detail xsi:type="xsd:string"/>
      </SOAP-ENV:Fault>

Example:

require_once("nusoap-0.9.17/src/nusoap.php");
$server = new nusoap_server(); // Create a instance for nusoap server

$server->configureWSDL("Soap Demo","urn:soapdemo"); // Configure WSDL file
$namespace = "test";
$server->register(
	"get_price", // name of function
	array("name"=>"xsd:string"),  // inputs
	array("return"=>"xsd:integer"),   // outputs
	false,
	false,
	'document',  // <====
	'literal', // <=====
	'Test Docs'
);

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

function get_price($name)
{
	$products = [
		"book"=>20,
		"pen"=>10,
		"pencil"=>5
	];

	foreach($products as $product=>$price)
	{
		if($product==$name)
		{
			return $price;
			break;
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant