my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android 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

XML that contains & is not being received properly

debbie shifferd

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();
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{

PrintWriter pw = new PrintWriter( new OutputStreamWriter( urlc.getOutputStream(), "UTF-8" ));
... 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?
Don't get me started about those stupid light bulbs.
subject: XML that contains &amp; is not being received properly
Similar Threads
Trying to POST an XML to php based Web Service via HTTP POST method
Web application clustering untrusted server cert chain
parsing data and storing in the xml
XML writing and reading to an URl