0
votes

In my scenario a have a webservice "SolverDummyWS" running in WSO2-AS, and want to generate a Proxy for this Service inside WSO2 ESB.

Therefore I created a wsdl for the proxy manually, and added some mandatory header fields. So only the wsdl of the proxy should have this headers. The headers should all be mandatory and defined als EXPLICIT HEADERS.

Proxy-WSDL looks like this:

<wsdl:definitions name="SolverDummyProxy"
targetNamespace="http://de.unistuttgart.iaas" xmlns:tns="http://de.unistuttgart.iaas"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>
    <schema targetNamespace="http://de.unistuttgart.iaas"
        xmlns="http://www.w3.org/2001/XMLSchema">
        <element name="createGrid">
            <complexType>
                <sequence>
                    <element minOccurs="0" name="milliseconds" type="long" />
                </sequence>
            </complexType>
        </element>
        <element name="createGridResponse">
            <complexType>
                <sequence>
                    <element minOccurs="0" name="return" type="string" />
                </sequence>
            </complexType>
        </element>
        <element name="requestHeader">
            <complexType>
                <sequence>
                    <element minOccurs="1" name="simulationId" type="long" />
                    <element minOccurs="1" name="activityId" type="long" />
                    <element minOccurs="1" name="requiredPolicy" type="anyType" />
                    <element minOccurs="1" name="requiredPortType" type="string" />
                    <element minOccurs="1" name="requiredScope" type="anyURI" />
                </sequence>
            </complexType>
        </element>
    </schema>
</wsdl:types>

<wsdl:message name="createGridRequest">
    <wsdl:part name="body" element="tns:createGrid" />
    <wsdl:part name="reqHeader" element="tns:requestHeader" />
</wsdl:message>

<wsdl:message name="createGridResponse">
    <wsdl:part name="body" element="tns:createGridResponse" />
</wsdl:message>

<wsdl:portType name="SolverDummyProxyWSPortType">
    <wsdl:operation name="createGrid">
        <wsdl:input message="tns:createGridRequest" />
        <wsdl:output message="tns:createGridResponse" />
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="SolverDummyProxyWSSoap11Binding" type="tns:SolverDummyProxyWSPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="createGrid">
        <wsdl:input>
            <soap:body parts="body" use="literal" />
            <soap:header message="tns:createGridRequest" part="reqHeader"
                use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap:body parts="body" use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

<wsdl:binding name="SolverDummyProxyWSSoap12Binding" type="tns:SolverDummyProxyWSPortType">
    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="createGrid">
        <wsdl:input>
            <soap12:body parts="body" use="literal" />
            <soap12:header message="tns:createGridRequest" part="reqHeader"
                use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap12:body parts="body" use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

<wsdl:service name="SolverDummyProxyWS">
    <wsdl:port name="SolverDummyProxyWSSoap11Endpoint" binding="tns:SolverDummyProxyWSSoap11Binding">
        <soap:address location="http://localhost:8280/services/SolverDummyProxyWS.SolverDummyProxyWSSoap11Endpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyWSSoap12Endpoint" binding="tns:SolverDummyProxyWSSoap12Binding">
        <soap12:address location="http://localhost:8280/services/SolverDummyProxyWS.SolverDummyProxyWSSoap12Endpoint" />
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

So i create a Proxy using the WSO2-ESB Webinterface. If I have a look at the actual WSDL of the created Proxy, I see that WSO2-ESB did some changes: - Added HTTP Binding - Removed header-part from createGridRequest message - messed soap:input in bindings (there are two header definitions, and the body part was removed)

WSDL-modified by WSO2-ESB

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://de.unistuttgart.iaas" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://de.unistuttgart.iaas">
<wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://de.unistuttgart.iaas">
        <element name="createGrid">
            <complexType>
                <sequence>
                    <element minOccurs="0" name="milliseconds" type="long" />
                </sequence>
            </complexType>
        </element>
        <element name="createGridResponse">
            <complexType>
                <sequence>
                    <element minOccurs="0" name="return" type="string" />
                </sequence>
            </complexType>
        </element>
        <element name="requestHeader">
            <complexType>
                <sequence>
                    <element name="simulationId" type="long" />
                    <element name="activityId" type="long" />
                    <element name="requiredPolicy" type="anyType" />
                    <element name="requiredPortType" type="string" />
                    <element name="requiredScope" type="anyURI" />
                </sequence>
            </complexType>
        </element>
    </schema>
