Changeset 3462 for trunk/gsdl3
- Timestamp:
- 2002-10-14T16:01:36+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/SOAPCommunicator.java
r3235 r3462 73 73 74 74 // put this into Communicator?? 75 public String process(Stringin) {75 public Node process(Node xml_in) { 76 76 // needs to catch SOAPException, MalformedURLException 77 77 try { 78 78 // add the message encloser back on, and edit the to field 79 Document doc = converter_.getDOM(in);80 79 Document newdoc = converter_.newDOM(); 81 80 Element top = newdoc.createElement("message"); 82 top.appendChild(newdoc.importNode( doc.getDocumentElement(), true));81 top.appendChild(newdoc.importNode(xml_in, true)); 83 82 //newdoc.appendChild(top); 84 83 NodeList requests = top.getElementsByTagName("request"); 85 84 if (requests.getLength()==0) { 86 85 // no requests 87 return "";86 return null; 88 87 } 89 88 for (int i=0;i<requests.getLength(); i++) { … … 117 116 Parameter result = resp.getReturnValue (); 118 117 String res = (String) result.getValue(); 119 return res; 118 119 // have to modify the from field 120 Element result_node = converter_.getDOM(res).getDocumentElement(); 121 NodeList responses = result_node.getElementsByTagName("response"); 122 for (int i=0;i<responses.getLength(); i++) { 123 Element e = (Element)responses.item(i); 124 String from = e.getAttribute("from"); 125 from = GSPath.prependLink(from, connection_name_); 126 e.setAttribute("from", from); 127 } 128 129 return result_node; 120 130 } 121 131 else { … … 127 137 System.err.println("Fault Code: "+faultCode); 128 138 System.err.println("Fault String: "+faultString); 129 return new String ("<message>Fault Occurred. No greeting for you!</message>");139 return converter_.getDOM("<message>Fault Occurred. No greeting for you!</message>").getDocumentElement(); 130 140 } 131 141 } catch (SOAPException e) { 132 142 System.out.println("SOAP error:"+e.getMessage()); 133 return "";143 return null; 134 144 } catch (MalformedURLException e) { 135 145 System.out.println("URL error:"+e.getMessage()); 136 return "";146 return null; 137 147 } 138 148 } 139 149 140 public Node process(Node xml_in) { 141 String request = converter_.getString(xml_in); 142 String result = process(request); 143 return converter_.getDOM(result).getDocumentElement(); 144 150 public String process(String xml_in) { 151 Node n = converter_.getDOM(xml_in).getDocumentElement(); 152 Node result = process(n); 153 if (result == null) { 154 return ""; 155 } 156 return converter_.getString(result); 145 157 } 146 158 }
Note:
See TracChangeset
for help on using the changeset viewer.