来自客户端的Webservice调用工作正常,直到我为身份验证添加了SOAP报头,现在客户端得到以下错误
<faultcode>S:Client</faultcode><faultstring>Cannot find dispatch method
for {http://com.analysis.num/}doNumAnalysis</faultstring>
以下是WSDL,其中包括最近为在SOAP头中添加身份验证信息所做的更改,我在这里错过了什么明显的东西吗?
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com.analysis.num/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://com.analysis.num/" name="NumericAnalysisService">
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="http://com.analysis.num/">
<xs:element name="doNumAnalysis" type="tns:doNumAnalysis" />
<xs:element name="doNumAnalysisResponse" type="tns:doNumAnalysisResponse" />
<xs:complexType name="doNumAnalysis">
<xs:sequence>
<xs:element name="numRequest" type="tns:numRequest" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="numRequest">
<xs:sequence>
<xs:element name="Analysis_Type" type="xs:string" />
<xs:element name="Analysis_Id" type="xs:string" />
<xs:element name="Customer_Id" type="xs:string" />
<xs:element name="Source_Request_Id" type="xs:string" />
<xs:element name="Destination_Request_Id" type="xs:string" />
<xs:element name="Target_Customer_Id" minOccurs="0" type="xs:string" />
<xs:element name="AnalysisFile" minOccurs="0" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="doNumAnalysisResponse">
<xs:sequence />
</xs:complexType>
<xs:element name="AuthenticationInfo" type="tns:AuthenticationInfo"/>
<xs:complexType name="AuthenticationInfo">
<xs:sequence>
<xs:element name="userName" type="xsd:string"/>
<xs:element name="password" type="xsd:string"/>
<xs:element minOccurs="0" name="authentication" type="xsd:string"/>
<xs:element minOccurs="0" name="locale" type="xsd:string"/>
<xs:element minOccurs="0" name="timeZone" type="xsd:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="doNumAnalysis">
<part name="parameters" element="tns:doNumAnalysis" />
</message>
<message name="doNumAnalysisResponse">
<part name="parameters" element="tns:doNumAnalysisResponse" />
</message>
<message name="ARAuthenticate">
<part element="tns:AuthenticationInfo" name="parameters">
</part>
</message>
<portType name="NumericAnalysisService">
<operation name="doNumAnalysis">
<input wsam:Action="http://com.analysis.num/NumericAnalysisService/doNumAnalysisRequest" message="tns:doNumAnalysis" />
<output wsam:Action="http://com.analysis.num/NumericAnalysisService/doNumAnalysisResponse" message="tns:doNumAnalysisResponse" />
</operation>
</portType>
<binding name="NumericAnalysisServicePortBinding" type="tns:NumericAnalysisService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="doNumAnalysis">
<soap:operation soapAction="" />
<input>
<soap:header message="tns:ARAuthenticate" part="parameters" use="literal">
</soap:header>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="NumericAnalysisService">
<port name="NumericAnalysisServicePort" binding="tns:NumericAnalysisServicePortBinding">
<soap:address location="https://testserver/bmcems/NumericAnalysisService" />
</port>
</service>
</definitions>
找到了上述问题的答案,问题是SOAP头的新消息部分使用了已经在使用的名称parameters
,将其重命名为authParameters
解决了这个问题。
上述WSDL中的以下更改修复了此问题:
<message name="ARAuthenticate">
<part element="tns:AuthenticationInfo" name="
parameters authParameters">
…
<soap:header message="tns:ARAuthenticate" part="
参数 authParameters" use="literal">
</soap:header>
<soap:body use="literal" />