1

我对 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 编码的(它在任何地方都没有那个“style=rpc”标签),并且链接启用了 SSL(带有单向身份验证的 https)。此 WSDL 中的样式是“文档”。

我有几个问题:

  1. 我的肥皂电话不起作用。我将其修改为:

    字符串请求 = "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\">" + " " + " " + " " + " " + " " + modemId + "" + " " + " " + " " + "";

我不确定为什么无法显示代码,我删除了“soapenv:encodingStyle=\” http: //schemas.xmlsoap.org/soap/encoding/ \”行。这样我得到一个带有消息的 SOAPFault:“list索引超出范围"

  1. 有人能告诉我如何将该信任库添加到我的 SOAP 客户端吗?(我使用 System.setProperty 但我不确定这是否是最好的方法)。
4

0 回答 0