powered by simpleCommunicator - 2.0.58     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Подключение в веб-сервису
7 сообщений из 7, страница 1 из 1
Подключение в веб-сервису
    #37988648
gulyaev.s
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
есть wsdl схема

пробую подключиться программно

добавил ссылку на сервис.

код
Код: vbnet
1.
2.
3.
Dim myWS As New WindowsApplication2.WebReference.NPFService

Dim sdfv As Object = myWS.getNPFClientData("123", "2012-01-01", "2012-12-31")



пишет ошибку

Клиент обнаружил тип содержимого ответа "", но ожидается тип "text/xml".
Сбой запроса с сообщением об ошибке:
--
<?xml version='1.0' encoding='UTF-8'?><????????????_????????????????????_??????><????????????><????????????????????????><??????????????????


что может быть?





Код: 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.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://serv.ru" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://servru">
    <wsdl:documentation>NPFService</wsdl:documentation>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://serv.ru">
            <xs:element name="getVersion">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="accessKey" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="getVersionResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                    </xs:sequence>
         \
                        <xs:element minOccurs="0" name="accessKey" nillable="true" type="xs:string"/>
                        <xs:element minOccurs="0" name="dateFrom" nillable="true" type="xs:string"/>
                        <xs:element minOccurs="0" name="dateTo" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="getNPFClientDataResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="getNPFClientDataRequest">
        <wsdl:part name="parameters" element="ns:getNPFClientData"/>
    </wsdl:message>
    <wsdl:message name="getNPFClientDataResponse">
        <wsdl:part name="parameters" element="ns:getNPFClientDataResponse"/>
    </wsdl:message>
    <wsdl:message name="getVersionRequest">
        <wsdl:part name="parameters" element="ns:getVersion"/>
    </wsdl:message>
    <wsdl:message name="getVersionResponse">
        <wsdl:part name="parameters" element="ns:getVersionResponse"/>
    </wsdl:message>
    <wsdl:portType name="NPFServicePortType">
        <wsdl:operation name="getNPFClientData">
            <wsdl:input message="ns:getNPFClientDataRequest" wsaw:Action="urn:getNPFClientData"/>
            <wsdl:output message="ns:getNPFClientDataResponse" wsaw:Action="urn:getNPFClientDataResponse"/>
        </wsdl:operation>
        <wsdl:operation name="getVersion">
            <wsdl:input message="ns:getVersionRequest" wsaw:Action="urn:getVersion"/>
            <wsdl:output message="ns:getVersionResponse" wsaw:Action="urn:getVersionResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="NPFServiceSoap11Binding" type="ns:NPFServicePortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="getNPFClientData">
            <soap:operation soapAction="urn:getNPFClientData" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getVersion">
            <soap:operation soapAction="urn:getVersion" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="NPFServiceSoap12Binding" type="ns:NPFServicePortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="getNPFClientData">
            <soap12:operation soapAction="urn:getNPFClientData" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getVersion">
            <soap12:operation soapAction="urn:getVersion" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="NPFServiceHttpBinding" type="ns:NPFServicePortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="getNPFClientData">
            <http:operation location="NPFService/getNPFClientData"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getNPFClientData"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getNPFClientData"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getVersion">
            <http:operation location="NPFService/getVersion"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getVersion"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getVersion"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="NPFService">
        <wsdl:port name="NPFServiceHttpSoap11Endpoint" binding="ns:NPFServiceSoap11Binding">
            <soap:address location="http://100.100.100.00/treasure/NPFService.NPFServiceHttpSoap11Endpoint/"/>
        </wsdl:port>
        <wsdl:port name="NPFServiceHttpSoap12Endpoint" binding="ns:NPFServiceSoap12Binding">
            <soap12:address location="http://100.100.100.00/treasure/NPFService.NPFServiceHttpSoap12Endpoint/"/>
        </wsdl:port>
        <wsdl:port name="NPFServiceHttpEndpoint" binding="ns:NPFServiceHttpBinding">
            <http:address location="http://100.100.100.00/treasure/NPFService.NPFServiceHttpEndpoint/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #37998020
gulyaev.s
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
gulyaev.s,


видимо используется кодировка по умолчанию..
как в этом случае задать кодировку?

есть ли другие способы вызова этого метода?
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #37998476
Фотография ЕвгенийВ
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
gulyaev.s,
Есть доступ к web.config веб сервиса?
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #38007658
Фотография valex13
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
1. Попробуйте подключить не как ссылку на сервис (Service Reference), а как WEB ссылку (WEB reference). Для этого в окне добавления ссылки (Service Reference) в нижней правой части нажмите на кнопку "Advenced", а потом "Add Web Reference".
2. Судя по IP адресу WS : http://100.100.100.00/treasure/NPFService.NPFServiceHttpSoap11Endpoint у Вас внутренний локальный сервер. Можно узнать про него по подробней. На каких инструментах сделан. Есть VB.net (C#) - то Web.config в студию.
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #38011813
gulyaev.s
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
ЕвгенийВ,

нету...
есть только описание

POST URL: http://100.140.100.30:80/treasure/services/NPFService?wsdl

BODY:

<SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:getNPFClientData xmlns:m=" http://service.bm.ru">
<m:accessKey>210DB</m:accessKey>
<m:dateFrom>2012-06-01</m:dateFrom>
<m:dateTo>2012-12-31</m:dateTo>
</m:getNPFClientData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


как к него обратиться методом POST хотя бы?
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #38011824
gulyaev.s
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
valex13,

вот именно как веб ссылку добавил

хоть кака то подвижность появилось
но ошибка из за кодировки

пишет ошибку

Клиент обнаружил тип содержимого ответа "", но ожидается тип "text/xml".
Сбой запроса с сообщением об ошибке:
--
<?xml version='1.0' encoding='UTF-8'?><????????????_????????????????????_??????><????????????><????????????????????????><??????????????????


начало правильное, а вместе ????? должны быть русские буквы

он не может это анализировать и выдает ошибку

зная то что дано, возможно ли как то указать в каком виде нам нужна кодировка или может есть другой путь запроса?

доступа к сервису нету.... web.configa нету, только wsdl схема и пример пост запроса
...
Рейтинг: 0 / 0
Подключение в веб-сервису
    #38012622
gulyaev.s
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
gulyaev.s,

пробую другим способом, ничего не выдает


Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
    Dim url = "http://100.100.100.00:80/treasure/NPFService.NPFServiceHttpEndpoint/"

        Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create(url), HttpWebRequest)
        Dim xmlString As String = "211, 2012-06-01, 2012-12-31"
        Dim encoding As New System.Text.UTF8Encoding()
        Dim bytesToWrite As Byte() = encoding.GetBytes(xmlString)
        request.Method = "POST"
        request.ContentLength = bytesToWrite.Length

        'You need to change this

        request.Headers.Add("SOAPAction: ""http://service.bm.ru/getNPFClientData""")
        request.ContentType = "text/xml; charset=utf-8"
        Dim newStream As Stream = request.GetRequestStream()
        newStream.Write(bytesToWrite, 0, bytesToWrite.Length)
        newStream.Close()
        Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
        Dim dataStream As Stream = response.GetResponseStream()
        Dim reader1 As New StreamReader(dataStream)
        Dim responseFromServer As String = reader1.ReadToEnd()
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Подключение в веб-сервису
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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