Sending schema with nusoap in PHP to .NET webservice
Not sure what my question is here but I need some pointers.
This is part of a guide for sending Insurance policy information to a webservice to get a quote in return. Where 'schema' and 'xml' need to be replaced.
<soap:Body>
<Quote xmlns="http://[etc]/">
<PolicyDetails>
<xsd:schema>schema</xsd:schema>xml</PolicyDetails>
</Quote>
</soap:Body>
I am using nusoap (PHP soap extensions aren't on the 开发者_如何学Goserver and I can't install them) and I would normally send something like:
$client->call('Quote', 'PolicyDetails' => $xml);
But this doesn't work. I get the error:
Error: soap:Server: Server was unable to process request. ---> Object reference not set to an instance of an object.
I assume because I'm missing out the 'schema' part. I know what the XML should look like but not what I have to add to 'schema' or how I should do it. Can anyone point me in the right direction?
Do you know what variables you need to send ?
Try my code which I use in my webserwice case:
<?php
require_once("nusoap/lib/nusoap.php");
/* Initialize parameter */
$param = array(
'PolicyDetails' => array(
'variableName' => 'variable',
'variableName2' => 'variable2',
),
);
/* create client */
$endpoint = "https://webserviceurl";
$mynamespace = "";
$client = new nusoap_client($endpoint, true);
$err = $client->getError();
if ($err) {
exit();
}
$response = $client->call('Quote', $param, $mynamespace);
$err = $client->getError();
if ($err) {
exit();
}
print_r($response);
?>
精彩评论