Web方法的输入参数变为null

问题描述 投票:0回答:1

我为现有客户端创建了一个asmx服务。该服务在SOAP UI中运行良好,但从外部客户端调用时,输入参数变为空。我尝试使用httpWebRequest从Console应用程序调用服务(不添加服务引用),问题仍然存在。这似乎只有在通过https调用服务时才会发生。奇怪的是,soapheader参数正在顺利进行。客户端将SoapAction发送为空,因此无法修改

[SoapDocumentMethodAttribute(Action = "")]

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Validate : System.Web.Services.WebService
{
    private WSSEDraftSecurityHeader _security;

    public WSSEDraftSecurityHeader Security
    {
        get { return _security; }
        set { _security = value; }

    }

    [WebMethod]
    [SoapDocumentMethodAttribute(Action = "")]
    [SoapHeader("Security", Direction = SoapHeaderDirection.InOut)]
    public ValidateResponse.validateResult validate(DateTime dt, string ac, string tc, string ot, string o, int sn, string bpb)
    {
    }
}

肥皂要求是:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <s:Header> <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <o:UsernameToken u:Id="uuid-9b091270-fad3-4cf7-bef5-58b9a57ed37e-9"> <o:Username>XXXXX</o:Username> <o:Password>iiiiii</o:Password> </o:UsernameToken> </o:Security> </s:Header> <s:Body> <validate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"> <ac>SN</ac> <bpb>TTFD</bpb> <o>PXPXS1</o> <ot>port</ot> <sn>0</sn> <tc>T2</tc> <dt>2019-04-17T18:50:36.3259364+08:00</dt> </validate> </s:Body> </s:Envelope>

正在调用Web方法并传递安全标头验证。但所有字符串参数都为空,一个日期时间参数的默认日期为01/01/0001

c# web-services
1个回答
3
投票

也许问题在于Soap请求中参数的顺序,因为它们以与方法声明中不同的顺序列出。我会比较SoapUI和Console应用程序生成的SOAP请求,然后找出差异。

© www.soinside.com 2019 - 2024. All rights reserved.