C# Apache Axis客户端、ASMX服务、阵列不兼容问题

C# Apache Axis客户端、ASMX服务、阵列不兼容问题,c#,soap,asmx,axis,C#,Soap,Asmx,Axis,我有一个由ApacheAxis客户端调用的.NETWeb服务。他们在我们的服务上调用了一个名为getBulkBalance的方法,该方法可以为活跃玩家获取游戏中的余额,例如滚动股票等。该调用对于单个玩家请求很有效,但对于多个请求则无效,这使得getBulkBalance非常。。。无用,因为还有一个getBalance方法 这是因为有多个节点,如下所示: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/en

我有一个由ApacheAxis客户端调用的.NETWeb服务。他们在我们的服务上调用了一个名为
getBulkBalance
的方法,该方法可以为活跃玩家获取游戏中的余额,例如滚动股票等。该调用对于单个玩家请求很有效,但对于多个请求则无效,这使得
getBulkBalance
非常。。。无用,因为还有一个
getBalance
方法

这是因为有多个节点,如下所示:

  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
    <soapenv:Header/>
    <soapenv:Body>
      <tem:GetBulkBalanceRequest>
         <!--Optional:-->
         <tem:secureLogin>login</tem:secureLogin>
         <!--Optional:-->
         <tem:securePassword>password</tem:securePassword>
         <!--Zero or more repetitions:-->
         <tem:playerIDList>60</tem:playerIDList>
         <tem:playerIDList>61</tem:playerIDList>
      </tem:GetBulkBalanceRequest>
   </soapenv:Body>
 </soapenv:Envelope>
GetBulkBalancerRequest如下所示:

[Serializable]
public class GetBulkBalanceRequest
{
    [XmlElement(Namespace = Constants.ServiceNamespace)]
    public string secureLogin;
    [XmlElement(Namespace = Constants.ServiceNamespace)]
    public string securePassword;
    [XmlElement(Namespace = Constants.ServiceNamespace)]
    public Int64[] playerIDList;
}
关于如何让Axis和WCF玩得更好有什么想法吗?也许我缺少了一些属性?提前谢谢

德雷克

如果客户端中没有任何更改,那么您可以将列表声明为字符串并在服务器代码中进行解析吗

[Serializable]
public class GetBulkBalanceRequest
{
    // ....
    [XmlElement(Namespace = Constants.ServiceNamespace)]
    public String playerIDList;
}
您的服务器代码为:

[WebService(Namespace = Constants.ServiceNamespace)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService1 : System.Web.Services.WebService
{
    [WebMethod]
    [SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare, Action = "GetBulkBalance")]
    [return: XmlElement(ElementName = "GetBulkBalanceResponse")]
    public GetBulkBalanceResponse GetBulkBalance(GetBulkBalanceRequest getBulkBalanceRequest)
    {
        Int64 [] ids = getBulkBalanceRequest.playerIDList
                            .Split(',')
                            .Select(s => Int64.Parse(s)).ToArray();
        return new GetBulkBalanceResponse { responseValue = "response42" };
    }
}
在我看来,您编写的是一个ASMX服务,而不是“真正的”WCF服务。 使用WCF,您可以在消息检查器中解析消息体:

  • 当然是客户端的IClientMessageInspector
  • 服务器端的IDispatcherMessageInspector

  • 希望能有所帮助

    @Derrek Dean:你到底犯了什么错误(假设你有错误?它失败了,甚至无法执行用户代码。消息本身的行为就好像它被破坏了一样。但是,使用一个值就可以了。这正在测试中-尽管他们速度很慢。玩等待游戏。奇怪的是,这就像一个魅力。太棒了!谢谢!
    [WebService(Namespace = Constants.ServiceNamespace)]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class WebService1 : System.Web.Services.WebService
    {
        [WebMethod]
        [SoapDocumentMethod(ParameterStyle = SoapParameterStyle.Bare, Action = "GetBulkBalance")]
        [return: XmlElement(ElementName = "GetBulkBalanceResponse")]
        public GetBulkBalanceResponse GetBulkBalance(GetBulkBalanceRequest getBulkBalanceRequest)
        {
            Int64 [] ids = getBulkBalanceRequest.playerIDList
                                .Split(',')
                                .Select(s => Int64.Parse(s)).ToArray();
            return new GetBulkBalanceResponse { responseValue = "response42" };
        }
    }