| |

VerySource

 Forgot password?
 Register
Search
Author: jo_fox

How to pass an object type parameter to the web service method, please advise!

[Copy link]

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2021-4-23 13:00:02
| Show all posts
The easiest way to use 2-en-serialized sequence into Byte []
Then the WebService end is reverse sely, the array of objects you want. After the call is completed, sequentially become BYTE [] Return, the client is retrograde sequence to get the result.
[WebMethod]
Public Byte [] WebInvoke (Byte [] DATA)
{
}


Public Class Serializer
{

Private binaryformatter bf;

Public serializer ()
{
THIS.BF = New binaryformatter ();
}

Public Byte [] binaryserialize (Object Obj)
{
IF (Obj == Null)
{
Throw new argumentnullexception ("obj");
}
MemoryStream Stream1 = new memoryStream ();
THIS.BF.SERIALIZE (stream1, obj);
Return stream1.toArray ();
}

Public Object BinaryDeserialize (Byte [] DATA)
{
IF (data == null)
{
Return NULL;
}
MemoryStream Stream1 = New MemoryStream (DATA);
Return this.bf.deSerialize (stream1);
}
}
Reply

Use magic Report

1

Threads

6

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2021-4-23 13:15:02
| Show all posts
When the number of records transmitted is large, the following error prompt appears:
User code is not processed system.web.services.protocols.soapexception
  Message = "An exception occurs when the extension specified in the configuration file is run. -> More than the maximum request length."

How is this error handle?

How to transmit a lot of records, don't there?

Thank you
Reply

Use magic Report

1

Threads

6

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2021-4-23 14:15:01
| Show all posts
Oh, thank you, the problem is solved:

  <system.Web>
<httpruntime maxRequestlength = "1048576" ExecutionTimeout = "3600" />

<! -

Add as above information in Web.config.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-12-7 21:49:56
| Show all posts
序列化/反序列化不是一句两句能说清的,建议看相关资料
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list