6


我正在尝试使用 Visual Studio 2010 创建一个 Web 服务客户端。如果我使用版本 SOAP V2 中的 wsdl 文件,该客户端运行良好。
当我在 Magento 中设置属性WS-I ComplianceYes在 VS2010 中重新编译 Web 服务客户端时,它不起作用!!!某些方法从生成的 WSDL 文件中消失。

如果我使用该工具生成 java Web 服务客户端,我会发现同样的问题wsimport
知道发生了什么吗?

4

3 回答 3

4

我遇到了同样的问题,而不是注释掉 catalogProductAttributeRemove,我实际上查看了丢失的内容并将附加部分添加到我的 wsi.xml 文件中。感谢 Juanma R. 为我指出需要更正的文件的方向。

我引用了 catalogProductAttributeCreate 的条目,作为解决此问题可能需要存在的其他部分的参考点。我对 WSDL 真的一无所知,只是试图寻找可能缺少的东西。

更改文件后,我刷新了 Magento 中的所有缓存,并确认新条目显示在 /index.php/api/v2_soap?wsdl=1 的 WSDL 文件中。然后我删除了添加到 VS 2010 的 Web 引用,并再次执行了添加 Web 引用的步骤。这次添加后我没有错误。

我正在修补的 Magento 版本是 Magento Enterprise 1.12.0.2,但我希望它适用于与 catalogProductAttributeRemove 显示相同错误的其他版本。

这是我在 wsi.xml 文件中更改的内容的快速差异:

*** 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>
于 2012-11-09T19:00:01.907 回答
2

原始 Magento Core 代码中存在错误,与操作“catalogProductAttributeRemove”(模块 core/Mage/Catalog)有关。

为了解决它,我在模块目录的 wsi.xml 文件中注释了以下操作

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

之后,使用 VS2010 自动构建 Web 服务客户端就完美了!

于 2012-09-10T10:09:47.220 回答
2

我将 diff 包含在 1.7.2 版的 wsi.xml 中,并在此处上传。

所以,如果你不能正确读取差异,你可以直接使用这个文件。

于 2013-06-23T16:47:56.013 回答