</wsdl:types>
<wsdl:message name="createGridRequest">
    <wsdl:part name="body" element="tns:createGrid" />
</wsdl:message>
<wsdl:message name="createGridResponse">
    <wsdl:part name="body" element="tns:createGridResponse" />
</wsdl:message>
<wsdl:portType name="SolverDummyProxyHWSPortType">
    <wsdl:operation name="createGrid">
        <wsdl:input message="tns:createGridRequest" wsaw:Action="http://de.unistuttgart.iaas/SolverDummyProxyWSPortType/createGridRequest" />
        <wsdl:output message="tns:createGridResponse" wsaw:Action="http://de.unistuttgart.iaas/SolverDummyProxyWSPortType/createGridResponse" />
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SolverDummyProxyHWSSoap11Binding" type="tns:SolverDummyProxyHWSPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="createGrid">
        <soap:operation soapAction="" style="document" />
        <wsdl:input>
            <soap:body use="literal" />
            <soap12:header use="literal" part="reqHeader" message="tns:createGridRequest" />
            <soap12:header use="literal" part="reqHeader" message="tns:createGridRequest" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SolverDummyProxyHWSSoap12Binding" type="tns:SolverDummyProxyHWSPortType">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="createGrid">
        <soap12:operation soapAction="" style="document" />
        <wsdl:input>
            <soap12:body use="literal" />
            <soap12:header use="literal" part="reqHeader" message="tns:createGridRequest" />
            <soap12:header use="literal" part="reqHeader" message="tns:createGridRequest" />
        </wsdl:input>
        <wsdl:output>
            <soap12:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SolverDummyProxyHWSHttpBinding" type="tns:SolverDummyProxyHWSPortType">
    <http:binding verb="POST" />
    <wsdl:operation name="createGrid">
        <http:operation location="createGrid" />
        <wsdl:input>
            <mime:content type="text/xml" part="parameters" />
        </wsdl:input>
        <wsdl:output>
            <mime:content type="text/xml" part="parameters" />
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="SolverDummyProxyHWS">
    <wsdl:port name="SolverDummyProxyHWSHttpSoap11Endpoint" binding="tns:SolverDummyProxyHWSSoap11Binding">
        <soap:address location="http://Tobiass-MacBook-Pro.local:8280/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpSoap11Endpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyHWSHttpsSoap11Endpoint" binding="tns:SolverDummyProxyHWSSoap11Binding">
        <soap:address location="https://Tobiass-MacBook-Pro.local:8243/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpsSoap11Endpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyHWSHttpSoap12Endpoint" binding="tns:SolverDummyProxyHWSSoap12Binding">
        <soap12:address location="http://Tobiass-MacBook-Pro.local:8280/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpSoap12Endpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyHWSHttpsSoap12Endpoint" binding="tns:SolverDummyProxyHWSSoap12Binding">
        <soap12:address location="https://Tobiass-MacBook-Pro.local:8243/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpsSoap12Endpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyHWSHttpsEndpoint" binding="tns:SolverDummyProxyHWSHttpBinding">
        <http:address location="https://Tobiass-MacBook-Pro.local:8243/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpsEndpoint" />
    </wsdl:port>
    <wsdl:port name="SolverDummyProxyHWSHttpEndpoint" binding="tns:SolverDummyProxyHWSHttpBinding">
        <http:address location="http://Tobiass-MacBook-Pro.local:8280/services/SolverDummyProxyHWS.SolverDummyProxyHWSHttpEndpoint" />
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

This code does not have mandatory headers, so my initial purpose of creating initial headers was messed up by wso2-esb.

Can somebody tell my how I can add mandatory headers to a proxy service (this would be the case if my initial wsdl file has errors)?

If my initial wsdl-file was ok, how can I enforce wso2-esb to use this file, and do not modify it?!?

Last question, is there another way of creating mandatory headers, for a request to a proxy?

Thanks for your answers!

1

1 Answers

1
votes

<parameter name="useOriginalwsdl">true</parameter>

Try to put this parameter to your proxy service to display the wsdl as it is. Processing the soap headers should be done at the proxy service level using mediators.