• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML that contains & is not being received properly

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic