var binding = new BasicHttpBinding {AllowCookies = true}; using (var svc = new ServiceReference1.MyWSClient(binding, new EndpointAddress("http://localhost:8080/myApp/myWS")));
/** * Creates a new {@link EndpointAddress} with a reasonably * generic error handling. */ public static EndpointAddress create(String url) { try { return new EndpointAddress(url); } catch(URISyntaxException e) { throw new WebServiceException("Illegal endpoint address: "+url,e); } }
var basicHttpBinding = new BasicHttpBinding(); basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; var endpoint = new EndpointAddress("http://example.com/myWindowsAuthN"); var client = new MyBeanClient(basicHttpBinding, endpoint); client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; client.ChannelFactory.Credentials.Windows.ClientCredential.Domain = "domain"; client.ChannelFactory.Credentials.Windows.ClientCredential.UserName = "username"; client.ChannelFactory.Credentials.Windows.ClientCredential.Password = "password";
/** * Creates a new {@link EndpointAddress} with a reasonably * generic error handling. */ public static EndpointAddress create(String url) { try { return new EndpointAddress(url); } catch(URISyntaxException e) { throw new WebServiceException("Illegal endpoint address: "+url,e); } }
/** * Creates a new {@link EndpointAddress} with a reasonably * generic error handling. */ public static EndpointAddress create(String url) { try { return new EndpointAddress(url); } catch(URISyntaxException e) { throw new WebServiceException("Illegal endpoint address: "+url,e); } }
var endpoint = new EndpointAddress("http://<ipAddress:port>/Service1.svc");
EndpointAddress ea = new EndpointAddress("http://x.x.x.x:9001/CalcService"); BasicHttpBinding bhttpb = new BasicHttpBinding()
private void Initialize() { EndpointAddress ea = new EndpointAddress("http://x.x.x.x:9001/CalcService"); BasicHttpBinding bhttpb = new BasicHttpBinding(); bhttpb.Security.Mode = BasicHttpSecurityMode.None; objCalcClient2 = new CalcServiceClient(bhttpb, ea); } public async void DoStuff() { dblResult = await Task.Run<double>(delegate { return objCalcClient2.Add(dblX, dblY); }); WriteLine(string.Format("Calling Add >> X : {0:F2} Y : {1:F2} Result : {2:F2}", dblX, dblY, dblResult)); dblResult = await Task.Run<double>(() => { return objCalcClient2.Subtract(dblX, dblY); }); WriteLine(string.Format("Calling Sub >> X : {0:F2} Y : {1:F2} Result : {2:F2}", dblX, dblY, dblResult)); dblResult = await Task.Run<double>(() => { return objCalcClient2.Multiply(dblX, dblY); }); WriteLine(string.Format("Calling Mul >> X : {0:F2} Y : {1:F2} Result : {2:F2}", dblX, dblY, dblResult)); dblResult = await Task.Run<double>(() => { return objCalcClient2.Divide(dblX, dblY); }); WriteLine(string.Format("Calling Div >> X : {0:F2} Y : {1:F2} Result : {2:F2}", dblX, dblY, dblResult)); } void WriteLine(string Text) { Debug.WriteLine(Text); }
@SuppressWarnings("ResultOfObjectAllocationIgnored") private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) { if (!replyTo.isAnonymous()) { try { new EndpointAddress(URI.create(replyTo.getAddress())); } catch (Exception e) { throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag); } } //for now only validate ReplyTo /* if (!faultTo.isAnonymous()) { try { new EndpointAddress(URI.create(faultTo.getAddress())); } catch (IllegalArgumentException e) { throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag); } } */ }
@SuppressWarnings("ResultOfObjectAllocationIgnored") private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) { if (!replyTo.isAnonymous()) { try { new EndpointAddress(URI.create(replyTo.getAddress())); } catch (Exception e) { throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag); } } //for now only validate ReplyTo /* if (!faultTo.isAnonymous()) { try { new EndpointAddress(URI.create(faultTo.getAddress())); } catch (IllegalArgumentException e) { throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag); } } */ }
@SuppressWarnings("ResultOfObjectAllocationIgnored") private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) { if (!replyTo.isAnonymous()) { try { new EndpointAddress(URI.create(replyTo.getAddress())); } catch (Exception e) { throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag); } } //for now only validate ReplyTo /* if (!faultTo.isAnonymous()) { try { new EndpointAddress(URI.create(faultTo.getAddress())); } catch (IllegalArgumentException e) { throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag); } } */ }
if (location != null) { try { port.setAddress(new EndpointAddress(location)); } catch (URISyntaxException e) { port.setAddress(new EndpointAddress("")); } catch (URISyntaxException e) {
if (location != null) { try { port.setAddress(new EndpointAddress(location)); } catch (URISyntaxException e) { port.setAddress(new EndpointAddress("")); } catch (URISyntaxException e) {
if (location != null) { try { port.setAddress(new EndpointAddress(location)); } catch (URISyntaxException e) { port.setAddress(new EndpointAddress("")); } catch (URISyntaxException e) {
adrs = new EndpointAddress(URI.create(target.getAddress())); } catch (NullPointerException e) { throw new WebServiceException(e);
adrs = new EndpointAddress(URI.create(target.getAddress())); } catch (NullPointerException e) { throw new WebServiceException(e);
adrs = new EndpointAddress(URI.create(target.getAddress())); } catch (NullPointerException e) { throw new WebServiceException(e);