Expertsystemen

 

SOAP or REST server

It is also possible to define a SOAP or REST endpoint. The server can be called with the endpoint <server>/api/v1/soap/<modelname>. A REST interface can be called by using <server>/api/v1/rest/<modelname>. The soap or rest call must be of a certain format.

From the models point of view, you can read from the request and write to the answer.

Reading information from the soap or rest call
Reading information from the soap or rest call
Writing information back to the soap or rest call
Writing information back to the soap or rest call

SOAP example

A SOAP server is called like this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bb="www.berkeleybridge.nl/soap">
	<soap:Header/>
	<soap:Body>
		<bb:applymodel>
			<bb:modelname>postcode</bb:modelname>
			<bb:username>postcode</bb:username>
			<bb:password>****</bb:password>
            <bb:modelspecificmessage/>
		</bb:applymodel>
	</soap:Body>
</soap:Envelope>

the model specific part can be anything you need. an example of a bbsoap server file:

<?xml version="1.0" encoding="utf-8"?>
<bb:berkeleybridgesoap xmlns:bb="www.berkeleybridge.nl/soap">
  <bb:description>postcode</bb:description>      
  <bb:soapaction>postcode</bb:soapaction>
  <bb:isprovider>true</bb:isprovider>
  <bb:soapversion>soap 1.1</bb:soapversion>
  <bb:soaprequest>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header/>
      <soap:Body>
	      <bb:applymodel>
	        <bb:modelname>postcode</bb:modelname>
	        <bb:username>postcode</bb:username>
	        <bb:password>**</bb:password>
	        <bb:sessionid/>
	        <bb:guid/>
	        <bb:session-name/>
	        <bb:version/>
          <bb:postcode>
            <bb:cijfers></bb:cijfers>
            <bb:letters></bb:letters>
            <bb:huisnummer></bb:huisnummer>
            <bb:huisletter></bb:huisletter>			
          </bb:postcode>
        </bb:applymodel>
      </soap:Body>
    </soap:Envelope>
  </bb:soaprequest>
  <bb:soaprequestelement>//bb:soaprequest/soap:Envelope/soap:Body/bb:applymodel/bb:postcode</bb:soaprequestelement>
  <bb:soapreply>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	  <soap:Header/>
      <soap:Body>
        <bb:postcode-data-out>
          <bb:street></bb:street>
          <bb:cityname></bb:cityname>
        </bb:postcode-data-out>
      </soap:Body>
    </soap:Envelope>
  </bb:soapreply>
  <bb:soapreplyelement>//bb:soapreply/soap:Envelope/soap:Body</bb:soapreplyelement>
</bb:berkeleybridgesoap>