Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SOAP客户端SAAJ_Java_Web Services_Ssl_Soap_Saaj - Fatal编程技术网

Java SOAP客户端SAAJ

Java SOAP客户端SAAJ,java,web-services,ssl,soap,saaj,Java,Web Services,Ssl,Soap,Saaj,我对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

我对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>";
String request=“”
+ "   "
+ "   "
+ "      "
+ ""
+ "            "
+摩德米德
+ ""
+ "         "
+ "      "
+ "   "
+ "";
我所拥有的新WSDL可能不是RPC编码的(它在任何地方都没有“style=RPC”标记),并且链接是启用SSL的(带有单向身份验证的https)。在这个WSDL中,样式是“文档”

我有几个问题:

  • 我的soap呼叫不起作用。我将其修改为:

    字符串请求=”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:axesInterface\”>” + " " + " " + " " + " " + " " +摩德米德 + "" + " " + " " + " " +“

  • 我不确定为什么代码不能显示,我删除了行“soapenv:encodingStyle=\”\”。有了这个,我得到了一个SOAPFault消息:“列表索引超出范围”

  • 有人能告诉我如何将信任库添加到我的SOAP客户端吗?(我使用System.setProperty,但我不确定这是否是最好的方法)
    你究竟为什么要用如此艰难的方式进行soap调用?我的意思是手动构造SOAP请求。使用CXF读取WSDL并为您生成客户端代码。不要重新发明轮子。@Namphibian:后端的WSDL很奇怪,它最初不适用于CXF(因为它是RPC编码的)。我已将其更改,现在将尝试使用CXF。