Имя: Пароль:
1C
1С v8
Ошибка при подключении к WEB сервису
0 oleg_prg
 
11.06.12
23:07
В чистой конфигурации 1С8.2 создал WEB сервис
при обращении из браузера по строке http://localhost:8080/ws/web1?wsdl все ок - получаю ответ от сервиса типа
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" и т.д.

В 1С пишу
Процедура ЗапроситьВебСервис()
   
   Сообщить("Попали!");
   Сервис1 = WSСсылки.WSСсылка1.СоздатьWSПрокси("http://localhost:8080/ws/","web1", "web1Soap");  //ЗДЕСЬ ОШИБКА!!!
   Сервис1.Пользователь = "Админ";
   Сервис1.Пароль = "";
   Ответ = "Получили: " + Сервис1.Получить("тест");
   
   Сообщить(Ответ);


{Обработка.ОбращениеЧерезWebСервис.Форма.Форма.Форма(5)}: Ошибка при вызове метода контекста (СоздатьWSПрокси)
   Сервис1 = WSСсылки.WSСсылка1.СоздатьWSПрокси("http://localhost:8080/ws/","web1", "web1Soap");
по причине:
Сервис не найден. {http://localhost:8080/ws/}:web1

Как побороть???


   
КонецПроцедуры
1 oleg_prg
 
11.06.12
23:12
Параметр №1 в СоздатьWSПрокси делал таким
1 http://localhost:8080/ws/web1?wsdl
2 http://localhost:8080/ws/web1
3 http://localhost:8080/ws/
4 http://localhost:8080/ws
5 http://localhost:8080/
6 http://localhost:8080
7 http://localhost

Сервис реально работает, т.к. вот отрывки из ответа в браузере

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12bind="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="ws" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="ws" xmlns:xsd2="http://v8.1c.ru/8.1/data/core" xmlns:xsd3="http://v8.1c.ru/8.2/virtual-resource-system" name="web1" targetNamespace="ws">

..........


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xs1="http://v8.1c.ru/8.1/data/core" xmlns:xs2="http://v8.1c.ru/8.2/virtual-resource-system" xmlns:xs3="ws" targetNamespace="ws" elementFormDefault="qualified">
<xs:import namespace="http://v8.1c.ru/8.1/data/core"/>
<xs:import namespace="http://v8.1c.ru/8.2/virtual-resource-system"/>
<xs:element name="Get1">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="Get1Response">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:string" nillable="true"/>
<xs:element name="Param1" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</types>
<message name="Get1RequestMessage">
<part name="parameters" element="tns:Get1"/>
</message>
<message name="Get1ResponseMessage">
<part name="parameters" element="tns:Get1Response"/>
</message>
<portType name="web1PortType">
<operation name="Get1">
<input message="tns:Get1RequestMessage"/>
<output message="tns:Get1ResponseMessage"/>
</operation>
</portType>
<binding name="web1SoapBinding" type="tns:web1PortType">
<soapbind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Get1">
<soapbind:operation style="document" soapAction="ws#web1:Get1"/>
<input>
<soapbind:body use="literal"/>
</input>
<output>
<soapbind:body use="literal"/>
</output>
</operation>
</binding>
<binding name="web1Soap12Binding" type="tns:web1PortType">
<soap12bind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Get1">
<soap12bind:operation style="document" soapAction="ws#web1:Get1"/>
<input>
<soap12bind:body use="literal"/>
</input>
<output>
<soap12bind:body use="literal"/>
</output>
</operation>
</binding>
<service name="web1">
<port name="web1Soap" binding="tns:web1SoapBinding">
<documentation>
<wsi:Claim xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" conformsTo="http://ws-i.org/profiles/basic/1.1"/>
</documentation>
<soapbind:address location="/ws/web1"/>
</port>
<port name="web1Soap12" binding="tns:web1Soap12Binding">
<soap12bind:address location="/ws/web1"/>
</port>
</service>
</definitions>
2 oleg_prg
 
11.06.12
23:24
ток что сделал по реально работающему примеру
Прокси = WSСсылки.НБРФ.СоздатьWSПрокси("http://www.cbr.ru", "DailyInfo","DailyInfoSoap");

Ссылка http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx?wsdl

Опять таже ошибка
{Обработка.ОбращениеЧерезWebСервис.Форма.Форма.Форма(5)}: Ошибка при вызове метода контекста (СоздатьWSПрокси)
   Прокси = WSСсылки.НБРФ.СоздатьWSПрокси("http://www.cbr.ru", "DailyInfo","DailyInfoSoap");
по причине:
Сервис не найден. {http://www.cbr.ru}:DailyInfo
3 oleg_prg
 
11.06.12
23:30
Моя платформа 1С:Предприятие 8.2 (8.2.15.289)
4 oleg_prg
 
11.06.12
23:35
Тоже самое сделал в 1С:Предприятие 8.1 (8.1.15.14) - таже ошибка
5 oleg_prg
 
12.06.12
00:03
Решил!!!
6 IamAlexy
 
12.06.12
00:05
ну тогда пиши как решил уж..
7 oleg_prg
 
12.06.12
00:18
Ошибка была в строке подключения
СоздатьWSПрокси("http://localhost:8080/ws/","web1", "web1Soap");
именно здесь http://localhost:8080/ws/

Надо в браузер ввести ссылку на вэб сервис, в данном случае это  http://localhost:8080/ws/web1?wsdl

затем в открывшемся описании в начале файла ищите вот что:
name="web1" targetNamespace="1c"

в данном случае web1- это имя сервиса (параметр ;2), а 1с - это параметр №1
сейас моя строка подключения такая Сервис1 = WSСсылки.WSСсылка1.СоздатьWSПрокси("1c","web1", "web1Soap");

Если надо подключиться к НБРФ http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx?wsdl
то там параметр №1 это targetNamespace="http://web.cbr.ru/"
Здесь можно обсудить любую тему при этом оставаясь на форуме для 1Сников, который нужен для работы. Ymryn