powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Программирование [игнор отключен] [закрыт для гостей] / Вызов Web-сервиса
1 сообщений из 1, страница 1 из 1
Вызов Web-сервиса
    #36322000
rodion_x52
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Доброе время суток!
Уже 3 недели маюсь с доступом к Web-сервису... Буду очень-очень-очень признательна, если что-то подскажите.

Мне нужно вызывать Web-сервис с помощью asp (язык visual basic).

Причем, двумя способами вызываю свой тренировочный сервис, а аналогично ни одним не могу вызвать нужный мне сервис. (Сервис рабочий, т.к. вызывала делфовым клиентам и получала ответ)

Ниже приведена WSDL описания сервиса:
(http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/wsdl/?services=Z_PR1_TOPLIVO&sap-client=110)
Код: plaintext
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.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
<?xml version="1.0" encoding="UTF-8" ?> 
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0="urn:sap-com:document:sap:rfc:functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="urn:sap-com:document:sap:rfc:functions">
- <types>
- <xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions">
- <xsd:element name="Z_PR1_TOPLIVO">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="ZGJAHR">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="4" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="ZPERIOD">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="2" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="ZTOPLIVO">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="s0:ZTOPL" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
  </xsd:all>
  </xsd:complexType>
  </xsd:element>
- <xsd:element name="Z_PR1_TOPLIVO.Response">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="ZTOPLIVO">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="s0:ZTOPL" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
  </xsd:all>
  </xsd:complexType>
  </xsd:element>
- <xsd:complexType name="ZTOPL">
- <xsd:sequence>
- <xsd:element name="GJAHR" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="4" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="PERIOD" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="2" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="STAN" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="30" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="TOPLIVO" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="30" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="TYP" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="2" /> 
  <xsd:pattern value="\d*" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="VERSN" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="RASHOD" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:decimal">
  <xsd:totalDigits value="15" /> 
  <xsd:fractionDigits value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="EI_R" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="PROIZ" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:decimal">
  <xsd:totalDigits value="15" /> 
  <xsd:fractionDigits value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="EI_P" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
- <xsd:element name="UDEL" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:decimal">
  <xsd:totalDigits value="15" /> 
  <xsd:fractionDigits value="3" /> 
  </xsd:restriction>
  </xsd:simpleType>
  </xsd:element>
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>
  </types>
- <message name="Z_PR1_TOPLIVOInput">
  <part name="parameters" element="s0:Z_PR1_TOPLIVO" /> 
  </message>
- <message name="Z_PR1_TOPLIVOOutput">
  <part name="parameters" element="s0:Z_PR1_TOPLIVO.Response" /> 
  </message>
- <portType name="Z_PR1_TOPLIVOPortType">
- <operation name="Z_PR1_TOPLIVO">
  <input message="s0:Z_PR1_TOPLIVOInput" /> 
  <output message="s0:Z_PR1_TOPLIVOOutput" /> 
  </operation>
  </portType>
- <binding name="Z_PR1_TOPLIVOBinding" type="s0:Z_PR1_TOPLIVOPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <operation name="Z_PR1_TOPLIVO">
  <soap:operation soapAction="http://www.sap.com/Z_PR1_TOPLIVO" /> 
- <input>
  <soap:body use="literal" /> 
  </input>
- <output>
  <soap:body use="literal" /> 
  </output>
  </operation>
  </binding>
- <service name="Z_PR1_TOPLIVOService">
  <documentation>SAP Service Z_PR1_TOPLIVO via SOAP</documentation> 
- <port name="Z_PR1_TOPLIVOPortType" binding="s0:Z_PR1_TOPLIVOBinding">
  <soap:address location="http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/rfc" /> 
  </port>
  </service>
  </definitions>








Клиента формирую двумя способами:

1) Error Type:
msxml3.dll (0x80070005)
Отказано в доступе.
Указывает на строку:
Call objXMLHTTP.send(strMethodPkg)

Код: plaintext
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.
<%
Dim objXMLHTTP : SET  objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
 
Dim strMethodPkg
Dim strMethodResultXML

'on error resume next

