wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes XML that contains & is not being received properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML that contains & is not being received properly " Watch "XML that contains & is not being received properly " New topic
Author

XML that contains & is not being received properly

debbie shifferd
Greenhorn

Joined: Oct 16, 2003
Posts: 11
We are creating XML strings in an app on a Weblogic 7 server that we send to another server that runs webMethods. We are receiving an ACK code of 3 when we send the webMethods server XML that contains:
<DESCRIPTN>Rack & Stack packing material</DESCRIPTN>

There are several other places in our application where we send this same server XML that contains & within a tag with no problem. I have compared my code to the other code and cannot figure out what I am doing wrong.

I can step through the webMethods piece because we save the inbound pipeline. I can see where the variable xmldata contains the entire XML doc up until the &

webMethods shows in the pipeline that it has an unknown object with a name and value pair of name= & Stack packing material
value = null

My code within Weblogic:

url_str = vo.getCustomerUrl();
if (url_str == null) {
throw new COIException("url str is missing");
}
url = new URL(url_str);
urlConn = url.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
xml_docs = "xmldata="+xml_docs; //xml_docs has already been created
if(("0").equals(xml_obj.sendXML(xml_docs, urlc))){
System.out.println("send XML docs successfully----");
}

public String sendXML(String XMLDocs, URLConnection urlc) throws COIException{

try{
PrintWriter pw = new PrintWriter( new OutputStreamWriter( urlc.getOutputStream(), "UTF-8" ));
pw.println(XMLDocs);
pw.close();
}
... and then we handle the ack .... which is not causing a problem

Would anyone know what else I need to add to my code so that the & does not cause a problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML that contains &amp; is not being received properly