String url = "http://e2e-soaservices:44000/3.1/StandardDocumentService?wsdl";
//createSOAPRequest();
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
createSOAPRequest方法中的: -
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
File fXmlFile = new File("src/XML/gen_VDD7S0PLYPAS058_1409900400000_2.xml");
String xmlStr=finalXmlString(fXmlFile);
DocumentBuilderFactory docBuilderFactory=DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc=docBuilder.parse(xmlStr);
System.out.println("dasdasdasd"+doc.toString());
String serverURI = "http://www.aaancnuie.com/DCS/2012/01/DocumentCreation/IStandardDocumentService/CreateDocuments";
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("example", serverURI);
SOAPBody soapBody = envelope.getBody();
soapBody.setTextContent(xmlStr);
soapMessage.saveChanges();
return soapMessage;
控制台说,
java.net.MalformedURLException:无协议
答案 0 :(得分:0)
您需要encode
您的网址。
特殊角色必须逃脱。
逃避示例:
String url = "http://e2e-soaservices:44000/3.1/StandardDocumentService?wsdl";
String yourURLStr = "java.net.URLEncoder.encode(url, "UTF-8");
java.net.URL url = new java.net.URL(yourURLStr);