我正在尝试使用 Websphere 6.1 Java2Wsdl ant 任务从 Endpoint 类生成 WSDL 文件
端点编码为
class MySvcEndpoint implements MySvc_SEI {
public SomeOtherComplexType[] myCall(String[] argStrings)
throws javax.xml.soap.SOAPException
{
.
.
}
}
界面是:
public interface MySvc_SEI extends java.rmi.Remote {
public SomeOtherComplexType[] myCall(String[] argStrings)
throws javax.xml.soap.SOAPException;
}
生成的 WSDL 包含以下条目:
<element name="myCall">
<complexType>
<sequence/>
</complexType>
</element>
<element name="myCallResponse">
<complexType>
<sequence/>
</complexType>
</element>
正如你所看到的,'argStrings' 参数已经消失了,尽管它似乎认识到应该有一些东西。此外,返回类型似乎也消失了。
无论如何,当我基于 WSDL 生成存根时,生成的接口是:
public interface MySvc {
public void myCall() throws java.rmi.RemoteException;
}
以前有没有人遇到过这个问题,如果是这样,它是如何解决的?
谢谢
[编辑] 好的,似乎是当有一个数组作为输入参数时。我尝试了以下方法:
public int m1(String s1) throws SOAPException {
return 0;
}
public int[] m2(String s1) throws SOAPException {
int[] a = { 0 };
return a;
}
public int m3(String[] sArr) throws SOAPException {
return 0;
}
public int[] m4(String[] sArr) throws SOAPException {
int[] a = { 0 };
return a;
}
并得到以下 WSDL 输出:
<element name="m1">
<complexType>
<sequence>
<element name="s1" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="m1Response">
<complexType>
<sequence>
<element name="m1Return" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="m2">
<complexType>
<sequence>
<element name="s1" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="m2Response">
<complexType>
<sequence>
<element name="m2Return" nillable="true" type="impl:ArrayOf_1368777266_int"/>
</sequence>
</complexType>
</element>
<element name="m3">
<complexType>
<sequence/>
</complexType>
</element>
<element name="m3Response">
<complexType>
<sequence/>
</complexType>
</element>
<element name="m4">
<complexType>
<sequence/>
</complexType>
</element>
<element name="m4Response">
<complexType>
<sequence/>
</complexType>
</element>
如您所见,带有简单参数的方法生成正常,但是带有数组参数的方法被搞砸了。