powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / WCF аутентификация
1 сообщений из 1, страница 1 из 1
WCF аутентификация
    #38549142
Pallaris
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Как в Java сделать обращение к Wcf-сервису, если там ждут логин-пароль? Пишу под андроид клиента, не могу понять.

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
protected String doInBackground(Void... inInfo)
	        {
			  HttpClient httpclient = new DefaultHttpClient();
			  
			  HttpGet httpget = new HttpGet("http://192.168.0.148:8001/EEMServices/Calculator/GetMessage");

			  String _getResponse="";
			  HttpResponse response;
			  try {
	            response = httpclient.execute(httpget);

	            HttpEntity entity = response.getEntity();

	            if (entity != null) {
	                InputStream instream = entity.getContent();
	                String result = convertStreamToString(instream);
	                _getResponse = result;
	                

	                instream.close();
	            	}

			  	} catch (Exception e) {
	            _getResponse = e.getMessage();
			  	}

			  return _getResponse;
	        }



Куда тут впихнуть логин/пароль?

сам сервис
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
<system.serviceModel>
    <services>
      <service name="EEMServices.CalculatorService"
               behaviorConfiguration="CalculatorServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress =
                "http://192.168.0.148:8001/EEMServices/" />
          </baseAddresses>
        </host>
        <endpoint address="Calculator"
               binding="wsHttpBinding"
               bindingConfiguration="Binding" 
               contract="EEMServices.ICalculator" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="Binding">
          <security mode="Message">
            <!--<transport clientCredentialType="Certificate"/>-->
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="CalculatorServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults ="true"/>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="EEMServices.CustomUserNameValidator, Service" includeWindowsGroups="false"/>
            <clientCertificate>
              <authentication certificateValidationMode="None" />
            </clientCertificate>
            <serviceCertificate findValue="1f 4e 34 60 59 ca fa 1b 91 90 dd 6c 0e 4a fe 6b 00 5e 61 90" 
                 storeLocation="LocalMachine" 
                 storeName="My" x509FindType="FindByThumbprint" /> 
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
</system.serviceModel>
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / WCF аутентификация
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]