strMethodPkg ="<?xml version=""1.1"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg &"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:mod=""http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/rfc"">"
strMethodPkg = strMethodPkg & "<soapenv:Header/>"
strMethodPkg = strMethodPkg & "<soapenv:Body>"
strMethodPkg = strMethodPkg & "<Z_PR1_TOPLIVO xmlns=""http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/rfc"">"
strMethodPkg = strMethodPkg & "<mod:userId>soap_gaz</mod:userId>"
strMethodPkg = strMethodPkg & "<mod:password>20091609</mod:password>"

strMethodPkg = strMethodPkg & "<mod:params>"
strMethodPkg = strMethodPkg & "<mod:ZGJAHR>'FF'</mod:ZGJAHR>"
strMethodPkg = strMethodPkg & "<mod:ZPERIOD>'GG'</mod:ZPERIOD>"
strMethodPkg = strMethodPkg & "<mod:ZTOPLIVO>'HH'</mod:ZTOPLIVO>"
strMethodPkg = strMethodPkg & "</mod:params>"

strMethodPkg = strMethodPkg & "</Z_PR1_TOPLIVO>"
strMethodPkg = strMethodPkg & "</soapenv:Body>"
strMethodPkg = strMethodPkg & "</soapenv:Envelope>"
 
objXMLHTTP.open "post", "http://qas-r3.chmk.mechelgroup.ru: 8007 /sap/bc/soap/rfc", False
 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf- 8 "
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
 
 
objXMLHTTP.setRequestHeader "SOAPAction", "http://www.sap.com/Z_PR1_TOPLIVO"
 
Call objXMLHTTP.send(strMethodPkg)
 
strMethodResultXML = objXMLHTTP.responsetext
 
Response.Write strMethodResultXML
%>


2) Ошибка: "Ошибка1 Объект не инициализирован"
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Option Explicit
dim SOAPClient
Set SoapClient = CreateObject("MSSOAP.SoapClient30")
on error resume next
Call SoapClient.mssoapinit ("http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/rfc", "Z_PR1_TOPLIVOService", "Z_PR1_TOPLIVOPortType")
SoapClient.ConnectorProperty("EndPointURL")="http://qas-r3.chmk.mechelgroup.ru:8007/sap/bc/soap/rfc"

SoapClient.ConnectorProperty("AuthUser") = "soap_gaz"
SoapClient.ConnectorProperty("AuthPassword")="20091609"

if err <>  0  then
  wscript.echo "Ошибка1 " + err.description
end if

wscript.echo SOAPClient.Z_PR1_TOPLIVO("uf","af")

if err <>  0  then
    wscript.echo "Ошибка2"
  wscript.echo   err.description
end if



Что интересно, вызываю свой тренировочный сервис, но расположенный в другом месте, и доступ без пользователя и пароля
(http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl):

Код: plaintext
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.
  <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions targetNamespace="http://192.168.90.53:8080/axis/services/wsUzk.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://192.168.90.53:8080/axis/services/wsUzk.jws" xmlns:intf="http://192.168.90.53:8080/axis/services/wsUzk.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!-- 
WSDL created by Apache Axis version:  1 . 4 
Built on Apr  22 ,  2006  ( 06 : 55 : 48  PDT)

  --> 
- <wsdl:message name="InsertZakazResponse">
  <wsdl:part name="InsertZakazReturn" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="DeleteZakazResponse">
  <wsdl:part name="DeleteZakazReturn" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="InsertZakazRequest">
  <wsdl:part name="melt" type="xsd:string" /> 
  <wsdl:part name="task_id" type="xsd:int" /> 
  <wsdl:part name="meltpos_id" type="xsd:int" /> 
  <wsdl:part name="gost" type="xsd:string" /> 
  <wsdl:part name="mark" type="xsd:string" /> 
  <wsdl:part name="mark_pos" type="xsd:string" /> 
  <wsdl:part name="dt_date" type="xsd:string" /> 
  <wsdl:part name="part" type="xsd:string" /> 
  <wsdl:part name="ll_mill_id" type="xsd:int" /> 
  <wsdl:part name="thk" type="xsd:int" /> 
  <wsdl:part name="wdt_min" type="xsd:int" /> 
  <wsdl:part name="len_prod" type="xsd:int" /> 
  <wsdl:part name="value" type="xsd:int" /> 
  <wsdl:part name="commentary" type="xsd:string" /> 
  <wsdl:part name="controler" type="xsd:string" /> 
  <wsdl:part name="prof" type="xsd:string" /> 
  <wsdl:part name="gost_uzk" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="getEchoResponse">
  <wsdl:part name="getEchoReturn" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="getEchoRequest">
  <wsdl:part name="str" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:message name="DeleteZakazRequest">
  <wsdl:part name="task_id" type="xsd:int" /> 
  <wsdl:part name="controler" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:portType name="wsUzk">
