You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Alexander Blotny <Al...@fokus.fraunhofer.de> on 2009/12/14 10:39:59 UTC
Sample Calculator
Hi,
I am trying to execute the calculator sample. The sample is starting and is
reachable via SOAP Messages but there is a problem with the parameters. The
parameters are arriving as null respectively zero if it is a number.
I am running Tuscany in Felix accordingly to the tutorial on the home page.
I simplified the calculator sample:
Calculator.composite
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
targetNamespace="http://sample" xmlns:sample="http://sample"
name="Calculator"> <component name="CalculatorServiceComponent">
<implementation.java class="calculator.CalculatorServiceImpl"/>
<service name="CalculatorService"> <interface.java
interface="calculator.CalculatorService"/> <binding.ws
uri="http://localhost:8086/CalculatorService"/> </service>
</component> </composite>
Interface:
@Remotable public interface CalculatorService { String add(String n1,
String n2); double subtract(double n1, double n2); double
multiply(double n1, double n2); double divide(double n1, double n2); }
Implementation:
public String add(String n1, String n2) { System.out.println(n1 +
" + " + n2 + " = " + (n1 + n2)); return n1 + n2; } public
double divide(double n1, double n2) { System.out.println(n1 + " / " +
n2 + " = " + (n1 / n2)); return n1 / n2; } public double
multiply(double n1, double n2) { System.out.println(n1 + " * " + n2 +
" = " + (n1 * n2)); return n1 * n2; } public double
subtract(double n1, double n2) { System.out.println(n1 + " - " + n2 +
" = " + (n1 - n2)); return n1 - n2; }
If I trigger the service the SOAP request contains the 2 parameters but on
the console I see that the parameters are null or zero.
There is no error message as far as I can see.
Thx,
Alex
Re: Sample Calculator
Posted by ant elder <an...@gmail.com>.
It looks like the Soap Client is using RPC encoded SOAP messages which
are not supported by Tuscany. Tuscany should really be giving an error
for this, can you raise a JIRA so we can get that fixed. I'm not
familiar with the Soap Client but does it have any config options to
change to not use rpc/encoded, thats a really old style thats not used
much these days.
...ant
On Thu, Jan 7, 2010 at 10:42 AM, Alexander Blotny
<Al...@fokus.fraunhofer.de> wrote:
> Hi,
>
> I found the problem of the null or zero parameters using the Calculator
> example. The problem exists using the Soap Client v1.6.3.1 for Mac OS X.
> I tried the JAX-WS Client from the website* and the example worked.
>
> *
> http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/Running+Tuscany+SCA+2.x+with+Equinox+and+Felix
>
> If somebody is interested in the problem here are the wireshark traces for
> both tests.
> In both cases a multiply operation with the parameters 1 and 1 are executed.
> The Soap Client returns 0 as result and the JAX WS Client returns the
> correct result 1.
>
> 1. Soap Client
>
> POST /CalculatorService HTTP/1.1
> User-Agent: Mac OS X; WebServicesCore (352)
> Host: 172.16.83.1
> Content-Type: text/xml
> Soapaction:
> Content-Length: 615
> Connection: close
>
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Body>
> <multiply xmlns="http://dosgi.calculator/">
> <arg0 xsi:type="xsd:double">1</arg0>
> <arg1 xsi:type="xsd:double">1</arg1>
> </multiply>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> HTTP/1.1 200 OK
> Content-Type: text/xml; charset=utf-8
> Connection: close
>
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:multiplyResponse
> xmlns:ns2="http://dosgi.calculator/"><return>0.0</return></ns2:multiplyResponse></soapenv:Body></soapenv:Envelope>
>
> 2. JAX WS Client
>
> POST /CalculatorService HTTP/1.1
> Content-type: text/xml;charset="utf-8"
> Soapaction: ""
> Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *;
> q=.2, */*; q=.2
> User-Agent: JAX-WS RI 2.1.6 in JDK 6
> Host: 172.16.83.1:8086
> Connection: keep-alive
> Content-Length: 214
>
> <?xml version="1.0" ?><S:Envelope
> xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:multiply
> xmlns:ns2="http://dosgi.calculator/"><arg0>1.0</arg0><arg1>1.0</arg1></ns2:multiply></S:Body></S:Envelope>HTTP/1.1
> 200 OK
>
> Content-Type: text/xml; charset=utf-8
> Transfer-Encoding: chunked
>
> 108
> <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:multiplyResponse
> xmlns:ns2="http://dosgi.calculator/"><return>1.0</return></ns2:multiplyResponse></soapenv:Body></soapenv:Envelope>
> 0
>
>
>
>
>
>
>
> Am 14.12.09 11:14 schrieb "Alexander Blotny" unter
> <Al...@fokus.fraunhofer.de>:
>
> Maybe I should add some information. I am starting the composite in the
> BundleActivator with following code:
>
> public class CalculatorActivator implements BundleActivator { private
> Node node; public void start(BundleContext context) throws Exception {
> try { NodeFactory factory = NodeFactory.newInstance();
> String url =
> ContributionLocationHelper.getContributionLocation(getClass());
> Contribution contrib = new Contribution("c1", url);
> node = factory.createNode("Calculator.composite", contrib);
> node.start(); } catch (Throwable e) {
> e.printStackTrace(); } } public void
> stop(BundleContext context) throws Exception { if (node != null) {
> node.stop(); node = null; } }
> }
>
> I f I start this bundle everything seems fine and the service is reachable
> but there are the problems as mentioned...
>
>
> Am 14.12.09 10:39 schrieb "Alexander Blotny" unter
> <Al...@fokus.fraunhofer.de>:
>
> Hi,
>
> I am trying to execute the calculator sample. The sample is starting and is
> reachable via SOAP Messages but there is a problem with the parameters. The
> parameters are arriving as null respectively zero if it is a number.
>
> I am running Tuscany in Felix accordingly to the tutorial on the home page.
>
> I simplified the calculator sample:
>
> Calculator.composite
>
> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
> targetNamespace="http://sample"
> xmlns:sample="http://sample" name="Calculator">
> <component name="CalculatorServiceComponent"> <implementation.java
> class="calculator.CalculatorServiceImpl"/> <service
> name="CalculatorService"> <interface.java
> interface="calculator.CalculatorService"/> <binding.ws
> uri="http://localhost:8086/CalculatorService"/> </service>
> </component> </composite>
> Interface:
>
> @Remotable public interface CalculatorService { String add(String n1,
> String n2); double subtract(double n1, double n2); double
> multiply(double n1, double n2); double divide(double n1, double n2); }
>
> Implementation:
>
> public String add(String n1, String n2) { System.out.println(n1 +
> " + " + n2 + " = " + (n1 + n2)); return n1 + n2; } public
> double divide(double n1, double n2) { System.out.println(n1 + " / " +
> n2 + " = " + (n1 / n2)); return n1 / n2; } public double
> multiply(double n1, double n2) { System.out.println(n1 + " * " + n2 +
> " = " + (n1 * n2)); return n1 * n2; } public double
> subtract(double n1, double n2) { System.out.println(n1 + " - " + n2 +
> " = " + (n1 - n2)); return n1 - n2; }
>
> If I trigger the service the SOAP request contains the 2 parameters but on
> the console I see that the parameters are null or zero.
> There is no error message as far as I can see.
>
> Thx,
> Alex
>
>
>
Re: Sample Calculator
Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Hi,
I found the problem of the null or zero parameters using the Calculator
example. The problem exists using the Soap Client v1.6.3.1 for Mac OS X.
I tried the JAX-WS Client from the website* and the example worked.
*
http://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/Running+Tuscany+SC
A+2.x+with+Equinox+and+Felix
If somebody is interested in the problem here are the wireshark traces for
both tests.
In both cases a multiply operation with the parameters 1 and 1 are executed.
The Soap Client returns 0 as result and the JAX WS Client returns the
correct result 1.
1. Soap Client
POST /CalculatorService HTTP/1.1
User-Agent: Mac OS X; WebServicesCore (352)
Host: 172.16.83.1
Content-Type: text/xml
Soapaction:
Content-Length: 615
Connection: close
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<multiply xmlns="http://dosgi.calculator/">
<arg0 xsi:type="xsd:double">1</arg0>
<arg1 xsi:type="xsd:double">1</arg1>
</multiply>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Connection: close
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2
:multiplyResponse
xmlns:ns2="http://dosgi.calculator/"><return>0.0</return></ns2:multiplyRespo
nse></soapenv:Body></soapenv:Envelope>
2. JAX WS Client
POST /CalculatorService HTTP/1.1
Content-type: text/xml;charset="utf-8"
Soapaction: ""
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *;
q=.2, */*; q=.2
User-Agent: JAX-WS RI 2.1.6 in JDK 6
Host: 172.16.83.1:8086
Connection: keep-alive
Content-Length: 214
<?xml version="1.0" ?><S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:multiply
xmlns:ns2="http://dosgi.calculator/"><arg0>1.0</arg0><arg1>1.0</arg1></ns2:m
ultiply></S:Body></S:Envelope>HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
108
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2
:multiplyResponse
xmlns:ns2="http://dosgi.calculator/"><return>1.0</return></ns2:multiplyRespo
nse></soapenv:Body></soapenv:Envelope>
0
Am 14.12.09 11:14 schrieb "Alexander Blotny" unter
<Al...@fokus.fraunhofer.de>:
> Maybe I should add some information. I am starting the composite in the
> BundleActivator with following code:
>
> public class CalculatorActivator implements BundleActivator { private Node
> node; public void start(BundleContext context) throws Exception {
> try { NodeFactory factory = NodeFactory.newInstance();
> String url = ContributionLocationHelper.getContributionLocation(getClass());
> Contribution contrib = new Contribution("c1", url); node =
> factory.createNode("Calculator.composite", contrib); node.start();
> } catch (Throwable e) { e.printStackTrace(); } }
> public void stop(BundleContext context) throws Exception { if (node !=
> null) { node.stop(); node = null; } }
> }
>
> I f I start this bundle everything seems fine and the service is reachable but
> there are the problems as mentioned...
>
>
> Am 14.12.09 10:39 schrieb "Alexander Blotny" unter
> <Al...@fokus.fraunhofer.de>:
>
>> Hi,
>>
>> I am trying to execute the calculator sample. The sample is starting and is
>> reachable via SOAP Messages but there is a problem with the parameters. The
>> parameters are arriving as null respectively zero if it is a number.
>>
>> I am running Tuscany in Felix accordingly to the tutorial on the home page.
>>
>> I simplified the calculator sample:
>>
>> Calculator.composite
>>
>> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
>> targetNamespace="http://sample" xmlns:sample="http://sample"
>> name="Calculator"> <component name="CalculatorServiceComponent">
>> <implementation.java class="calculator.CalculatorServiceImpl"/>
>> <service name="CalculatorService"> <interface.java
>> interface="calculator.CalculatorService"/> <binding.ws
>> uri="http://localhost:8086/CalculatorService"/> </service>
>> </component> </composite>
>> Interface:
>>
>> @Remotable public interface CalculatorService { String add(String n1,
>> String n2); double subtract(double n1, double n2); double
>> multiply(double n1, double n2); double divide(double n1, double n2); }
>>
>> Implementation:
>>
>> public String add(String n1, String n2) { System.out.println(n1 +
>> " + " + n2 + " = " + (n1 + n2)); return n1 + n2; } public double
>> divide(double n1, double n2) { System.out.println(n1 + " / " + n2 + "
>> = " + (n1 / n2)); return n1 / n2; } public double
>> multiply(double n1, double n2) { System.out.println(n1 + " * " + n2 +
>> " = " + (n1 * n2)); return n1 * n2; } public double
>> subtract(double n1, double n2) { System.out.println(n1 + " - " + n2 +
>> " = " + (n1 - n2)); return n1 - n2; }
>>
>> If I trigger the service the SOAP request contains the 2 parameters but on
>> the console I see that the parameters are null or zero.
>> There is no error message as far as I can see.
>>
>> Thx,
>> Alex
>>
>
Re: Sample Calculator
Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Maybe I should add some information. I am starting the composite in the
BundleActivator with following code:
public class CalculatorActivator implements BundleActivator { private
Node node; public void start(BundleContext context) throws Exception {
try { NodeFactory factory = NodeFactory.newInstance();
String url = ContributionLocationHelper.getContributionLocation(getClass());
Contribution contrib = new Contribution("c1", url); node =
factory.createNode("Calculator.composite", contrib);
node.start(); } catch (Throwable e) { e.printStackTrace();
} } public void stop(BundleContext context) throws Exception {
if (node != null) { node.stop(); node = null; }
}
}
I f I start this bundle everything seems fine and the service is reachable
but there are the problems as mentioned...
Am 14.12.09 10:39 schrieb "Alexander Blotny" unter
<Al...@fokus.fraunhofer.de>:
> Hi,
>
> I am trying to execute the calculator sample. The sample is starting and is
> reachable via SOAP Messages but there is a problem with the parameters. The
> parameters are arriving as null respectively zero if it is a number.
>
> I am running Tuscany in Felix accordingly to the tutorial on the home page.
>
> I simplified the calculator sample:
>
> Calculator.composite
>
> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
> targetNamespace="http://sample" xmlns:sample="http://sample"
> name="Calculator"> <component name="CalculatorServiceComponent">
> <implementation.java class="calculator.CalculatorServiceImpl"/>
> <service name="CalculatorService"> <interface.java
> interface="calculator.CalculatorService"/> <binding.ws
> uri="http://localhost:8086/CalculatorService"/> </service>
> </component> </composite>
> Interface:
>
> @Remotable public interface CalculatorService { String add(String n1,
> String n2); double subtract(double n1, double n2); double
> multiply(double n1, double n2); double divide(double n1, double n2); }
>
> Implementation:
>
> public String add(String n1, String n2) { System.out.println(n1 + "
> + " + n2 + " = " + (n1 + n2)); return n1 + n2; } public double
> divide(double n1, double n2) { System.out.println(n1 + " / " + n2 + " =
> " + (n1 / n2)); return n1 / n2; } public double multiply(double
> n1, double n2) { System.out.println(n1 + " * " + n2 + " = " + (n1 *
> n2)); return n1 * n2; } public double subtract(double n1, double
> n2) { System.out.println(n1 + " - " + n2 + " = " + (n1 - n2));
> return n1 - n2; }
>
> If I trigger the service the SOAP request contains the 2 parameters but on the
> console I see that the parameters are null or zero.
> There is no error message as far as I can see.
>
> Thx,
> Alex
>