http://www.itpub.net/thread-1035178-1-6.html
按照这个网站提供的资料信息通过 wsdl 生成的 cs:
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Web.Services.WebServiceBindingAttribute(Name = "IsmpSpEngineSoapBinding", Namespace = "http://sp.ismp.chinatelecom.com")]
public interface IIsmpSpEngineSoapBinding
{ /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("orderRelationUpdateNotifyReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
Response orderRelationUpdateNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] OrderRelationUpdateNotifyReq orderRelationUpdateNotifyReq); /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("serviceConsumeNotifyReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
Response serviceConsumeNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] ServiceConsumeNotifyReq serviceConsumeNotifyReqPara); /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("notifyManagementInfoReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
NotifyManagementInfoRsp notifyManagementInfo([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] NotifyManagementInfoReq notifyManagementInfoReq);
}
写的方法:/// <summary>
/// NotifyManagementInfoService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class NotifyManagementInfoService : InterFaceIIsmpSp.IIsmpSpEngineSoapBinding
{ public NotifyManagementInfoService()
{ //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
} [WebMethod]
public InterFaceIIsmpSp.NotifyManagementInfoRsp notifyManagementInfo(InterFaceIIsmpSp.NotifyManagementInfoReq notifyManagementInfoReq)
{
InterFaceIIsmpSp.NotifyManagementInfoRsp notifyManagementInfoRsp = new InterFaceIIsmpSp.NotifyManagementInfoRsp();
notifyManagementInfoRsp.resultCode = 0;
notifyManagementInfoRsp.streamingNo = notifyManagementInfoReq.streamingNo;
return notifyManagementInfoRsp;
}
[WebMethod]
public InterFaceIIsmpSp.Response serviceConsumeNotify(InterFaceIIsmpSp.ServiceConsumeNotifyReq serviceConsumeNotifyReqPara)
{
InterFaceIIsmpSp.Response serviceConsumeNotifyRsp = new InterFaceIIsmpSp.Response();
serviceConsumeNotifyRsp.resultCode = 0;
serviceConsumeNotifyRsp.streamingNo = serviceConsumeNotifyReqPara.streamingNo; return serviceConsumeNotifyRsp;
}
[WebMethod]
public InterFaceIIsmpSp.Response orderRelationUpdateNotify(InterFaceIIsmpSp.OrderRelationUpdateNotifyReq orderRelationUpdateNotify)
{
InterFaceIIsmpSp.Response orderRelationUpdateNotifyRsp = new InterFaceIIsmpSp.Response();
orderRelationUpdateNotifyRsp.resultCode = 0;
orderRelationUpdateNotifyRsp.streamingNo = orderRelationUpdateNotify.streamingNo; return orderRelationUpdateNotifyRsp;
}}
调用出错“/WebSite”应用程序中的服务器错误。
--------------------------------------------------------------------------------System.Web.Services.Protocols.SoapException: 方法 serviceConsumeNotify 和 notifyManagementInfo 使用相同的 SOAPAction“”。当 XML Web services 的 RoutingStyle 为 SoapAction 时,SOAPAction 值在 XML Web services 的所有方法中必须是唯一的。可以通过 SoapDocumentMethod 或 SoapRpcMethod 属性的 Action 参数更改 SOAPAction,也可以指定 XML Web services 上 RequestElement 的 RoutingStyle。
请高手解答....急等...
按照这个网站提供的资料信息通过 wsdl 生成的 cs:
/// <res/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Web.Services.WebServiceBindingAttribute(Name = "IsmpSpEngineSoapBinding", Namespace = "http://sp.ismp.chinatelecom.com")]
public interface IIsmpSpEngineSoapBinding
{ /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("orderRelationUpdateNotifyReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
Response orderRelationUpdateNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] OrderRelationUpdateNotifyReq orderRelationUpdateNotifyReq); /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("serviceConsumeNotifyReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
Response serviceConsumeNotify([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] ServiceConsumeNotifyReq serviceConsumeNotifyReqPara); /// <res/>
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("notifyManagementInfoReturn", Namespace = "http://sp.ismp.chinatelecom.com")]
NotifyManagementInfoRsp notifyManagementInfo([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://sp.ismp.chinatelecom.com")] NotifyManagementInfoReq notifyManagementInfoReq);
}
写的方法:/// <summary>
/// NotifyManagementInfoService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class NotifyManagementInfoService : InterFaceIIsmpSp.IIsmpSpEngineSoapBinding
{ public NotifyManagementInfoService()
{ //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
} [WebMethod]
public InterFaceIIsmpSp.NotifyManagementInfoRsp notifyManagementInfo(InterFaceIIsmpSp.NotifyManagementInfoReq notifyManagementInfoReq)
{
InterFaceIIsmpSp.NotifyManagementInfoRsp notifyManagementInfoRsp = new InterFaceIIsmpSp.NotifyManagementInfoRsp();
notifyManagementInfoRsp.resultCode = 0;
notifyManagementInfoRsp.streamingNo = notifyManagementInfoReq.streamingNo;
return notifyManagementInfoRsp;
}
[WebMethod]
public InterFaceIIsmpSp.Response serviceConsumeNotify(InterFaceIIsmpSp.ServiceConsumeNotifyReq serviceConsumeNotifyReqPara)
{
InterFaceIIsmpSp.Response serviceConsumeNotifyRsp = new InterFaceIIsmpSp.Response();
serviceConsumeNotifyRsp.resultCode = 0;
serviceConsumeNotifyRsp.streamingNo = serviceConsumeNotifyReqPara.streamingNo; return serviceConsumeNotifyRsp;
}
[WebMethod]
public InterFaceIIsmpSp.Response orderRelationUpdateNotify(InterFaceIIsmpSp.OrderRelationUpdateNotifyReq orderRelationUpdateNotify)
{
InterFaceIIsmpSp.Response orderRelationUpdateNotifyRsp = new InterFaceIIsmpSp.Response();
orderRelationUpdateNotifyRsp.resultCode = 0;
orderRelationUpdateNotifyRsp.streamingNo = orderRelationUpdateNotify.streamingNo; return orderRelationUpdateNotifyRsp;
}}
调用出错“/WebSite”应用程序中的服务器错误。
--------------------------------------------------------------------------------System.Web.Services.Protocols.SoapException: 方法 serviceConsumeNotify 和 notifyManagementInfo 使用相同的 SOAPAction“”。当 XML Web services 的 RoutingStyle 为 SoapAction 时,SOAPAction 值在 XML Web services 的所有方法中必须是唯一的。可以通过 SoapDocumentMethod 或 SoapRpcMethod 属性的 Action 参数更改 SOAPAction,也可以指定 XML Web services 上 RequestElement 的 RoutingStyle。
请高手解答....急等...
参考
1、是否有相同的函数名,同时写了[WebMethod]
2、返回的对象类,有没有写[WebService...]感觉第一个可能性比较大。
第一种:
在类前面加上
[System.Web.Services.Protocols.SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]第二种:用不同的soapAction值