- <wsdl:operation name="InsertZakaz" parameterOrder="melt task_id meltpos_id gost mark mark_pos dt_date part ll_mill_id thk wdt_min len_prod value commentary controler prof gost_uzk">
  <wsdl:input message="impl:InsertZakazRequest" name="InsertZakazRequest" /> 
  <wsdl:output message="impl:InsertZakazResponse" name="InsertZakazResponse" /> 
  </wsdl:operation>
- <wsdl:operation name="DeleteZakaz" parameterOrder="task_id controler">
  <wsdl:input message="impl:DeleteZakazRequest" name="DeleteZakazRequest" /> 
  <wsdl:output message="impl:DeleteZakazResponse" name="DeleteZakazResponse" /> 
  </wsdl:operation>
- <wsdl:operation name="getEcho" parameterOrder="str">
  <wsdl:input message="impl:getEchoRequest" name="getEchoRequest" /> 
  <wsdl:output message="impl:getEchoResponse" name="getEchoResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="wsUzkSoapBinding" type="impl:wsUzk">
  <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="InsertZakaz">
  <wsdlsoap:operation soapAction="" /> 
- <wsdl:input name="InsertZakazRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="InsertZakazResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.90.53:8080/axis/services/wsUzk.jws" use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="DeleteZakaz">
  <wsdlsoap:operation soapAction="" /> 
- <wsdl:input name="DeleteZakazRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="DeleteZakazResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.90.53:8080/axis/services/wsUzk.jws" use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="getEcho">
  <wsdlsoap:operation soapAction="" /> 
- <wsdl:input name="getEchoRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="getEchoResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://192.168.90.53:8080/axis/services/wsUzk.jws" use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="wsUzkService">
- <wsdl:port binding="impl:wsUzkSoapBinding" name="wsUzk">
  <wsdlsoap:address location="http://192.168.90.53:8080/axis/services/wsUzk.jws" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>







Его вызываю так же двумя аналогичными способами, и получаю правильный ответ:

1)
Код: plaintext
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.
<%
Dim objXMLHTTP : SET  objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
 
Dim strMethodPkg
Dim strMethodResultXML
 
'on error resume next

strMethodPkg ="<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg &"<soap-env:Envelope xmlns:soap-env=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:mod=""http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl"">"

strMethodPkg = strMethodPkg & "<soap-env:Body>"
strMethodPkg = strMethodPkg & "<getEcho xmlns=""http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl"">"
strMethodPkg = strMethodPkg & "<mod:str>ufff</mod:str>"
strMethodPkg = strMethodPkg & "</getEcho>"
strMethodPkg = strMethodPkg & "</soap-env:Body>"
strMethodPkg = strMethodPkg & "</soap-env:Envelope>"
 
objXMLHTTP.open "post", "http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl", False
 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
 
 
objXMLHTTP.setRequestHeader "SOAPAction", "http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl"
 
Call objXMLHTTP.send(strMethodPkg)
 
strMethodResultXML = objXMLHTTP.responsetext
 
Response.Write strMethodResultXML%>


2)
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
dim SOAPClient
Set SoapClient = CreateObject("MSSOAP.SoapClient30")
on error resume next
Call SoapClient.mssoapinit ("http://192.168.90.53:8080/axis/services/wsUzk.jws?wsdl", "wsUzkService", "wsUzk")
SoapClient.ConnectorProperty("EndPointURL")="http://192.168.90.53:8080/axis/services/wsUzk.jws"


if err <>  0  then
  wscript.echo "Ошибка1"+"initialization failed " + err.description
end if


wscript.echo SOAPClient.GetEcho("ufff")

  if err <>  0  then
    wscript.echo "Ошибка2"
  wscript.echo   err.description
end if
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Программирование [игнор отключен] [закрыт для гостей] / Вызов Web-сервиса
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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