Jump to content

SOAP Server - having problems


philaj

Recommended Posts

I'm trying to create a SOAP Server that will process requests from another system.

 

The system sends a SOAP Envelope of XML in and I need to extract the fields and do some processing.

 

Don't fully understand the WSDL they have provided - but I have created the following basic server code (See below) - which appears to run - and some debugging shows that it is called.

 

At debug point 0 - outputs a text file containing 'here' - and at point 1 outputs text file containing the XML as below.

BUT - My function never seems to be called - is there something basic I'm missing?

Please any help much appreciated.

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><DynamicChange><VTID>5572</VTID><ExtID>5572</ExtID><FunctionCode>5</FunctionCode><Status>3</Status><FMExtID>WIECR</FMExtID><Termin_von>2018-02-21T00:00:00+00:00</Termin_von><Termin_bis>2018-02-23T00:00:00+00:00</Termin_bis><Plandauer>480</Plandauer><Besuchsdauer>480</Besuchsdauer><Planankunft>2018-02-27T09:00:00+00:00</Planankunft><Infotext></Infotext></DynamicChange></soap:Body></soap:Envelope>
<?php

// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled","0");

//Function to write a debug file
function wdf($no, $text) 
{	
    $fp = fopen('test'.$no.'.txt', 'w');
    fwrite($fp, $text);
    fclose($fp);	
}

// Main Function
function DynamicChange($change)
{
	wdf("2","here");		// Debug Write
	
	$VTID = $change->VTID;
	$ExtID = $change->ExtID;
	$FunctionCode = $change->FunctionCode;
	$Status = $change->Status;
	$FMExtID = $change->FMExtID;
	$Termin_von = $change->Termin_von;
	$Termin_bis=$change->Termin_bis;
	$Plandauer = $change->Plandauer;
	$Besuchsdauer = $change->Besuchsdauer;
	$Planankunft = $change->Planankunft;
	$Infotext = $change->Infotext;	
		
	// Process it 	
	
	wdf("3",$ExtID);		// Debug Write
	Return ['DynamicChangeRequestResult' => 0];
		
}

wdf("0","here");		// Debug Write

$postdata = file_get_contents("php://input");
wdf("1",$postdata);		// Debug Write
		
// initialize SOAP Server
$server=new SoapServer("AspDynamicServer.wsdl");
$server->addFunction('DynamicChange');

// start handling requests
$server->handle();
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.