我是SOAP的新手,想在JAVA中编写SOAP客户端。我发现WSDL有很多其他的废话,因为我只使用一个服务,因此SAAJ将是最短的方式。我得到的第一个WSDL是RPC编码的,不支持SSL连接(http链接)。我的电话是:
String request = "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:AxessInterface\">"
+ " <soapenv:Header/>"
+ " <soapenv:Body>"
+ " <urn:getModemFromACS soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
+ "<ModemIDMACAddressChoice xsi:type=\"urn:ModemIDMACAddressChoiceStruct\">"
+ " <ModemID xsi:type=\"xsd:string\">"
+ modemId
+ "</ModemID>"
+ " </ModemIDMACAddressChoice>"
+ " </urn:getModemFromACS>"
+ " </soapenv:Body>"
+ "</soapenv:Envelope>";
我拥有的新WSDL是我猜不是RPC编码的(它没有&#34; style = rpc&#34;标记在任何地方)并且链接启用了SSL(使用单向身份验证的https)。风格是&#34;文件&#34;在这个WSDL中。
我有几个问题:
我的肥皂呼叫无效。我将其修改为:
字符串请求=&#34; http://www.w3.org/2001/XMLSchema-instance \&#34;的xmlns:XSD = \&#34; HTTP://www.w3.org/2001/XMLSchema \&#34;的xmlns:soapenv = \&#34; HTTP://schemas.xmlsoap.org/soap/envelope/ \&#34;的xmlns:瓮= \&#34;瓮:AxessInterface \&#34;&GT;&#34; +&#34; &#34; +&#34; &#34; +&#34; &#34; +&#34; &#34; +&#34; &#34; + modemId +&#34;&#34; +&#34; &#34; +&#34; &#34; +&#34; &#34; +&#34;&#34;;
我不确定为什么代码无法显示,我删除了行&#34; soapenv:encodingStyle = \&#34; http://schemas.xmlsoap.org/soap/encoding/ \&#34; 。有了这个,我得到一个带有消息的SOAPFault:&#34;列表索引超出范围&#34;