简体   繁体   English

使用Java使用有状态的.net Web服务

[英]Consume a stateful .net web service from java

In C# I have methods that use 在C#中,我有使用的方法

   [WebMethod(EnableSession = true)]

I consume them in C# .net by using a cookiecontainer to maintain state. 我通过使用cookiecontainer维护状态在C#.net中使用它们。

How do I do the same thing in java? 我如何在Java中做同样的事情? I want to call a .net webservice with [WebMethod(EnableSession = true)] and have it maintain state between calls. 我想使用[WebMethod(EnableSession = true)]调用.net Web服务,并使其在两次调用之间保持状态。

It depends on which SOAP framework you are using. 这取决于您使用的SOAP框架。 For JAX-WS, you can enable client-side session support by setting BindingProvider.SESSION_MAINTAIN_PROPERTY to true in your request context. 对于JAX-WS,可以通过在请求上下文BindingProvider.SESSION_MAINTAIN_PROPERTY设置为true来启用客户端会话支持。 You can find an example here . 您可以在此处找到示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM