在我的场景中,有一个在WSO2-AS中运行的Web服务“SolverDummyWS”,并希望在WSO2 ESB中为此服务生成代理。
因此,我手动为代理创建了一个wsdl,并添加了一些必需的头字段。所以只有代理的wsdl应该有这个头。标题应该是强制性的,并且定义为EXPLICIT HEADERS。
Proxy-WSDL看起来像这样:
<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>
所以我使用WSO2-ESB Web界面创建代理。如果我查看创建的代理的实际WSDL,我看到WSO2-ESB做了一些更改: - 添加了HTTP绑定 - 从createGridRequest消息中删除了header-part - 混乱的肥皂:在绑定中输入(有两个标题定义,并删除了正文部分)
由WSO2-ESB修改的WSDL
<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>
此代码没有强制标题,因此我创建初始标题的初始目的是由wso2-esb搞砸了。
有人可以告诉我如何将强制标头添加到代理服务中(如果我的初始wsdl文件有错误,就会出现这种情况)?
如果我的初始wsdl文件没问题,我怎么能强制wso2-esb使用这个文件,不要修改它?!
最后一个问题,是否有另一种方法可以为代理请求创建强制标头?
感谢您的回答!
答案 0 :(得分:1)
&lt; parameter name =“useOriginalwsdl”&gt; true&lt; / parameter&gt;
尝试将此参数放入代理服务以按原样显示wsdl。处理soap标头应该使用调解器在代理服务级别完成。