I need to send an xml document to a web service but keep getting fatal errors.
The error I recieve is
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:Program FilesApache GroupApache2htdocsweb_servicesvalidationindex.php:40 Stack trace: #0 [internal function]: SoapClient->__call('MedinSchematron...', Array) #1 C:\\Program Files\\Apache Group\\Apache2\\htdocs\\web_services\\validation\\index.php(40): SoapClient->MedinSchematronValidation(Array) #2 {main} thrown in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\web_services\\validation\\index.php on line 40
I have been reading lots on this and can not find a sloution.
One article send I should try wrapping my XML in cdata but that does not work.
This is my latest effort, but I have also tried without cdata tags, and passing the xml as a string without assigning it to an array
$xml_file = file_get_contents('dataset.xml');
$xml_string = '<![CDATA['.$xml_file.']]>';
// Assign the xml string to the parameters
$parameters = array(
'xml' => $xml_string
);
// Call the validation method
$client->MedinSchematronValidation($parameters);
We are hosting the web service but it is not written in C#.
The method I am calling is from Validate.cs and looks like this.
/// <summary>
/// Validate for MEDIN constraints
/// </summary>
/// <param name="xml">XmlDocument containing XML to validate</param>
/// <returns>XmlDocument containing Schematron Validation Report Language (SVRL)</returns>
[WebMethod(Description = "Validate XML against the MEDIN profile constraints Schematron schema", BufferResponse = true)]
public XmlDocument MedinSchematronValidation(XmlDocument xml)
{
try
{
// Check that the HTTP context is not null
if (HttpContext.Current == null)
throw new ApplicationException("An attempt has been made to access the server outside a valid HTTP context.");
// Do the schematron validation
return this.SchematronValidationMethod(xml, SchematronSchemaType.medinSchematron);
}
catch (Exception ex)
{
return ServiceException.ThrowSchematronException("An error occured: " + xml.ToString());
}
}
Any help would be very much appreciated.
if I need to post anymore information please let me know.
Thanks for any help.