我是Magento的新手,我想创建一个自己的API v2方法.我已经建立了一个简单的项目......
Mycompany
Mymodule
etc
api.xml
config.xml
wsdl.xml
Model
Api
V2.php
Api.php
Run Code Online (Sandbox Code Playgroud)
这些是主要文件...
(1)api.xml
<config>
<api>
<resources>
<mymodule translate="title" module="mymodule">
<title>mymodule</title>
<model>mymodule/api</model>
<methods>
<myapimethod translate="title" module="mymodule">
<title>myapimethod</title>
<acl>mymodule/myapimethod</acl>
</myapimethod>
</methods>
</mymodule>
</resources>
<v2>
<resources_function_prefix>
<mymodule>mymodule</mymodule>
</resources_function_prefix>
</v2>
<acl>
<resources>
<mymodule translate="title" module="mymodule">
<title>Mymodule</title>
<sort_order>2000</sort_order>
<myapimethod translate="title" module="mymodule">
<title>myapimethod</title>
</myapimethod>
</mymodule>
</resources>
</acl>
</api>
</config>
Run Code Online (Sandbox Code Playgroud)
(2)wsdl.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
</schema>
</types> …Run Code Online (Sandbox Code Playgroud)
我正在尝试使用Visual Studio 2010创建Web服务客户端.如果我在版本SOAP V2中使用wsdl文件,则客户端可以正常工作.
当我的属性设置WS-I Compliance,以Yes在Magento和重新编译VS2010 Web服务客户端,这是行不通的!某些方法从生成的WSDL文件中消失.
如果我使用该工具生成java Web服务客户端,我发现了同样的问题wsimport.
知道发生了什么事吗?