• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML that contains & is not being received properly

 
debbie shifferd
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic