简体   繁体   中英

java web services from .net client

I am trying to make a .net client for a java web service made using JAX-WS 2.0 . Actually the web service maintains session of the client. Well i did create a client from java and it worked. But i am having problem in consuming the web service from .net client. According to the specification of that web service i have to set the SESSION_MAINTAIN_PROPERTY of the BindingProvider true to indicate whether or not the client wants to participate in session with service endpoint. It is done in java client in following way:

Hello proxy = new HelloService().getHelloPort();
((BindingProvider)proxy).getRequestContext()
    .put(BindingProvider.SESSION_MAINTAIN_PROPERTY,true);

I dont know how to do such from .net.

In older versions, there was a CookieContainer but you can use this

var binding = new BasicHttpBinding {AllowCookies = true};
using (var svc = new ServiceReference1.MyWSClient(binding, new EndpointAddress("http://localhost:8080/myApp/myWS")));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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