Этот код выдает ошибку "Server did not recognize the value of HTTP Header SOAPAction". Что нужно указывать в данном случае в качестве SOAPAction? Вот ссылка на описание сервиса http://www.xmethods.net/ve2/ViewListing.po;jsessionid=Sxz51WGubWKZ4jq4q8kZdM_H?key=413927 Заранее спасибо!
| Код | String message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:cook='http://www.Cookpedia.com'>" + "<soapenv:Header/> <soapenv:Body> <cook:ForToday/> </soapenv:Body> </soapenv:Envelope>";
Properties sysProps = System.getProperties(); sysProps.put("proxySet", "true"); sysProps.put("proxyHost", "proxy.myproxy.com"); sysProps.put("proxyPort", "3128"); // Build a SOAPMessage from a file MessageFactory msgFactory = MessageFactory.newInstance(); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.addHeader("Content-Type", "text/xml; charset=UTF-8"); mimeHeaders.addHeader("SOAPAction", "?"); // ??? Что тут нужно указать? ByteInputStream bis = new ByteInputStream(message.getBytes(), message .length()); SOAPMessage requestMsg = msgFactory.createMessage(mimeHeaders, bis); // Send the SOAP message to the BookQuote Web service SOAPConnectionFactory conFactry = SOAPConnectionFactory.newInstance(); SOAPConnection connection = conFactry.createConnection(); URL url = new URL("http://saintbook.org/MightyMeals/MightyMeals.asmx"); SOAPMessage replyMsg = connection.call(requestMsg, url); System.out.println(replyMsg.getSOAPBody().getTextContent());
|
|