0

我部署了“hello world”服务(Tomcat + Axis2):

public class ServerLogic {
    public int add(int x, int y) {
        return x + y;
    }
}

但是 Axis2 像这样生成 WSDL:

<xs:element name="add">
    <xs:complexType>
        <xs:sequence>
            <xs:element minOccurs="0" name="x" type="xs:int"/>
            <xs:element minOccurs="0" name="y" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
<xs:element name="addResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:element minOccurs="0" name="return" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

当我通过这个 WSDL 生成 C# 客户端时,我得到了带有这个签名的方法:

 void add(int x, [System.Xml.Serialization.XmlIgnoreAttribute()] bool xSpecified,
          int y, [System.Xml.Serialization.XmlIgnoreAttribute()] bool ySpecified,
out int @return, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool returnSpecified);

据我了解,*Specified-parameters - 它是minOccurs="0". 那么,我怎么能告诉 Axis2minOccurs="0"从生成的 WSDL 中删除它呢?

4

1 回答 1

0

You can generate a WSDL file and then customize it.

For generate the WSDL file you can use Axis2's Java2WSDL as specified here: http://axis.apache.org/axis2/java/core/docs/quickstartguide.html#ready (full reference here: http://axis.apache.org/axis2/java/core/docs/reference.html)

You can also generate a wsdl file using Apache Ant as in the quickstart example: http://axis.apache.org/axis2/java/core/docs/quickstartguide.html#deploy.

The customized WSDL file must be placed in the META-INF folder.

于 2013-05-28T10:48:32.720 回答