notarzt-hd
06-21-2006, 04:49 PM
Hi,
I wrote a little test program for testing a WebService (EJB3 with @WebService-Annotation). But I m getting a problem with binding the XML-Result string to a dataset. All letters like < > and " are not right diplayed and so I cant access the XML well inside of the Dataset (with XPath)
When I'am showing the "Webservice result xml string" in a <text>-Element it works fine and well formatted. How that can be?
Below my Code. May someon has a idea!?
Thx :)
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<canvas debug="true">
<dataset name="myDset"/>
<simplelayout/>
<soap name="mySOAP" wsdl="http://192.168.0.2:8080/TestEJB/TestContainerBean?wsdl">
<method name="makedoc" args="func">
<![CDATA[
if (func == null) return;
var s = '<' + func + ' xmlns="' + 'http://container.test.sml.com/jaws' + '" >' + '</' + func + '>';
return s;
]]>
</method>
<handler name="onload">
canvas.buttons.setAttribute('visible', true);
</handler>
<handler name="onerror" args="error">
Debug.write('error mySOAP:', error);
</handler>
<handler name="ontimeout" args="error">
Debug.write('timeout mySOAP:', error);
</handler>
<handler name="ondata" args="value">
<!-- Showing the XML-Result-Sting in the Outputtext -> works fine and well formatted !!! -->
myOutput.setAttribute('text',value);
<!-- Showing the XML-Result-Sting in the Debug-View -> doesn't work fine and not right formatted!!!
all > < and " - signes are shown as some < > " :(
-->
Debug.write(value);
</handler>
<remotecall funcname="testString" dataobject="myDset">
<param value="${canvas.mySOAP.makedoc('testString')}"/>
</remotecall>
</soap>
<view name="buttons" x="10" y="10" visible="false" width="100%" layout="spacing: 10" >
<text><b>WebService Test</b></text>
<button text="Invoke testString" onclick="canvas.mySOAP.testString.invoke()" />
<button text="Show Dataset" onclick="Debug.write(myDset)" />
<text multiline="true" id="myOutput" width="100%"></text>
</view>
</canvas>
The output of "myOutput":
<sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml>
The output of "Debug.write(value)":
<testStringResponse><result><sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml></result></testStringResponse>
The output of "Show Dataset":
<myDset><item><testStringResponse><result><sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml></result></testStringResponse></item></myDset>
The WSDL Document (generated by JBOSS-WS):
<definitions name='TestContainerBeanService' targetNamespace='http://container.test.sml.com/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://container.test.sml.com/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
<schema elementFormDefault='qualified' targetNamespace='http://container.test.sml.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://container.test.sml.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<complexType name='testString'>
<sequence/>
</complexType>
<complexType name='testStringResponse'>
<sequence>
<element name='result' nillable='true' type='string'/>
</sequence>
</complexType>
<element name='testString' type='tns:testString'/>
<element name='testStringResponse' type='tns:testStringResponse'/>
</schema>
</types>
<message name='TestContainerBean_testStringResponse'>
<part element='tns:testStringResponse' name='result'/>
</message>
<message name='TestContainerBean_testString'>
<part element='tns:testString' name='parameters'/>
</message>
<portType name='TestContainerBean'>
<operation name='testString'>
<input message='tns:TestContainerBean_testString'/>
<output message='tns:TestContainerBean_testStringResponse'/>
</operation>
</portType>
<binding name='TestContainerBeanBinding' type='tns:TestContainerBean'>
<soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='testString'>
<soap:operation soapAction=''/>
<input>
<soap:body use='literal'/>
</input>
<output>
<soap:body use='literal'/>
</output>
</operation>
</binding>
<service name='TestContainerBeanService'>
<port binding='tns:TestContainerBeanBinding' name='TestContainerBeanPort'>
<soap:address location='http://mastert:8080/TestEJB/TestContainerBean'/>
</port>
</service>
</definitions>
I wrote a little test program for testing a WebService (EJB3 with @WebService-Annotation). But I m getting a problem with binding the XML-Result string to a dataset. All letters like < > and " are not right diplayed and so I cant access the XML well inside of the Dataset (with XPath)
When I'am showing the "Webservice result xml string" in a <text>-Element it works fine and well formatted. How that can be?
Below my Code. May someon has a idea!?
Thx :)
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<canvas debug="true">
<dataset name="myDset"/>
<simplelayout/>
<soap name="mySOAP" wsdl="http://192.168.0.2:8080/TestEJB/TestContainerBean?wsdl">
<method name="makedoc" args="func">
<![CDATA[
if (func == null) return;
var s = '<' + func + ' xmlns="' + 'http://container.test.sml.com/jaws' + '" >' + '</' + func + '>';
return s;
]]>
</method>
<handler name="onload">
canvas.buttons.setAttribute('visible', true);
</handler>
<handler name="onerror" args="error">
Debug.write('error mySOAP:', error);
</handler>
<handler name="ontimeout" args="error">
Debug.write('timeout mySOAP:', error);
</handler>
<handler name="ondata" args="value">
<!-- Showing the XML-Result-Sting in the Outputtext -> works fine and well formatted !!! -->
myOutput.setAttribute('text',value);
<!-- Showing the XML-Result-Sting in the Debug-View -> doesn't work fine and not right formatted!!!
all > < and " - signes are shown as some < > " :(
-->
Debug.write(value);
</handler>
<remotecall funcname="testString" dataobject="myDset">
<param value="${canvas.mySOAP.makedoc('testString')}"/>
</remotecall>
</soap>
<view name="buttons" x="10" y="10" visible="false" width="100%" layout="spacing: 10" >
<text><b>WebService Test</b></text>
<button text="Invoke testString" onclick="canvas.mySOAP.testString.invoke()" />
<button text="Show Dataset" onclick="Debug.write(myDset)" />
<text multiline="true" id="myOutput" width="100%"></text>
</view>
</canvas>
The output of "myOutput":
<sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml>
The output of "Debug.write(value)":
<testStringResponse><result><sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml></result></testStringResponse>
The output of "Show Dataset":
<myDset><item><testStringResponse><result><sml><employee id="50" name="m1" /><employee id="51" name="m2" /></sml></result></testStringResponse></item></myDset>
The WSDL Document (generated by JBOSS-WS):
<definitions name='TestContainerBeanService' targetNamespace='http://container.test.sml.com/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://container.test.sml.com/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
<schema elementFormDefault='qualified' targetNamespace='http://container.test.sml.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://container.test.sml.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<complexType name='testString'>
<sequence/>
</complexType>
<complexType name='testStringResponse'>
<sequence>
<element name='result' nillable='true' type='string'/>
</sequence>
</complexType>
<element name='testString' type='tns:testString'/>
<element name='testStringResponse' type='tns:testStringResponse'/>
</schema>
</types>
<message name='TestContainerBean_testStringResponse'>
<part element='tns:testStringResponse' name='result'/>
</message>
<message name='TestContainerBean_testString'>
<part element='tns:testString' name='parameters'/>
</message>
<portType name='TestContainerBean'>
<operation name='testString'>
<input message='tns:TestContainerBean_testString'/>
<output message='tns:TestContainerBean_testStringResponse'/>
</operation>
</portType>
<binding name='TestContainerBeanBinding' type='tns:TestContainerBean'>
<soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='testString'>
<soap:operation soapAction=''/>
<input>
<soap:body use='literal'/>
</input>
<output>
<soap:body use='literal'/>
</output>
</operation>
</binding>
<service name='TestContainerBeanService'>
<port binding='tns:TestContainerBeanBinding' name='TestContainerBeanPort'>
<soap:address location='http://mastert:8080/TestEJB/TestContainerBean'/>
</port>
</service>
</definitions>