SoapExtension客户端无法获取Soap流
public override Stream ChainStream(Stream stream){
inStream= stream;
outStream= new MemoryStream();
return outStream;
}
public override void ProcessMessage(SoapMessage message)
{
switch (message.Stage)
{
case SoapMessageStage.BeforeSerialize:
break;
case SoapMessageStage.AfterSerialize:
Stream encryptedStream = Encrypt(outStream);
Copy(encryptedStream, inStream);
break;
case SoapMessageStage.BeforeDeserialize:
Stream decryptedStream = Decrypt(inStream);
Copy(decryptedStream, outStream);
outStream.Position = 0;
break;
case SoapMessageStage.AfterDeserialize:
break;
default:
break;
}
}
想使用SOAP扩展来进行加密,于是:
我在Web Service服务器端和客户端都继承了SoapExtension基础类,并用以上
代码覆盖了ProcessMessage方法。
通过我的跟踪调试,
客户端AfterSerialize时加密Soap请求成功提交后,
服务器端BeforeDeserialize时可以获取加密的流,并且成功解密,
然后服务器端AfterSerialize时又成功的将响应的Soap流成功加密,
接着,客户端BeforeDeserialize时并不能获取从服务器端响应回来的Soap流,
(客户端接收到的inStream的Length等属性有异常发生)。
请朋友们指点指点!!!谢谢。 --------------------编程问答-------------------- 哥们你现在解决这个问题了没
补充:.NET技术 , C#