首先,我正在尝试制作一个SOAP Web服务,该服务将响应肥皂请求包含的肥皂请求:
RZS:notificeerOverZaak_Di01
,输出应为
STUF:Bv03
而是输出:
NS1:notificeerOverZaak_Di01Reply
这是索引文件,这里添加了功能,这是服务器设置的。
<?php
//session starts, and error reproting
header('content-type: text/xml');
session_start();
error_reporting(E_ALL);
require_once('initialize.php');
function notificeerOverZaak_Di01($stuurgegevens = null,$melding = null,$object = null){
$data = array(
"Stuurgegevens" => json_encode($stuurgegevens),
"Melding" => json_encode($melding),
"Object" => json_encode($object),
"Received" => true
);
DatabaseController::Environment('c3-api-king')
->table('message_received')
->insert($data);
//XML laden
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml->load('Bv03.xml');
$xml_string = $xml->saveXML();
DatabaseController::Environment('c3-api-king')
->table('reply_sent')
->insert(array('reply'=>$xml_string));
$xml_string = trim(str_replace('<?xml version="1.0"?>', '', $xml_string));
return $xml_string;
}
$server = new soap_server();
$server->configureWSDL("test/rzs0310/rzsberichten/rzs0310_ontvangAsynchroon_rzsberichten.wsdl","StUF:Bv03");
$server->methodreturnisliteralxml = true;
$server->register(
"notificeerOverZaak_Di01"
);
$server->service($HTTP_RAW_POST_DATA);
?>
WSDL文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 sp2 (http://www.altova.com) by Johan Boer (Kwaliteits Instituut Nederlandse Gemeenten) -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:ZKN="http://www.egem.nl/StUF/sector/zkn/0310" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:RZS="http://www.stufstandaarden.nl/koppelvlak/rzs0310" name="StUF-ZKN0310" targetNamespace="http://www.stufstandaarden.nl/koppelvlak/rzs0310">
<import namespace="http://www.egem.nl/StUF/StUF0301" location="../../0301/stuf0301_types.wsdl"/>
<documentation>
<xs:documentation>
Dit document definieert de webservices voor het portType OntvangAsynchroon voor het Regie-Zaak services koppelvlak.
</xs:documentation>
<xs:appinfo>
<StUF:onderdeel>http://www.stufstandaarden.nl/koppelvlak/rzs0310</StUF:onderdeel>
<StUF:patch>-</StUF:patch>
<StUF:patchdatum>-</StUF:patchdatum>
<StUF:schemaversie>0</StUF:schemaversie>
</xs:appinfo>
</documentation>
<types>
<xs:schema>
<xs:import namespace="http://www.stufstandaarden.nl/koppelvlak/rzs0310" schemaLocation="rzs0310_msg_rzsberichten.xsd"/>
</xs:schema>
</types>
<message name="notificeerOverZaak_Di01">
<part name="body" element="RZS:notificeerOverZaak_Di01"/>
</message>
<message name="initieerNotificeerOverZaak_Di01">
<part name="body" element="RZS:initieerNotificeerOverZaak_Di01"/>
</message>
<message name="overdragenZaak_Di01">
<part name="body" element="RZS:overdragenZaak_Di01"/>
</message>
<message name="overdragenZaak_Du01">
<part name="body" element="RZS:overdragenZaak_Du01"/>
</message>
<portType name="OntvangAsynchroon">
<documentation>
Dit portType ondersteunt als operaties alle asynchrone berichten gedefinieerd binnen het sectormodel
</documentation>
<operation name="Bv03">
<input message="StUF:Bv03"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
<operation name="Fo03">
<input message="StUF:Fo03"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
<operation name="notificeerOverZaak">
<input message="RZS:notificeerOverZaak_Di01"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
<operation name="initieerNotificeerOverZaak">
<input message="RZS:initieerNotificeerOverZaak_Di01"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
<operation name="overdragenZaak">
<input message="RZS:overdragenZaak_Di01"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
<operation name="bevestigOverdragenZaak">
<input message="RZS:overdragenZaak_Du01"/>
<output message="StUF:Bv03"/>
<fault name="fout" message="StUF:Fo03"/>
</operation>
</portType>
<binding name="SOAPOntvangAsynchroon" type="RZS:OntvangAsynchroon">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<operation name="Bv03">
<soap:operation soapAction="http://www.egem.nl/StUF/StUF0301/Bv03"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal"/>
</fault>
</operation>
<operation name="Fo03">
<soap:operation soapAction="http://www.egem.nl/StUF/StUF0301/Fo03" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</fault>
</operation>
<operation name="notificeerOverZaak">
<soap:operation soapAction="http://www.egem.nl/StUF/sector/rzs/0310/notificeerOverZaak" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</fault>
</operation>
<operation name="initieerNotificeerOverZaak">
<soap:operation soapAction="http://www.egem.nl/StUF/sector/rzs/0310/initieerNotificeerOverZaak" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</fault>
</operation>
<operation name="overdragenZaak">
<soap:operation soapAction="http://www.egem.nl/StUF/sector/rzs/0310/overdragenZaak" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</fault>
</operation>
<operation name="bevestigOverdragenZaak">
<soap:operation soapAction="http://www.egem.nl/StUF/sector/rzs/0310/bevestigOverdragenZaak" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</input>
<output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</output>
<fault name="fout">
<soap:fault name="fout" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</fault>
</operation>
</binding>
<service name="OntvangAsynchroon">
<documentation>
Hieronder wordt de concreet aan te roepen service voor het ontvangen van asynchrone ZKN0310-berichten gedefinieerd.
</documentation>
<port name="OntvangAsynchroon" binding="RZS:SOAPOntvangAsynchroon">
<documentation>
<wsi:Claim xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" conformsTo="http://ws-i.org/profiles/basic/1.1"/>
</documentation>
<soap:address location="http://87.250.154.26:7080/opentunnel/00000001001877045000/50422931/AllTypes" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</port>
</service>
</definitions>
我们在函数末尾返回的xml文档是:
<StUF:Bv03Bericht xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ZKN="http://www.egem.nl/StUF/sector/zkn/0310" xmlns:BG="http://www.egem.nl/StUF/sector/bg/0310" xsi:schemaLocation="http://www.egem.nl/StUF/StUF0301 stuf0301.xsd">
<StUF:stuurgegevens>
<StUF:berichtcode>Bv03</StUF:berichtcode>
<StUF:zender>
<StUF:organisatie>C3group</StUF:organisatie>
<StUF:applicatie>C3groupApi</StUF:applicatie>
<StUF:gebruiker/>
</StUF:zender>
<StUF:ontvanger>
<StUF:organisatie>KING</StUF:organisatie>
<StUF:applicatie>STP</StUF:applicatie>
<StUF:gebruiker/>
</StUF:ontvanger>
<StUF:referentienummer>Di01</StUF:referentienummer>
<StUF:tijdstipBericht>20161115145026</StUF:tijdstipBericht>
<StUF:crossRefnummer/>
</StUF:stuurgegevens>
</StUF:Bv03Bericht>
目前的回复是:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:notificeerOverZaak_Di01Response xmlns:ns1="http://www.stufstandaarden.nl/koppelvlak/rzs0310">
<StUF:Bv03Bericht xsi:schemaLocation="http://www.egem.nl/StUF/StUF0301 stuf0301.xsd" xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ZKN="http://www.egem.nl/StUF/sector/zkn/0310" xmlns:BG="http://www.egem.nl/StUF/sector/bg/0310">
<StUF:stuurgegevens>
<StUF:berichtcode>Bv03</StUF:berichtcode>
<StUF:zender>
<StUF:organisatie>C3group</StUF:organisatie>
<StUF:applicatie>C3groupApi</StUF:applicatie>
<StUF:gebruiker/>
</StUF:zender>
<StUF:ontvanger>
<StUF:organisatie>KING</StUF:organisatie>
<StUF:applicatie>STP</StUF:applicatie>
<StUF:gebruiker/>
</StUF:ontvanger>
<StUF:referentienummer>Di01</StUF:referentienummer>
<StUF:tijdstipBericht>20161115145026</StUF:tijdstipBericht>
<StUF:crossRefnummer/>
</StUF:stuurgegevens>
</StUF:Bv03Bericht>
</ns1:notificeerOverZaak_Di01Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
上面唯一的错误就是不应该在那里。