每个人,我在ac#asp.net网站上的(ASMX)都有一个网络服务,我收到来自销售人员的出站消息我有多种类型的通知,一种是用于其他帐户的任务,第一种是与所有人合作当我从WSDL文件生成ProxyClass时,默认的ClassNames,当我为任务和转换的WSDL文件做到ProxyClass时,它显示错误的名称彼此冲突,所以我更改了ProxyClass中的名称,如默认名称为对notificationTasks的通知,NotificationReponce到notificationsResponseTask,sObject到sObjectTask,所以当我运行接收通知的通用代码并返回Ack=true
时,默认它没有问题,但是当我尝试下面的代码时:即尝试从消息中获取值,它会中断显示服务器错误无法处理请求。我的代码:
class Tasks :INotificationBindingTasks
{
//class MyNotificationListener : INotificationBinding
public notificationsResponseTask notifications(notificationTasks notification2)
{
TaskNotification[] TaskNotification = notification2.Notification;
notificationsResponseTask r = new notificationsResponseTask();
r.Ack = true;
return r;
}
}
我在这做错了什么?
所以我看待你的问题的方式我认为我之前遇到过这个问题的解决方案,并且它很容易解决,在堆栈交换here上已经存在一个问题。
出站工作的方式是proxyCalss以这样的方式编码,以便能够成功获取通知并对其进行解码,您需要将其设置为特定形式,并且名称非常敏感,例如,您说当salesforce时您更改了notificationResponse的名称发送消息,期望返回值,其名称为notificationsResponse,您更改了这就是为什么更改Class中的名称只会导致更多问题。
现在,如果您阅读我在此答案中添加的问题,它表示您可以轻松地将第二个出站消息放入NameSpace,这对于该类是唯一的,如下所示,当您创建代理类时将整个类放入一个名称空间ex中:
namespace Customnotification
{
// The whole rest of the class comes here
}
现在,您的新Outbound消息对于其自身是唯一的,并且不会与其他ProxyClass冲突,现在在您的webservice.asmx.cs
文件中执行以下操作:
namespace Customnotification
{
public class Tasks : INotificationBinding
{
// REST of the process goes here for the receiving data from outbound
// Make sure you use the default notification names do not change them
}
试试它应该工作。谢谢!
将您的端点(出站消息)更改为要映射的特定Web服务;)
谢谢,Ajay Dubedi