SoFunction
Updated on 2025-03-07

c# JSON return format WEB SERVICE


namespace {
using System;
using ;
using ;
using ;
using ;
using ;
using IWebs;
[WebService (Name="cjjer",Description="A WebService that returns user information and order information, the requested mobile phone number is up to 12 digits",Namespace="/webs/")]
[]
public class cjjer:WebService{
public class ReqHeader : SoapHeader{
public string userName;
public string password;
}
public ReqHeader header;
[WebMethod (Description ="Input the int value ID of a single user, return the user class",MessageName="GetUser",EnableSession = false)]
[ScriptMethod(ResponseFormat = )]
[SoapHeader("header", Direction = )]
public GetUser(int uid){
(header);
return (new ()).GetById(uid);
}
[WebMethod (Description ="Enter a user's mobile phone number and return to user class",MessageName="GetUserByMobile",EnableSession = false)]
[ScriptMethod(ResponseFormat=)]
[SoapHeader("header", Direction = )]
public GetUserByMobile(string umobile){
(header);
return (new ()).GetByMobile(umobile);
}
[WebMethod (Description ="Enter a user's mobile number and return to the order array",MessageName="GetOrdersByMobile",EnableSession = false)]
[ScriptMethod(ResponseFormat=)]
[SoapHeader("header", Direction = )]
public [] GetOrdersByMobile(string umobile){
(header);
return (new ()).GetByMobile(umobile,-365);
}
[WebMethod (Description ="Input the ID of a user and return the order array",MessageName="GetOrdersByUserId",EnableSession = false)]
[ScriptMethod(ResponseFormat=)]
[SoapHeader("header", Direction = )]
public [] GetOrdersByUserId(int uid){
(header);
return (new ()).GetOrdersByUserId(uid,-365);
}
private void ChechHeader(ReqHeader header){
if (header != null){
if ()
{
string UserName = ;
string PassWord = ;
if (UserName == "cjjer" && PassWord == "000000")
{
return ;
}
else
{
throw new ApplicationException (("Username[{0}] or password[{1}] error",UserName,PassWord));
}
}
else
{
throw new ApplicationException ("The message header format containing username and password information is incorrect");
}
}
else
{
throw new ApplicationException ("Please submit a message header containing username and password information");
}
}
};
}