For simplicity the code below uses hard coded values for SOAP address, which can be parameterized if needed.
<xsl:stylesheet xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<!--
Consumer WSDL are generated wihtout binding information.
This transformation adds the binding and service nodes to make the WSDL, WS-I Compliant.
-->
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<xsl:strip-space elements="*"/>
<!-- Declare Params, attribute paramter name should be in UPPERCASE-->
<xsl:param name="OPERTAION"/>
<xsl:param name="BINDTYPE"/>
<xsl:param name="MODE"/>
<!-- Declare Params-->
<xsl:template match="wsdl:definitions">
<xsl:copy>
<!-- Copy everything -->
<xsl:copy-of select="*|@*|comment()|processing-instruction()|text()"/>
<!-- AT the end add binding and service information with opertaion name and binding type being passed as external parameter -->
<wsdl:binding name="binding" type="{$BINDTYPE}">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="{$OPERTAION}">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<xsl:choose>
<xsl:when test="$MODE = 'X'">
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<!-- <wsdl:fault name="StandardFaultMessage">
<soap:fault name="StandardFaultMessage" use="literal"/>
</wsdl:fault> -->
</xsl:when>
</xsl:choose>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="service">
<wsdl:port binding="tns:binding" name="HTTPS_Port">
<soap:address location="https://myhost.com/"/>
</wsdl:port>
</wsdl:service>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
TRY.
DATA(lv_wsdl) = cl_proxy_public_utils=>get_consumer_dt_wsdl( obj_name = CONV #( api_name ) ).
CATCH cx_proxy_fault.
ENDTRY.
cl_proxy_public_utils=>get_interface_data(
EXPORTING
abap_keys = VALUE #( ( obj_name = api_name ) )
IMPORTING
intf_data = lt_intf_detail
).
READ TABLE lt_intf_detail ASSIGNING FIELD-SYMBOL(<ls_intf_detail>) INDEX 1.
CHECK sy-subrc = 0.
CONCATENATE 'tns:' <ls_intf_detail>-name INTO DATA(lv_binding_name).
TRY.
CALL TRANSFORMATION zzenrich_consumer_wsdl PARAMETERS opertaion = <ls_intf_detail>-operation
bindtype = lv_binding_name
mode = <ls_intf_detail>-synchron
SOURCE XML lv_wsdl
RESULT XML lv_wsdl.
CATCH cx_transformation_error.
ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |