|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
WAS Web Service mangling tags. |
« View previous topic :: View next topic » |
Author |
Message
|
stephendl |
Posted: Tue Jul 26, 2005 7:17 am Post subject: WAS Web Service mangling tags. |
|
|
Newbie
Joined: 26 Jul 2005 Posts: 7
|
Hi all,
Followed on from http://www.mqseries.net/phpBB2/viewtopic.php?t=23384
I have a session bean method that reads data from a database, looked up from an ID. It creates the result as an XML string, eg.
public String getMyInfoAsXML(String ID);
I have then turned this method into a web service using the WSAD wizard - Right Click the Session bean -> Web Services -> Deploy as Web Service (or similar, can't remember exactly what I did).
The Web Service works, but the data that is being returned in the payload of the response message is being parsed so that < becomes < and > becomes > which is not what I am looking for (I want it to be proper XML tags).
I'm getting this:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><getMyDataResponse xmlns="http://test"><getMyDataReturn><DATA>
<SUBDATA1>325442004</SUBDATA1>
<SUBDATA2>
<SUBSUBDATA2 id="858811000001104">
<TEXT>Some Info</TEXT>
</SUBSUBDATA2>
</SUBDATA2>
</DATA></getDrugDataForSnomedReturn></getDrugDataForSnomedResponse></soapenv:Body></soapenv:Envelope> |
When I'd really very much like this:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><getMyDataResponse xmlns="http://test"><getMyDataReturn><DATA>
<SUBDATA1>325442004</SUBDATA1>
<SUBDATA2>
<SUBSUBDATA2 id="858811000001104">
<TEXT>Some Info</TEXT>
</SUBSUBDATA2>
</SUBDATA2>
</DATA></getMyDataReturn></getMyDataResponse></soapenv:Body></soapenv:Envelope> |
Any ideas? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 26, 2005 7:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think there's a reason most people don't use the wizards to build production code...
My guess is that it's being done the way it is because the wizard doesn't know that your String returned data is supposed to be XML - so it's escaping the entities.
What happens if you change the method to return a parsed XML document object instead of a flattened string? You'd have to regenerate the web service... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
stephendl |
Posted: Fri Jul 29, 2005 12:56 am Post subject: |
|
|
Newbie
Joined: 26 Jul 2005 Posts: 7
|
Jeff
I agree wholly. I think that because the Web Service reply is namespaced, all of the elements in the message must be namespaced. This (I believe) would be done if the session bean returned an XML document rather than a string.
I will try it in the future (when I have time) but I have a workaround at the moment, and as the web service is used by other applications that don't seem to have a problem there is no priority. When I do I'll post a little follow-up.
Cheers for the advice. |
|
Back to top |
|
 |
JLRowe |
Posted: Mon Aug 01, 2005 2:57 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
The reason is that you are returning a string containing XML, the XML string is all escaped out (< etc etc) so that it is parsed as a string and not more XML.
Look up some JAX-RPC tutorials on how to return a SOAPElement from the session bean. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|