我是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中的“文档” .

我有几个问题:

  • 我的肥皂呼叫无效 . 我将其修改为:

字符串请求=“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/ \ " . With this i get a SOAPFault with message: "列表索引超出范围“

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