我们已经开发了一个使用C#.net应用程序的Web服务,但是这个Web服务无法被SAP应用程序使用而得到错误:无法处理没有有效操作参数的请求
会出现什么问题?
WSDL文件:
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://sabretch.com/psr" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://sabretch.com/psr">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://sabretch.com/psr">
<s:element name="SendChangeLog">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="toDetails" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="subject" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="arr_psrAlertLogItems" type="tns:ArrayOfObj"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfObj">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Obj" nillable="true" type="tns:Obj"/>
</s:sequence>
</s:complexType>
<s:complexType name="Obj">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ChangeDateTime" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="SalesOrderKey" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Line" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FieldTecnicalName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ChangedUser" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="SendChangeLogResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SendChangeLogResult" type="s:boolean"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="SendChangeLogSoapIn">
<wsdl:part name="parameters" element="tns:SendChangeLog"/>
</wsdl:message>
<wsdl:message name="SendChangeLogSoapOut">
<wsdl:part name="parameters" element="tns:SendChangeLogResponse"/>
</wsdl:message>
<wsdl:portType name="PSREmailServiceSoap">
<wsdl:operation name="SendChangeLog">
<wsdl:input message="tns:SendChangeLogSoapIn"/>
<wsdl:output message="tns:SendChangeLogSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PSREmailServiceSoap" type="tns:PSREmailServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SendChangeLog">
<soap:operation soapAction="http://sabretch.com/psr/SendChangeLog" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="PSREmailServiceSoap12" type="tns:PSREmailServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SendChangeLog">
<soap12:operation soapAction="http://sabretch.com/psr/SendChangeLog" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PSREmailService">
<wsdl:port name="PSREmailServiceSoap" binding="tns:PSREmailServiceSoap">
<soap:address location="http://122.255.30.75:8090/WebServices/PSREmailService.asmx"/>
</wsdl:port>
<wsdl:port name="PSREmailServiceSoap12" binding="tns:PSREmailServiceSoap12">
<soap12:address location="http://122.255.30.75:8090/WebServices/PSREmailService.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
答案 0 :(得分:0)
发送SOAP请求时,部分HTTP Header数据必须包含SOAP Action字段,以便正确识别(使用WDSL)要执行的方法。在C#中,这是根据发送消息时提供的操作自动处理的,这解释了为什么你现在会遇到问题。
由于我不太熟悉SAP,我无法提供一个例子,但是这些知识应该让你在正确的轨道上开始。