Creating a Web Service Client in WS-I Compliance Mode


I am trying to create a web service client using Visual Studio 2010. The client works very well if I use the wsdl file in SOAP V2.
When I set the WS-I Compliance property to Yes in Magento and recompiled the web service client in VS2010, it does not work !!! Some methods disappear from the resulting WSDL file.

I found the same problem if I create a java client web service using the wsimport tool.
Any idea what is going on?

+6
source share
3 answers

I ran into the same problem and instead of commenting on the ProductAttributeRemove directory, I actually looked at the missing one and added additional sections to my wsi.xml file. Thanks to Huang R. for pointing me towards the file that needed to be fixed.

I referenced the entries for the ProductAttributeCreate directory as a checkpoint for what other sections might need to fix this. I don't know anything about WSDL, just tried to find something that might be missing.

After changing the file, I updated all the caches in Magento and confirmed that the new entries are shown in the WSDL file at /index.php/api/v2_soap?wsdl=1. Then I deleted the web link added in VS 2010 and repeated the steps to add the web link. This time after adding I did not get any errors.

The version of Magento that I fixed is Magento Enterprise 1.12.0.2, but I expect it to apply to other versions that show the same error using the ProductAttributeRemove directory.

Here is a quick diff that I ran from what I changed in the wsi.xml file:

 *** Z:\mage-1-12-0-2.dev\htdocs\app\code\core\Mage\Catalog\etc\wsi - Copy.xml backup Tue Jul 3 12:08:31 2012 UTC --- Z:\mage-1-12-0-2.dev\htdocs\app\code\core\Mage\Catalog\etc\wsi.xml Fri Nov 9 18:40:58 2012 UTC *************** *** 1509,1520 **** <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="catalogProductCurrentStoreRequest"> <wsdl:part name="parameters" element="typens:catalogProductCurrentStoreRequestParam" /> </wsdl:message> <wsdl:message name="catalogProductCurrentStoreResponse"> --- 1509,1540 ---- <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> + + + <!-- Added by Matt Johnson 2012-11-09 to fix VS 2010 support of SOAP reference --> + <xsd:element name="catalogProductAttributeRemoveRequestParam"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" /> + <xsd:element minOccurs="1" maxOccurs="1" name="attribute" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="catalogProductAttributeRemoveResponseParam"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + </xsd:schema> </wsdl:types> <wsdl:message name="catalogProductCurrentStoreRequest"> <wsdl:part name="parameters" element="typens:catalogProductCurrentStoreRequestParam" /> </wsdl:message> <wsdl:message name="catalogProductCurrentStoreResponse"> *************** *** 1883,1894 **** <wsdl:message name="catalogProductAttributeCreateRequest"> <wsdl:part name="parameters" element="typens:catalogProductAttributeCreateRequestParam" /> </wsdl:message> <wsdl:message name="catalogProductAttributeCreateResponse"> <wsdl:part name="parameters" element="typens:catalogProductAttributeCreateResponseParam" /> </wsdl:message> <wsdl:portType name="{{var wsdl.handler}}PortType"> <wsdl:operation name="catalogCategoryCurrentStore"> <wsdl:documentation>Set_Get current store view</wsdl:documentation> <wsdl:input message="typens:catalogCategoryCurrentStoreRequest" /> <wsdl:output message="typens:catalogCategoryCurrentStoreResponse" /> </wsdl:operation> --- 1903,1923 ---- <wsdl:message name="catalogProductAttributeCreateRequest"> <wsdl:part name="parameters" element="typens:catalogProductAttributeCreateRequestParam" /> </wsdl:message> <wsdl:message name="catalogProductAttributeCreateResponse"> <wsdl:part name="parameters" element="typens:catalogProductAttributeCreateResponseParam" /> </wsdl:message> + + <!-- Added by Matt Johnson 2012-11-09 to fix VS 2010 support of SOAP reference --> + <wsdl:message name="catalogProductAttributeRemoveRequest"> + <wsdl:part name="parameters" element="typens:catalogProductAttributeRemoveRequestParam" /> + </wsdl:message> + <wsdl:message name="catalogProductAttributeRemoveResponse"> + <wsdl:part name="parameters" element="typens:catalogProductAttributeRemoveResponseParam" /> + </wsdl:message> + <wsdl:portType name="{{var wsdl.handler}}PortType"> <wsdl:operation name="catalogCategoryCurrentStore"> <wsdl:documentation>Set_Get current store view</wsdl:documentation> <wsdl:input message="typens:catalogCategoryCurrentStoreRequest" /> <wsdl:output message="typens:catalogCategoryCurrentStoreResponse" /> </wsdl:operation> *************** *** 2760,2771 **** <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="{{var wsdl.name}}Service"> <wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding"> <soap:address location="{{var wsdl.url}}" /> </wsdl:port> </wsdl:service> --- 2789,2814 ---- <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> + + + <!-- Added by Matt Johnson 2012-11-09 to fix VS 2010 support of SOAP reference --> + <wsdl:operation name="catalogProductAttributeRemove"> + <soap:operation soapAction="" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> <wsdl:service name="{{var wsdl.name}}Service"> <wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding"> <soap:address location="{{var wsdl.url}}" /> </wsdl:port> </wsdl:service> 
+4
source

There is an error in the Magento Core source code related to the operation "catalogProductAttributeRemove" (module core / Mage / Catalog).

To solve this problem, I commented on the following operation in the wsi.xml file of the Catalog module

  <!--wsdl:operation name="catalogProductAttributeRemove"> <wsdl:documentation>Delete attribute</wsdl:documentation> <wsdl:input message="typens:catalogProductAttributeRemoveRequest" /> <wsdl:output message="typens:catalogProductAttributeRemoveResponse" /> </wsdl:operation--> 

After that, automatically creating a web service client using VS2010 works fine!

+2
source

I included diff in wsi.xml from version 1.7.2 and downloaded it here .

So, if you cannot read diff, you can use this file directly.

+2
source

Source: https://habr.com/ru/post/924451/


All Articles