如何在wcf中使用xml?

时间:2015-11-24 11:58:37

标签: java c# android xml wcf

我想在wcf上运行post方法。我也正在开发一个Android应用程序,不知道如何格式化java上的数据以及如何在wcf端接受它。

我的wcf方法:

    public string GetURL(ExtensionsType[] Extensions, Header Header, int Amount, int CurrencyCode, string CustomerId, short CustomerIdType, short IdAndVOption, string OrderID, PreAuthOptionType PreAuthOption, string TerminalCode, short operationType)
    {          

        GetUrlRequestType keyReq = new GetUrlRequestType();

        keyReq.Extensions = Extensions;  
        keyReq.Header = Header;
        keyReq.Amount = Amount;
        keyReq.CurrencyCode = CurrencyCode;
        keyReq.CustomerId = CustomerId;
        keyReq.CustomerIdType = CustomerIdType;
        keyReq.IdAndVOption = IdAndVOption;
        keyReq.OrderID = OrderID;
        keyReq.PreAuthOption = PreAuthOption;
        keyReq.TerminalCode = TerminalCode;
        keyReq.operationType = operationType;

        GetUrlResponseType keyResp = new GetUrlResponseType();

        keyResp = reff.PSP_GetUrl(keyReq);

        return new JavaScriptSerializer().Serialize(keyResp);
    }

现在它接受所有的参数,我想让它接受参数为xml。

接口方:

[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, )]
string GetURL(ExtensionsType[] Extensions, Header Header, int Amount, int CurrencyCode, string CustomerId, short CustomerIdType, short IdAndVOption, string OrderID, PreAuthOptionType PreAuthOption, string TerminalCode, short operationType);

如何将xml作为参数修改此方法。以及如何根据这些参数在java端准备一个xml。

0 个答案:

没有答案