File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable encoding in javax.xml.SOAP message

 
Abhi Barik
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to create a SOAP message by javax.xml.SOAP package.
for one attribute we need to set the value as CreateTime >'10/10/2011' . so that our SOAP element of the request will look like below.

<ns:keys query=" CreateTime >'10/10/2011'"/>


I have used below code to form this soap element of the request .

String query = "CreateTime" + ">" + "'10/10/2011'";
QName keysName = new QName("keys");
SOAPElement keysElement = modelElement.addChildElement(keysName);
keysElement.setAttribute("query",query); // adding the query


This code creates the the SOAP request as below.

keys query="CreateTime & gt;'10/10/2011'

The web service does not recognize this SOAP request , because of > replaced by '>' in the SOAP request.

Could any one help me to disable this kind of encoding by javax.xml.SOAP. I need & gt; or & lt; in my request instead of > or <

Thanks,
Abhi

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
First of all, I do not think you can disable the kind of rewriting of characters such as '>' and '<' in XML data that you are talking about.
Second, I do not see anything wrong with the '>' character being replaced in your string, since the string in question is the value of an attribute, namely the query attribute.
Finally, I would like to see a complete SOAP message that you are trying to create in order to be able to give further advise - I suspect that you are trying to do something that perhaps can be done in a better way.
Best wishes!
 
Philip Grove
Ranch Hand
Posts: 68
Firefox Browser Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your example is not valid XML, but the encoded string is. So let the XML generator do its work, and write a proper parser to handle the encoded strings.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic