How to avoid repeating yourself in WSDL operations with identical SOAP headers -


i working on wsdl file defines number of elements. this:

<wsdl:operation name="myoperationname">     <soap:operation soapaction="http://www.domain.dk/myschema#myservice" style="document"/>     <wsdl:input name="myservicerequest">             <soap:header use="literal" part="securityheader" message="tns:securityheader"/>             <soap:header use="literal" part="somethingelseheader" message="tns:somethingelseheader"/>             <soap:header use="literal" part="whitelistingheader" message="tns:whitelistingheader" wsdl:required="true"/>             <soap:body use="literal"/>     </wsdl:input>     <wsdl:output name="myserviceresponse">         <soap:body use="literal"/>     </wsdl:output>     <wsdl:fault name="myfault">         <soap:fault name="myfault" use="literal"/>     </wsdl:fault> </wsdl:operation> 

i have lot of wsdl operations , share same identical list of soap:header elements:

            <soap:header use="literal" part="securityheader" message="tns:securityheader"/>             <soap:header use="literal" part="somethingelseheader" message="tns:somethingelseheader"/>             <soap:header use="literal" part="whitelistingheader" message="tns:whitelistingheader" wsdl:required="true"/> 

is there way define once , somehow "add" wsdl operations sort of reference? way have change 1 place if headers change or of needed add new header.

i've been trying extend wsdl:input element (see below) i'm waay out of depth here xml/wsdl wise. illustrates looking for.

<xs:complextype name="standardheaders">     <xs:simplecontent>         <xs:extension base="wsdl:operation">             <soap:header use="literal" part="securityheader" message="tns:securityheader"/>             <soap:header use="literal" part="somethingelseheader" message="tns:somethingelseheader"/>             <soap:header use="literal" part="whitelistingheader" message="tns:whitelistingheader" wsdl:required="true"/>         </xs:extension>xx     </xs:simplecontent> </xs:complextype> ... <wsdl:input name="myservicerequest">     <tns:standardheaders /> 

okay, i've been digging problem , have found solution works me. there other ways might work others, such parsing other things wsdl axis2 or being able perform xslt preprocessing, worked me xml entity definitions. example:

<?xml version="1.0" encoding="utf-8"?> <!doctype definitions [ <!entity mystandardsoaprequestheaders "             <soap:header use='literal' part='header1part' message='tns:header1' />             <soap:header use='literal' part='header2part' message='tns:header2' /> "> <!entity mystandardsoapresponseheaders "             <soap:header use='literal' part='respheader1' message='tns:resp1'/>             <soap:header use='literal' part='respheader2' message='tns:resp2'/> "> ]> <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"               xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" .... &mystandardsoaprequestheaders; 

so include entity definition containing xml want reuse, reference xml using &entityname;

in case used inline entity definitions not pretty @ (having xml inside attribute values) can reference external files well, this:

<!entity myheader public "path/to/external.xml"> 

there number of useful sites discuss this. found 1 useful:

https://www.liquid-technologies.com/xml/entityrefs.aspx

(i'm not affiliated them found them google)


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -