powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Caché, Ensemble, DeepSee, MiniM, IRIS, GT.M [игнор отключен] [закрыт для гостей] / WEB-сервис SOAP
7 сообщений из 7, страница 1 из 1
WEB-сервис SOAP
    #36077629
13-й Пилигрим
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Добрый день, уважаемые.
Такая ситуация. Пишу некий web-сервис. У него есть метод. Описываю класс web-сервиса:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
Class IntSecurityKSS.SOAPService Extends %SOAP.WebService [ ProcedureBlock ]
{
Parameter SERVICENAME = "SOAPService";
Parameter NAMESPACE = "urn:BillingForKSS";
Parameter USECLASSNAMESPACES =  1 ;

Method CheckSessionId(SessionId As %String, Output Fio As %String, Output Login As %String, Output ResultCode As %String) [ Final, WebMethod ]
{
	s $zt="Error"
	s:$d(^%cspSession(SessionId,"0"))'= 11  $EC="SESSION_NOT_FOUND"
	s Fio="FIO"
	s Login="LOGIN"
	s ResultCode="OK"
	q
Error
	s $zt="", ResultCode=$EC, $EC=""
	q
}
Формируется такой 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.
<?xml version="1.0" encoding="UTF-8" ?> 
 <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
 xmlns:s="http://www.w3.org/2001/XMLSchema" 
 xmlns:s0="urn:BillingForKSS" 
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 targetNamespace="urn:BillingForKSS"
 xmlns="http://schemas.xmlsoap.org/wsdl/" >
  <types>
 	<s:schema elementFormDefault="qualified" targetNamespace="urn:BillingForKSS">
 		<s:element name="CheckSessionId">
 			<s:complexType>
 				<s:sequence>
					<s:element minOccurs="0" name="SessionId" type="s:string" /> 
				</s:sequence>
			</s:complexType>
		</s:element>
 		<s:element name="CheckSessionIdResponse">
 			<s:complexType>
 				<s:sequence>
					<s:element minOccurs="0" name="Fio" type="s:string" /> 
					<s:element minOccurs="0" name="Login" type="s:string" /> 
					<s:element minOccurs="0" name="ResultCode" type="s:string" /> 
				</s:sequence>
			</s:complexType>
		</s:element>
	</s:schema>
  </types>
  <message name="CheckSessionIdSoapIn">
	<part name="parameters" element="s0:CheckSessionId" /> 
  </message>
  <message name="CheckSessionIdSoapOut">
	<part name="parameters" element="s0:CheckSessionIdResponse" /> 
  </message>
  <portType name="SOAPServiceSoap">
 	<operation name="CheckSessionId">
		<input message="s0:CheckSessionIdSoapIn" /> 
		<output message="s0:CheckSessionIdSoapOut" /> 
	</operation>
  </portType>
  <binding name="SOAPServiceSoap" type="s0:SOAPServiceSoap">
	<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> 
 	<operation name="CheckSessionId">
		<soap:operation soapAction="urn:BillingForKSS/IntSecurityKSS.SOAPService.CheckSessionId" style="document" /> 
 		<input>
			<soap:body use="literal" /> 
		</input>
 		<output>
			<soap:body use="literal" /> 
		</output>
	</operation>
  </binding>
  <service name="SOAPService">
 	<port name="SOAPServiceSoap" binding="s0:SOAPServiceSoap">
		<soap:address location="http://localhost/csp/internet/IntSecurityKSS.SOAPService.cls" /> 
	</port>
  </service>
  </definitions>

Когда по сгенерированному wsdl создаю web-клиента получается такой класс:
Код: 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.
Class SOAPService.SOAPServiceSoap Extends %SOAP.WebClient
{

/// This is the URL used to access the web service.
Parameter LOCATION = "http://localhost/csp/internet/IntSecurityKSS.SOAPService.cls";

/// This is the namespace used by the Service
Parameter NAMESPACE = "urn:BillingForKSS";

/// Use xsi:type attribute for literal types.
Parameter OUTPUTTYPEATTRIBUTE =  1 ;

/// This is the name of the Service
Parameter SERVICENAME = "SOAPService";

/// This is the SOAP version supported by the service.
Parameter SOAPVERSION =  1 . 1 ;

Method CheckSessionId(SessionId As %String, Output Login As %String, Output ResultCode As %String) As %String [ Final, ProcedureBlock =  1 , SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
 Quit ..WebMethod("CheckSessionId").Invoke(##this,"urn:BillingForKSS/IntSecurityKSS.SOAPService.CheckSessionId",.SessionId,.Login,.ResultCode)
}

}
При этом в методе CheckSessionId "потерялся" один параметр - Fio и "появилось" возвращаемое значение типа %String. Причем, как показывают опыты, именно в значении, возвращаемом этим методом находится значение, соответсвующее параметру Fio в методе web-сервиса.
Что это такое может быть?
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36077644
13-й Пилигрим
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Да, и еще. При тестировани web-сервиса через web-интерфейс все отображается как надо:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
  <?xml version="1.0" encoding="UTF-8" ?> 
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <CheckSessionIdResponse xmlns="urn:BillingForKSS">
  <Fio>FIO</Fio> 
  <Login>LOGIN</Login> 
  <ResultCode>OK</ResultCode> 
  </CheckSessionIdResponse>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36077908
А может быть ворона...
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А если сделать метод не с пустым возвратом, а например с %Status, тогда полегчает?
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36077929
servit
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
13-й ПилигримПри этом в методе CheckSessionId "потерялся" один параметр - Fio и "появилось" возвращаемое значение типа %String. Причем, как показывают опыты, именно в значении, возвращаемом этим методом находится значение, соответсвующее параметру Fio в методе web-сервиса.
Что это такое может быть?
В версии 2009.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.
Class test.MyServiceSoap Extends %SOAP.WebClient [ ProcedureBlock ]
{

/// This is the URL used to access the web service.
Parameter LOCATION = "http://localhost/csp/test/test.MyService.cls";

/// This is the namespace used by the Service
Parameter NAMESPACE = "http://tempuri.org";

/// Use xsi:type attribute for literal types.
Parameter OUTPUTTYPEATTRIBUTE =  1 ;

/// This is the name of the Service
Parameter SERVICENAME = "MyService";

/// This is the SOAP version supported by the service.
Parameter SOAPVERSION =  1 . 1 ;

Method CheckSessionId(
	SessionId As %String,
	Output Fio As %String,
	Output Login As %String,
	Output ResultCode As %String) [ Final, ProcedureBlock =  1 , SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
 Do (..WebMethod("CheckSessionId")).Invoke(##this,"http://tempuri.org/test.MyService.CheckSessionId",.SessionId,.Fio,.Login,.ResultCode)
}

}

Попробуйте вручную отредактировать определение метода.
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36176114
13-й Пилигрим
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Еще раз здравствуйте.
Теперь такой вопрос. Имеется сторонний web-сервис.
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.
93.
94.
95.
96.
97.
98.
99.
<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:s0="urn:WZForKSS"
targetNamespace="urn:WZForKSS"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="urn:WZForKSS">
      <s:element name="StopSubscription">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="unbounded" name="SubscriptionItem">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs="1" maxOccurs="1" name="Login" type="s:string" />
                  <s:element minOccurs="1" maxOccurs="1" name="ReasonCode" type="s:string" />
                  <s:element minOccurs="1" maxOccurs="1" name="StopDate" type="s:string" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

      <s:element name="StopSubscriptionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="unbounded" name="SubscriptionItem">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs="1" maxOccurs="1" name="Login" type="s:string" />
                  <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="s:string" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      
    </s:schema>
  </wsdl:types>
  
  <wsdl:message name="StopSubscriptionIn">
    <wsdl:part name="parameters" element="s0:StopSubscription" />
  </wsdl:message>
  <wsdl:message name="StopSubscriptionOut">
    <wsdl:part name="parameters" element="s0:StopSubscriptionResponse" />
  </wsdl:message>

  <wsdl:portType name="ServiceSoap">
    <wsdl:operation name="StopSubscription">
      <wsdl:input message="s0:StopSubscriptionIn" />
      <wsdl:output message="s0:StopSubscriptionOut" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="ServiceSoap" type="s0:ServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

    <wsdl:operation name="StopSubscription">
      <soap:operation soapAction="urn:WZForKSS#StopSubscription" 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="ServiceSoap12" type="s0:ServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

    <wsdl:operation name="StopSubscription">
      <soap12:operation soapAction="urn:WZForKSS#StopSubscription" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="Service">
    <wsdl:port name="ServiceSoap" binding="s0:ServiceSoap">
      <soap:address location="http://vtk2.dev.webzavod.ru/vtsoap/" />
    </wsdl:port>
    <wsdl:port name="ServiceSoap12" binding="s0:ServiceSoap12">
      <soap12:address location="http://vtk2.dev.webzavod.ru/vtsoap/" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Генерирую web-клиент в Cache 2008.2.1.902.0 Получаю следующие классы:
Service.ServiceSoap
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Class Service.ServiceSoap Extends %SOAP.WebClient
{

Parameter LOCATION = "http://vtk2.dev.webzavod.ru/vtsoap/";
Parameter NAMESPACE = "urn:WZForKSS";
Parameter OUTPUTTYPEATTRIBUTE =  1 ;
Parameter SERVICENAME = "Service";
Parameter SOAPVERSION;

Method StopSubscription(SubscriptionItem As %ListOfObjects(ELEMENTTYPE="Service.SubscriptionItem",XMLPROJECTION="element",XMLNAME="SubscriptionItem")) As %ListOfObjects(ELEMENTTYPE="Service.SubscriptionItem1",XMLPROJECTION="element",XMLNAME="SubscriptionItem") [ Final, ProcedureBlock =  1 , SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ]
{
 Quit ..WebMethod("StopSubscription").Invoke(##this,"urn:WZForKSS#StopSubscription",.SubscriptionItem)
}

}

Service.ServiceSoap.StopSubscription
Код: 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.
Import Service

Include (%occInclude, %soap)

/// This class is generated by the Service.ServiceSoap Web Service Client class.
/// This class should not be edited or modified in any way.
Class Service.ServiceSoap.StopSubscription Extends %SOAP.ProxyDescriptor [ Not ProcedureBlock ]
{

Parameter NAMESPACE = "urn:WZForKSS";

Parameter SOAPBINDINGSTYLE = "document";

Parameter SOAPBODYUSE = "literal";

Parameter SUPPRESSDOCUMENTATION =  1 ;

Parameter TYPENAMESPACE = "urn:WZForKSS";

Parameter XMLDEFAULTREFERENCE = "complete";

Parameter XMLIMPORTNAMESPACE = "urn:WZForKSS";

Parameter XMLRESULTNAME = "%Result";

Method Invoke(%Client, %Action, SubscriptionItem As %ListOfObjects(ELEMENTTYPE="Service.SubscriptionItem",XMLPROJECTION="element",XMLNAME="SubscriptionItem")) As %Library.ListOfObjects(ELEMENTTYPE="Service.SubscriptionItem1",XMLPROJECTION="element",XMLNAME="SubscriptionItem") [ ServerOnly =  1  ]
{
 Set ..SubscriptionItem=$get(SubscriptionItem)
 Do %Client.InvokeClient(##this,"StopSubscription",%Action)
 Quit ..%Result
}

Method Reset() [ ServerOnly =  1  ]
{
 Quit
}

Property %Result As list Of Service.SubscriptionItem1(XMLIO = "IN", XMLNAME = "SubscriptionItem", XMLPROJECTION = "element");

Property SubscriptionItem As list Of Service.SubscriptionItem(XMLIO = "OUT", XMLNAME = "SubscriptionItem", XMLPROJECTION = "element");

}

Service.SubscriptionItem
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Class Service.SubscriptionItem Extends (%RegisteredObject, %XML.Adaptor)
{

Parameter XMLNAME = "SubscriptionItem";
Parameter XMLSEQUENCE =  1 ;
Property Login As %String(MAXLEN = "", XMLNAME = "Login") [ Required ];
Property ReasonCode As %String(MAXLEN = "", XMLNAME = "ReasonCode") [ Required ];
Property StopDate As %String(MAXLEN = "", XMLNAME = "StopDate") [ Required ];

}

Service.SubscriptionItem1
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Class Service.SubscriptionItem1 Extends (%RegisteredObject, %XML.Adaptor)
{

Parameter XMLNAME = "SubscriptionItem";
Parameter XMLSEQUENCE =  1 ;
Parameter XMLTYPE = "SubscriptionItem";
Property Login As %String(MAXLEN = "", XMLNAME = "Login") [ Required ];
Property ResultCode As %String(MAXLEN = "", XMLNAME = "ResultCode") [ Required ];

}


Далее создаю тестовую программку:
TestSOAP
Код: 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.
TestSOAP() public
{
	s $zt="Error"
	s obj=##class(Service.ServiceSoap).%New()
	s list=##class(%Library.ListOfObjects).%New()
	
	f i= 1 : 1 : 2  {
		s itemObj=##class(Service.SubscriptionItem).%New()
		s itemObj.Login="641200515268"
		s itemObj.ReasonCode="TEST"
		s itemObj.StopDate="2009-09-02"
		d list.Insert(itemObj)
	}
	s list1=##class(%Library.ListOfObjects).%New()
	s list1=obj.StopSubscription(.list)
	s Count=list1.Count()
	w Count,!
	k
	q $$$OK
Error
	s $zt="" 
	w $EC,! 
	s $EC=""	
	k
	q $$$Error
}

Валится на строке
Код: plaintext
s list1=obj.StopSubscription(.list)
Пробовал также создать два дополнительных класса
Service.ListOfSubscriptionItem
Код: plaintext
1.
2.
3.
4.
Class Service.ListOfSubscriptionItem Extends %ListOfObjects
{
Parameter ELEMENTTYPE = "Service.SubscriptionItem";
}

Service.ListOfSubscriptionItem1
Код: plaintext
1.
2.
3.
4.
Class Service.ListOfSubscriptionItem Extends %ListOfObjects
{
Parameter ELEMENTTYPE = "Service.SubscriptionItem1";
}

Соответственно
TestSOAP
Код: 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.
TestSOAP() public
{
	s $zt="Error"
	s obj=##class(Service.ServiceSoap).%New()
	s list=##class(Service.ListOfSubscriptionItem).%New()
	
	f i= 1 : 1 : 2  {
		s itemObj=##class(Service.SubscriptionItem).%New()
		s itemObj.Login="641200515268"
		s itemObj.ReasonCode="TEST"
		s itemObj.StopDate="2009-09-02"
		d list.Insert(itemObj)
	}
	s list1=##class(Service.ListOfSubscriptionItem1).%New()
	s list1=obj.StopSubscription(.list)
	s Count=list1.Count()
	w Count,!
	k
	q $$$OK
Error
	s $zt="" 
	w $EC,! 
	s $EC=""	
	k
	q $$$Error
}

И все равно та же самая ошибка
Код: plaintext
$EC = ",ZENDOFFILE,ZZTRAP,"

Какие у кого будут соображения? На стороне web-сервиса говорят, что запросы до них доходят.
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36187305
servit
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Попробуйте поменять в wsdl:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
...
      <s:element name="StopSubscriptionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="unbounded" name="SubscriptionItem">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs="1" maxOccurs="1" name="Login" type="s:string" />
                  <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="s:string" />
                </s:sequence>
...
на
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
...
      <s:element name="StopSubscriptionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="unbounded" name="SubscriptionItemResponse">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs="1" maxOccurs="1" name="Login" type="s:string" />
                  <s:element minOccurs="1" maxOccurs="1" name="ResultCode" type="s:string" />
                </s:sequence>
...
, а затем перегенерируйте Ваш веб-клиент.

PS: Delphi Ваш wsdl тоже не "понимает". Думаю, Вам стоит обратиться в WRC.
...
Рейтинг: 0 / 0
WEB-сервис SOAP
    #36187790
Фотография DAiMor
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
а вы не пробовали при обработке ошибки посмотреть вывод
d $system.OBJ.DisplayError()
может он что-то дельного скажет, а то что скажет это точно

_________________________________
Cache for Windows NT (AMD64) 5.0.21 (Build 6408) Tue Jan 3 2006 13:37:41 EST
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / Caché, Ensemble, DeepSee, MiniM, IRIS, GT.M [игнор отключен] [закрыт для гостей] / WEB-сервис SOAP
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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